1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

new EXPLAIN

fixed bug in mysql-test/create-test-result
fixed bug in union-subselect engine
This commit is contained in:
bell@sanja.is.com.ua
2002-09-26 23:08:22 +03:00
parent d9989c635e
commit 46a22a5be7
36 changed files with 607 additions and 457 deletions

View File

@ -65,8 +65,8 @@ a
869751
alter table t1 type=myisam;
explain select * from t1 where a in (869751,736494,226312,802616);
table type possible_keys key key_len ref rows Extra
t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
id select_type table type possible_keys key key_len ref rows Extra
1 FIRST t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
drop table t1;
create table t1 (x int not null, y int not null, key x (x), unique y (y))
type=heap;
@ -84,9 +84,9 @@ x y x y
2 5 2 2
2 6 2 2
explain select * from t1,t1 as t2 where t1.x=t2.y;
table type possible_keys key key_len ref rows Extra
t1 ALL x NULL NULL NULL 6
t2 eq_ref y y 4 t1.x 1
id select_type table type possible_keys key key_len ref rows Extra
1 FIRST t1 ALL x NULL NULL NULL 6
1 FIRST t2 eq_ref y y 4 t1.x 1
drop table t1;
create table t1 (a int) type=heap;
insert into t1 values(1);
@ -158,18 +158,18 @@ drop table t1;
create table t1 (btn char(10) not null, key(btn)) type=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%";
table type possible_keys key key_len ref rows Extra
t1 ALL btn NULL NULL NULL 14 where used
id select_type table type possible_keys key key_len ref rows Extra
1 FIRST t1 ALL btn NULL NULL NULL 14 where used
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn;
update t1 set new_col=btn;
explain select * from t1 where btn="a";
table type possible_keys key key_len ref rows Extra
t1 ALL btn NULL NULL NULL 14 where used
id select_type table type possible_keys key key_len ref rows Extra
1 FIRST t1 ALL btn NULL NULL NULL 14 where used
explain select * from t1 where btn="a" and new_col="a";
table type possible_keys key key_len ref rows Extra
t1 ref btn btn 11 const,const 10 where used
id select_type table type possible_keys key key_len ref rows Extra
1 FIRST t1 ref btn btn 11 const,const 10 where used
drop table t1;
CREATE TABLE t1 (
a int default NULL,
@ -181,16 +181,16 @@ INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
table type possible_keys key key_len ref rows Extra
t1 ref a a 5 const 10 where used
id select_type table type possible_keys key key_len ref rows Extra
1 FIRST t1 ref a a 5 const 10 where used
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
SELECT * FROM t1 WHERE b=NULL;
a b
explain SELECT * FROM t1 WHERE b IS NULL;
table type possible_keys key key_len ref rows Extra
t1 ref b b 5 const 1 where used
id select_type table type possible_keys key key_len ref rows Extra
1 FIRST t1 ref b b 5 const 1 where used
SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL