mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Make tests work with --view-protocol
This commit is contained in:
@ -12960,7 +12960,8 @@ select * from t10 where a<3 and b!=5 and c<10;
|
||||
a b c
|
||||
1 1 1
|
||||
2 2 2
|
||||
select json_detailed(json_extract(trace, '$**.attaching_conditions_to_tables')) as out1 from information_schema.optimizer_trace;
|
||||
select json_detailed(json_extract(trace, '$**.attaching_conditions_to_tables')) as out1
|
||||
from information_schema.optimizer_trace;
|
||||
out1
|
||||
[
|
||||
{
|
||||
@ -12979,7 +12980,6 @@ drop table t10;
|
||||
#
|
||||
# MDEV-21092: EXISTS to IN is not reflected in the optimizer trace
|
||||
#
|
||||
set @@optimizer_switch = 'exists_to_in=on,in_to_exists=on,semijoin=on,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on';
|
||||
set optimizer_trace='enabled=on';
|
||||
create table t1 (cn_c int, cn_n char(10), cn_a int );
|
||||
create table t2 (ci_p int, ci_c int );
|
||||
@ -12988,8 +12988,12 @@ SELECT cn_n FROM t1 WHERE (EXISTS (select 1 from t2 where ci_p > 100000 and cn_c
|
||||
OR (cn_n LIKE 'L%') )
|
||||
AND cn_a > 1000000;
|
||||
cn_n
|
||||
select json_detailed(json_extract(trace, '$.steps[*].join_optimization[0].steps[0].transformation')) from information_schema.optimizer_trace;
|
||||
json_detailed(json_extract(trace, '$.steps[*].join_optimization[0].steps[0].transformation'))
|
||||
select
|
||||
json_detailed(
|
||||
json_extract(trace, '$.steps[*].join_optimization[0].steps[0].transformation')
|
||||
) as out1
|
||||
from information_schema.optimizer_trace;
|
||||
out1
|
||||
[
|
||||
{
|
||||
"select_id": 2,
|
||||
@ -13011,8 +13015,9 @@ explain partitions select * from t2,t3 where t2.a in (2,3,4) and t3.a in (4,5);
|
||||
id select_type table partitions type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 p4,p5 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 SIMPLE t2 p2,p3,p4 ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
|
||||
select json_detailed(json_extract(trace, '$**.prune_partitions')) from information_schema.optimizer_trace;
|
||||
json_detailed(json_extract(trace, '$**.prune_partitions'))
|
||||
select json_detailed(json_extract(trace, '$**.prune_partitions')) as out1
|
||||
from information_schema.optimizer_trace;
|
||||
out1
|
||||
[
|
||||
{
|
||||
"table": "t2",
|
||||
@ -13035,8 +13040,9 @@ insert into t1 values (5),(15),(22);
|
||||
explain select * from t1 where a = 28;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
select json_detailed(json_extract(trace, '$**.prune_partitions')) from information_schema.optimizer_trace;
|
||||
json_detailed(json_extract(trace, '$**.prune_partitions'))
|
||||
select json_detailed(json_extract(trace, '$**.prune_partitions')) as out1
|
||||
from information_schema.optimizer_trace;
|
||||
out1
|
||||
[
|
||||
{
|
||||
"table": "t1",
|
||||
|
@ -940,13 +940,15 @@ insert into t10 select seq, seq, seq from seq_1_to_10000;
|
||||
explain format=json select * from t10 where a<3 and b!=5 and c<10;
|
||||
set optimizer_trace='enabled=on';
|
||||
select * from t10 where a<3 and b!=5 and c<10;
|
||||
select json_detailed(json_extract(trace, '$**.attaching_conditions_to_tables')) as out1 from information_schema.optimizer_trace;
|
||||
select json_detailed(json_extract(trace, '$**.attaching_conditions_to_tables')) as out1
|
||||
from information_schema.optimizer_trace;
|
||||
drop table t10;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-21092: EXISTS to IN is not reflected in the optimizer trace
|
||||
--echo #
|
||||
set @@optimizer_switch = 'exists_to_in=on,in_to_exists=on,semijoin=on,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on';
|
||||
# EXISTS-to-IN conversion is traced on PREPARE so won't be visible with a VIEW:
|
||||
--disable_view_protocol
|
||||
set optimizer_trace='enabled=on';
|
||||
|
||||
create table t1 (cn_c int, cn_n char(10), cn_a int );
|
||||
@ -957,8 +959,13 @@ SELECT cn_n FROM t1 WHERE (EXISTS (select 1 from t2 where ci_p > 100000 and cn_c
|
||||
OR (cn_n LIKE 'L%') )
|
||||
AND cn_a > 1000000;
|
||||
|
||||
select json_detailed(json_extract(trace, '$.steps[*].join_optimization[0].steps[0].transformation')) from information_schema.optimizer_trace;
|
||||
select
|
||||
json_detailed(
|
||||
json_extract(trace, '$.steps[*].join_optimization[0].steps[0].transformation')
|
||||
) as out1
|
||||
from information_schema.optimizer_trace;
|
||||
|
||||
--enable_view_protocol
|
||||
drop table t1, t2, t3;
|
||||
|
||||
--echo #
|
||||
@ -972,7 +979,8 @@ INSERT INTO t3 SELECT seq, seq from seq_1_to_10;
|
||||
|
||||
set optimizer_trace='enabled=on';
|
||||
explain partitions select * from t2,t3 where t2.a in (2,3,4) and t3.a in (4,5);
|
||||
select json_detailed(json_extract(trace, '$**.prune_partitions')) from information_schema.optimizer_trace;
|
||||
select json_detailed(json_extract(trace, '$**.prune_partitions')) as out1
|
||||
from information_schema.optimizer_trace;
|
||||
drop table t2,t3;
|
||||
|
||||
create table t1 (
|
||||
@ -985,7 +993,8 @@ create table t1 (
|
||||
insert into t1 values (5),(15),(22);
|
||||
|
||||
explain select * from t1 where a = 28;
|
||||
select json_detailed(json_extract(trace, '$**.prune_partitions')) from information_schema.optimizer_trace;
|
||||
select json_detailed(json_extract(trace, '$**.prune_partitions')) as out1
|
||||
from information_schema.optimizer_trace;
|
||||
drop table t1;
|
||||
|
||||
set @@optimizer_switch= @save_optimizer_switch;
|
||||
|
@ -29,10 +29,16 @@ set optimizer_trace="enabled=on";
|
||||
select count(*) from t1 where a=2 and b=5 and c=10;
|
||||
count(*)
|
||||
14
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
|
||||
set @trace=(select trace from INFORMATION_SCHEMA.OPTIMIZER_TRACE);
|
||||
select
|
||||
JSON_DETAILED(
|
||||
JSON_EXTRACT(
|
||||
JSON_EXTRACT(@trace, '$**.considered_execution_plans'),
|
||||
'$[0]'
|
||||
)
|
||||
) as JS;
|
||||
JS
|
||||
[
|
||||
[
|
||||
{
|
||||
"plan_prefix": "",
|
||||
"get_costs_for_tables":
|
||||
@ -100,10 +106,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
|
||||
"rows_for_plan": 7,
|
||||
"cost_for_plan": 0.045367017
|
||||
}
|
||||
]
|
||||
]
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select JSON_DETAILED(JSON_EXTRACT(@trace, '$**.selectivity_for_indexes')) as JS;
|
||||
JS
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -122,10 +127,16 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select count(*) from t1 where a=2 and b=5 and c=5;
|
||||
count(*)
|
||||
3
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
|
||||
set @trace=(select trace from INFORMATION_SCHEMA.OPTIMIZER_TRACE);
|
||||
select
|
||||
JSON_DETAILED(
|
||||
JSON_EXTRACT(
|
||||
JSON_EXTRACT(@trace, '$**.considered_execution_plans'),
|
||||
'$[0]'
|
||||
)
|
||||
) as JS;
|
||||
JS
|
||||
[
|
||||
[
|
||||
{
|
||||
"plan_prefix": "",
|
||||
"get_costs_for_tables":
|
||||
@ -193,10 +204,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
|
||||
"filtered": 10,
|
||||
"rows_out": 0.6
|
||||
}
|
||||
]
|
||||
]
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select JSON_DETAILED(JSON_EXTRACT(@trace, '$**.selectivity_for_indexes')) as JS;
|
||||
JS
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -213,8 +223,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select count(*) from t1 where (a=2 and b= 5);
|
||||
count(*)
|
||||
20
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JS
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -231,8 +242,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select count(*) from t1 where (a=2 and b between 0 and 100);
|
||||
count(*)
|
||||
200
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JS
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -248,8 +260,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select count(*) from t1 where (a in (2,3) and b between 0 and 100);
|
||||
count(*)
|
||||
400
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JS
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -265,8 +278,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select count(*) from t1 where (a>2 and b between 0 and 100);
|
||||
count(*)
|
||||
10702
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JS
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -282,8 +296,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select count(*) from t1 where (a>=2 and b between 0 and 100);
|
||||
count(*)
|
||||
10902
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JS
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -299,8 +314,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select count(*) from t1 where (a<=2 and b between 0 and 100);
|
||||
count(*)
|
||||
298
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JS
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -316,8 +332,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select count(*) from t1 where (a<2 and b between 0 and 100);
|
||||
count(*)
|
||||
98
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JS
|
||||
[
|
||||
[
|
||||
{
|
||||
@ -333,8 +350,9 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select count(*) from t1 where (a between 2 and 3 and b between 0 and 100);
|
||||
count(*)
|
||||
400
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes'))
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
JS
|
||||
[
|
||||
[
|
||||
{
|
||||
|
@ -20,35 +20,67 @@ select count(*) from t1 where c=5 and b=5;
|
||||
set optimizer_trace="enabled=on";
|
||||
select count(*) from t1 where a=2 and b=5 and c=10;
|
||||
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
set @trace=(select trace from INFORMATION_SCHEMA.OPTIMIZER_TRACE);
|
||||
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
# The second JSON_EXTRACT is for --view-protocol which wraps every select:
|
||||
select
|
||||
JSON_DETAILED(
|
||||
JSON_EXTRACT(
|
||||
JSON_EXTRACT(@trace, '$**.considered_execution_plans'),
|
||||
'$[0]'
|
||||
)
|
||||
) as JS;
|
||||
|
||||
select JSON_DETAILED(JSON_EXTRACT(@trace, '$**.selectivity_for_indexes')) as JS;
|
||||
|
||||
select count(*) from t1 where a=2 and b=5 and c=5;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
set @trace=(select trace from INFORMATION_SCHEMA.OPTIMIZER_TRACE);
|
||||
|
||||
# The second JSON_EXTRACT is for --view-protocol which wraps every select:
|
||||
select
|
||||
JSON_DETAILED(
|
||||
JSON_EXTRACT(
|
||||
JSON_EXTRACT(@trace, '$**.considered_execution_plans'),
|
||||
'$[0]'
|
||||
)
|
||||
) as JS;
|
||||
select JSON_DETAILED(JSON_EXTRACT(@trace, '$**.selectivity_for_indexes')) as JS;
|
||||
|
||||
--echo # Ensure that we only use selectivity from non used index for simple cases
|
||||
|
||||
|
||||
select count(*) from t1 where (a=2 and b= 5);
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
|
||||
--echo # All of the following should have selectivity=1 for index 'b'
|
||||
select count(*) from t1 where (a=2 and b between 0 and 100);
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
|
||||
select count(*) from t1 where (a in (2,3) and b between 0 and 100);
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
|
||||
select count(*) from t1 where (a>2 and b between 0 and 100);
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
|
||||
select count(*) from t1 where (a>=2 and b between 0 and 100);
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
|
||||
select count(*) from t1 where (a<=2 and b between 0 and 100);
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
|
||||
select count(*) from t1 where (a<2 and b between 0 and 100);
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
|
||||
select count(*) from t1 where (a between 2 and 3 and b between 0 and 100);
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
select JSON_DETAILED(JSON_EXTRACT(trace, '$**.selectivity_for_indexes')) as JS
|
||||
from INFORMATION_SCHEMA.OPTIMIZER_TRACE;
|
||||
|
||||
drop table t1;
|
||||
set optimizer_trace='enabled=off';
|
||||
|
@ -157,16 +157,24 @@ f0 f1 f2
|
||||
9701 0 0
|
||||
9801 0 0
|
||||
9901 0 0
|
||||
SHOW SESSION STATUS LIKE 'Sort%';
|
||||
Variable_name Value
|
||||
Sort_merge_passes 0
|
||||
Sort_priority_queue_sorts 1
|
||||
Sort_range 0
|
||||
Sort_rows 100
|
||||
Sort_scan 1
|
||||
SHOW STATUS LIKE 'Handler_read_rnd%';
|
||||
Variable_name Value
|
||||
Handler_read_rnd 100
|
||||
Handler_read_rnd_deleted 0
|
||||
Handler_read_rnd_next 87701
|
||||
DROP TABLE t1, tmp;
|
||||
create table t2
|
||||
select * from information_schema.SESSION_STATUS
|
||||
where
|
||||
variable_name like 'handler_read_rnd%' or
|
||||
variable_name like 'Sort%';
|
||||
select * from t2 where variable_name like 'Sort%';
|
||||
VARIABLE_NAME VARIABLE_VALUE
|
||||
SORT_MERGE_PASSES 0
|
||||
SORT_PRIORITY_QUEUE_SORTS 1
|
||||
SORT_RANGE 0
|
||||
SORT_ROWS 100
|
||||
SORT_SCAN 1
|
||||
select * from t2 where variable_name='HANDLER_READ_RND';
|
||||
VARIABLE_NAME VARIABLE_VALUE
|
||||
HANDLER_READ_RND 100
|
||||
select
|
||||
if(variable_value in (87701, 87802), 'OK', 'FAIL') as RES
|
||||
from t2 where variable_name='HANDLER_READ_RND_NEXT';
|
||||
RES
|
||||
OK
|
||||
DROP TABLE t1, tmp, t2;
|
||||
|
@ -61,9 +61,21 @@ SHOW SESSION STATUS LIKE 'Sort%';
|
||||
explain SELECT * FROM t1 ORDER BY f2 LIMIT 100;
|
||||
SELECT * FROM t1 ORDER BY f2 LIMIT 100;
|
||||
|
||||
# Check that Sort_priority_queue_sorts is used
|
||||
SHOW SESSION STATUS LIKE 'Sort%';
|
||||
# Check that we did scan the whole table and did LIMIT lookups
|
||||
SHOW STATUS LIKE 'Handler_read_rnd%';
|
||||
create table t2
|
||||
select * from information_schema.SESSION_STATUS
|
||||
where
|
||||
variable_name like 'handler_read_rnd%' or
|
||||
variable_name like 'Sort%';
|
||||
|
||||
DROP TABLE t1, tmp;
|
||||
# Check that Sort_priority_queue_sorts is used
|
||||
select * from t2 where variable_name like 'Sort%';
|
||||
|
||||
# Check that we did scan the whole table and did LIMIT lookups
|
||||
select * from t2 where variable_name='HANDLER_READ_RND';
|
||||
|
||||
select
|
||||
if(variable_value in (87701, 87802), 'OK', 'FAIL') as RES
|
||||
from t2 where variable_name='HANDLER_READ_RND_NEXT';
|
||||
|
||||
|
||||
DROP TABLE t1, tmp, t2;
|
||||
|
@ -981,6 +981,8 @@ ANALYZE TABLE t1_part,t2;
|
||||
EXPLAIN SELECT a, MAX(b) FROM t1_part WHERE a IN (10,100) GROUP BY a;
|
||||
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
|
||||
|
||||
# view protocol will cause changed table counters
|
||||
--disable_view_protocol
|
||||
FLUSH status;
|
||||
SELECT a, MAX(b) FROM t1_part WHERE a IN (10, 100) GROUP BY a;
|
||||
SHOW status LIKE 'handler_read%';
|
||||
@ -989,6 +991,7 @@ FLUSH status;
|
||||
SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
|
||||
SHOW status LIKE 'handler_read%';
|
||||
|
||||
--enable_view_protocol
|
||||
insert into t2 select 100,seq from seq_1_to_100;
|
||||
EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
|
||||
|
||||
|
Reference in New Issue
Block a user