mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
fixing EXPLAIN select types
This commit is contained in:
@ -91,11 +91,11 @@ grp a c id a c d
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
explain select t1.*,t2.* from t1,t2 where t1.a=t2.a and isnull(t2.a)=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 FIRST Impossible WHERE noticed after reading const tables
|
||||
1 SIMPLE Impossible WHERE noticed after reading const tables
|
||||
explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 FIRST t1 ALL NULL NULL NULL NULL 7
|
||||
1 FIRST t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 where used
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7
|
||||
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 where used
|
||||
select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
|
||||
grp a c id a c d a
|
||||
1 1 a 1 1 a 1 1
|
||||
@ -312,12 +312,12 @@ name name id
|
||||
Lilliana Angelovska NULL NULL
|
||||
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 FIRST t1 ALL NULL NULL NULL NULL 3
|
||||
1 FIRST t2 ALL NULL NULL NULL NULL 3 where used; Not exists
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 where used; Not exists
|
||||
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.name is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 FIRST t1 ALL NULL NULL NULL NULL 3
|
||||
1 FIRST t2 ALL NULL NULL NULL NULL 3 where used
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 where used
|
||||
select count(*) from t1 left join t2 on (t1.id = t2.owner);
|
||||
count(*)
|
||||
4
|
||||
@ -332,12 +332,12 @@ name name id
|
||||
Lilliana Angelovska NULL NULL
|
||||
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 FIRST t1 ALL NULL NULL NULL NULL 3
|
||||
1 FIRST t2 ALL NULL NULL NULL NULL 3 where used; Not exists
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 where used; Not exists
|
||||
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.name is null;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 FIRST t1 ALL NULL NULL NULL NULL 3
|
||||
1 FIRST t2 ALL NULL NULL NULL NULL 3 where used
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 where used
|
||||
select count(*) from t2 right join t1 on (t1.id = t2.owner);
|
||||
count(*)
|
||||
4
|
||||
@ -619,8 +619,8 @@ UNIQUE id (id,idx)
|
||||
INSERT INTO t2 VALUES (1,1);
|
||||
explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 FIRST t1 ALL NULL NULL NULL NULL 2
|
||||
1 FIRST t2 index id id 8 NULL 1 where used; Using index; Not exists
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE t2 index id id 8 NULL 1 where used; Using index; Not exists
|
||||
SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
|
||||
id name id idx
|
||||
2 no NULL NULL
|
||||
@ -639,8 +639,8 @@ insert into t1 (fooID) values (10),(20),(30);
|
||||
insert into t2 values (10,1),(20,2),(30,3);
|
||||
explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 FIRST t2 index NULL PRIMARY 4 NULL 3 Using index
|
||||
1 FIRST t1 eq_ref PRIMARY PRIMARY 2 const 1 where used; Using index
|
||||
1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 2 const 1 where used; Using index
|
||||
select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
|
||||
fooID barID fooID
|
||||
10 1 NULL
|
||||
|
Reference in New Issue
Block a user