1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MWL#17: Table elimination

- More dbug printouts
- More testcases
This commit is contained in:
Sergey Petrunya
2009-08-17 18:02:29 +03:00
parent a14b5d2466
commit 441434e565
3 changed files with 49 additions and 6 deletions

View File

@ -202,3 +202,20 @@ t2.pk3=t2.pk1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
drop table t1, t2;
create table t1 (pk int primary key, col int);
insert into t1 values (1,1),(2,2);
create table t2 like t1;
insert into t2 select * from t1;
create table t3 like t1;
insert into t3 select * from t1;
explain
select t1.* from t1 left join ( t2 left join t3 on t3.pk=t2.col) on t2.col=t1.col;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
explain
select t1.*, t2.* from t1 left join (t2 left join t3 on t3.pk=t2.col) on t2.pk=t1.col;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.col 1
drop table t1, t2;