2011-08-24 12:41:13 +02:00
|
|
|
drop table if exists t0, t1;
|
|
|
|
create table t0 (a int);
|
|
|
|
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
|
|
|
create table t1 (a int);
|
|
|
|
insert into t1 select A.a + 10*B.a + 100*C.a from t0 A, t0 B, t0 C;
|
2011-09-24 19:56:42 +02:00
|
|
|
alter table t1 add b int, add c int, add filler char(32);
|
|
|
|
update t1 set b=a, c=a, filler='fooo';
|
|
|
|
alter table t1 add key(a), add key(b);
|
2011-08-24 12:41:13 +02:00
|
|
|
show explain for 2*1000*1000*1000;
|
|
|
|
ERROR HY000: Unknown thread id: 2000000000
|
2011-09-24 19:56:42 +02:00
|
|
|
show explain for (select max(a) from t0);
|
|
|
|
ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement'
|
|
|
|
show explain for $thr2;
|
2011-08-24 12:41:13 +02:00
|
|
|
ERROR HY000: Error when executing command SHOW EXPLAIN: Target is not running EXPLAINable command
|
2011-09-24 19:56:42 +02:00
|
|
|
show explain for $thr1;
|
2011-08-24 12:41:13 +02:00
|
|
|
ERROR HY000: Error when executing command SHOW EXPLAIN: Target is not running EXPLAINable command
|
2011-09-25 11:05:58 +02:00
|
|
|
set @show_explain_probe_select_id=1;
|
2011-09-24 19:56:42 +02:00
|
|
|
set debug='d,show_explain_probe_1';
|
|
|
|
select count(*) from t1 where a < 100000;
|
|
|
|
show explain for $thr2;
|
2011-08-24 12:41:13 +02:00
|
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
2011-09-24 19:56:42 +02:00
|
|
|
1 SIMPLE t1 index a a 5 NULL 1000 Using where; Using index
|
|
|
|
count(*)
|
|
|
|
1000
|
|
|
|
select max(c) from t1 where a < 10;
|
|
|
|
show explain for $thr2;
|
|
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
|
|
1 SIMPLE t1 range a a 5 NULL 10 Using where
|
|
|
|
max(c)
|
|
|
|
9
|
|
|
|
set optimizer_switch='index_condition_pushdown=on,mrr=on,mrr_sort_keys=on';
|
|
|
|
explain select max(c) from t1 where a < 10;
|
|
|
|
show explain for $thr2;
|
|
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
|
|
1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
|
|
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
|
|
1 SIMPLE t1 range a a 5 NULL 10 Using index condition; Rowid-ordered scan
|
2011-08-24 12:41:13 +02:00
|
|
|
drop table t0,t1;
|