DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5,t6,t7,t8,t9;
Warnings:
Note 1051 Unknown table 't0'
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
Note 1051 Unknown table 't3'
Note 1051 Unknown table 't4'
Note 1051 Unknown table 't5'
Note 1051 Unknown table 't6'
Note 1051 Unknown table 't7'
Note 1051 Unknown table 't8'
Note 1051 Unknown table 't9'
CREATE TABLE t0 (a int, b int, c int);
CREATE TABLE t1 (a int, b int, c int);
CREATE TABLE t2 (a int, b int, c int);
...
...
@@ -75,7 +64,7 @@ a b a b a b
4 2 1 2 3 2
4 2 1 2 4 2
5 3 NULL NULL NULL NULL
EXPLAIN
EXPLAIN EXTENDED
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
FROM t2
LEFT JOIN
...
...
@@ -86,6 +75,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 2
Warnings:
Note 1003 select test.t2.a AS `a`,test.t2.b AS `b`,test.t3.a AS `a`,test.t3.b AS `b`,test.t4.a AS `a`,test.t4.b AS `b` from test.t2 left join (test.t3 join test.t4) on((test.t2.b = test.t4.b)) where ((test.t3.a = 1) or isnull(test.t3.c))
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
FROM t2
LEFT JOIN
...
...
@@ -149,7 +140,7 @@ a b a b a b a b
4 2 2 2 4 2 2 2
4 2 2 2 4 2 3 3
5 3 NULL NULL NULL NULL NULL NULL
EXPLAIN
EXPLAIN EXTENDED
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
FROM t2
LEFT JOIN
...
...
@@ -161,6 +152,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 2
1 SIMPLE t5 ALL NULL NULL NULL NULL 3
Warnings:
Note 1003 select test.t2.a AS `a`,test.t2.b AS `b`,test.t3.a AS `a`,test.t3.b AS `b`,test.t4.a AS `a`,test.t4.b AS `b`,test.t5.a AS `a`,test.t5.b AS `b` from test.t2 left join (test.t3 join test.t4 join test.t5) on((test.t2.b = test.t4.b)) where ((test.t3.a > 1) or isnull(test.t3.c))
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
FROM t2
LEFT JOIN
...
...
@@ -176,7 +169,7 @@ a b a b a b a b
4 2 2 2 4 2 2 2
4 2 2 2 4 2 3 3
5 3 NULL NULL NULL NULL NULL NULL
EXPLAIN
EXPLAIN EXTENDED
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
FROM t2
LEFT JOIN
...
...
@@ -189,6 +182,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t4 ALL NULL NULL NULL NULL 2
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 Using where
Warnings:
Note 1003 select test.t2.a AS `a`,test.t2.b AS `b`,test.t3.a AS `a`,test.t3.b AS `b`,test.t4.a AS `a`,test.t4.b AS `b`,test.t5.a AS `a`,test.t5.b AS `b` from test.t2 left join (test.t3 join test.t4 join test.t5) on((test.t2.b = test.t4.b)) where (((test.t3.a > 1) or isnull(test.t3.c)) and ((test.t5.a < 3) or isnull(test.t5.c)))
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,t5.a,t5.b
FROM t2
LEFT JOIN
...
...
@@ -226,7 +221,7 @@ FROM t8;
a b
0 2
1 2
EXPLAIN
EXPLAIN EXTENDED
SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
FROM t6,
t7
...
...
@@ -237,6 +232,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 ALL NULL NULL NULL NULL 2
1 SIMPLE t6 ALL NULL NULL NULL NULL 3
1 SIMPLE t8 ALL NULL NULL NULL NULL 2
Warnings:
Note 1003 select test.t6.a AS `a`,test.t6.b AS `b`,test.t7.a AS `a`,test.t7.b AS `b`,test.t8.a AS `a`,test.t8.b AS `b` from test.t6 join test.t7 left join test.t8 on(((test.t7.b = test.t8.b) and (test.t6.b < 10))) where 1
@@ -564,6 +561,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 ALL NULL NULL NULL NULL 2
1 SIMPLE t6 ALL NULL NULL NULL NULL 3
1 SIMPLE t8 ALL NULL NULL NULL NULL 2
Warnings:
Note 1003 select test.t0.a AS `a`,test.t0.b AS `b`,test.t1.a AS `a`,test.t1.b AS `b`,test.t2.a AS `a`,test.t2.b AS `b`,test.t3.a AS `a`,test.t3.b AS `b`,test.t4.a AS `a`,test.t4.b AS `b`,test.t5.a AS `a`,test.t5.b AS `b`,test.t6.a AS `a`,test.t6.b AS `b`,test.t7.a AS `a`,test.t7.b AS `b`,test.t8.a AS `a`,test.t8.b AS `b` from test.t0 join test.t1 left join (test.t2 left join (test.t3 join test.t4) on(((test.t3.a = 1) and (test.t2.b = test.t4.b))) join test.t5 left join (test.t6 join test.t7 left join test.t8 on(((test.t7.b = test.t8.b) and (test.t6.b < 10)))) on(((test.t6.b >= 2) and (test.t5.b = test.t7.b)))) on((((test.t3.b = 2) or isnull(test.t3.c)) and ((test.t6.b = 2) or isnull(test.t6.c)) and ((test.t1.b = test.t5.b) or isnull(test.t3.c) or isnull(test.t6.c) or isnull(test.t8.c)) and (test.t1.a <> 2))) where ((test.t0.a = 1) and (test.t0.b = test.t1.b) and ((test.t2.a >= 4) or isnull(test.t2.c)))
@@ -660,6 +659,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 Using where
Warnings:
Note 1003 select test.t0.a AS `a`,test.t0.b AS `b`,test.t1.a AS `a`,test.t1.b AS `b`,test.t2.a AS `a`,test.t2.b AS `b`,test.t3.a AS `a`,test.t3.b AS `b`,test.t4.a AS `a`,test.t4.b AS `b`,test.t5.a AS `a`,test.t5.b AS `b`,test.t6.a AS `a`,test.t6.b AS `b`,test.t7.a AS `a`,test.t7.b AS `b`,test.t8.a AS `a`,test.t8.b AS `b`,test.t9.a AS `a`,test.t9.b AS `b` from test.t0 join test.t1 left join (test.t2 left join (test.t3 join test.t4) on(((test.t3.a = 1) and (test.t2.b = test.t4.b))) join test.t5 left join (test.t6 join test.t7 left join test.t8 on(((test.t7.b = test.t8.b) and (test.t6.b < 10)))) on(((test.t6.b >= 2) and (test.t5.b = test.t7.b)))) on((((test.t3.b = 2) or isnull(test.t3.c)) and ((test.t6.b = 2) or isnull(test.t6.c)) and ((test.t1.b = test.t5.b) or isnull(test.t3.c) or isnull(test.t6.c) or isnull(test.t8.c)) and (test.t1.a <> 2))) join test.t9 where ((test.t0.a = 1) and (test.t0.b = test.t1.b) and ((test.t2.a >= 4) or isnull(test.t2.c)) and ((test.t3.a < 5) or isnull(test.t3.c)) and ((test.t3.b = test.t4.b) or isnull(test.t3.c) or isnull(test.t4.c)) and ((test.t5.a >= 2) or isnull(test.t5.c)) and ((test.t6.a >= 4) or isnull(test.t6.c)) and ((test.t7.a <= 2) or isnull(test.t7.c)) and ((test.t8.a < 1) or isnull(test.t8.c)) and ((test.t8.b = test.t9.b) or isnull(test.t8.c)) and (test.t9.a = 1))
SELECT t9.a,t9.b
FROM t9;
a b
...
...
@@ -844,8 +845,22 @@ a b a b a b a b
1 3 5 3 2 2 NULL NULL
2 2 5 3 1 2 NULL NULL
2 2 5 3 2 2 NULL NULL
EXPLAIN EXTENDED
SELECT t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
FROM t1, t3, t4
RIGHT JOIN
t2
ON t3.a=1 AND t2.b=t4.b
WHERE t1.a <= 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
1 SIMPLE t4 ALL NULL NULL NULL NULL 2
Warnings:
Note 1003 select test.t1.a AS `a`,test.t1.b AS `b`,test.t2.a AS `a`,test.t2.b AS `b`,test.t3.a AS `a`,test.t3.b AS `b`,test.t4.a AS `a`,test.t4.b AS `b` from test.t1 join test.t3 join test.t2 left join test.t4 on(((test.t3.a = 1) and (test.t2.b = test.t4.b))) where (test.t1.a <= 2)
CREATE INDEX idx_b ON t2(b);
EXPLAIN
EXPLAIN EXTENDED
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
FROM t3,t4
LEFT JOIN
...
...
@@ -856,6 +871,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
Warnings:
Note 1003 select test.t2.a AS `a`,test.t2.b AS `b`,test.t3.a AS `a`,test.t3.b AS `b`,test.t4.a AS `a`,test.t4.b AS `b` from test.t3 join test.t4 left join (test.t1 join test.t2) on(((test.t3.a = 1) and (test.t3.b = test.t2.b) and (test.t2.b = test.t4.b))) where 1
@@ -917,9 +934,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 Using where
Warnings:
Note 1003 select test.t0.a AS `a`,test.t0.b AS `b`,test.t1.a AS `a`,test.t1.b AS `b`,test.t2.a AS `a`,test.t2.b AS `b`,test.t3.a AS `a`,test.t3.b AS `b`,test.t4.a AS `a`,test.t4.b AS `b`,test.t5.a AS `a`,test.t5.b AS `b`,test.t6.a AS `a`,test.t6.b AS `b`,test.t7.a AS `a`,test.t7.b AS `b`,test.t8.a AS `a`,test.t8.b AS `b`,test.t9.a AS `a`,test.t9.b AS `b` from test.t0 join test.t1 left join (test.t2 left join (test.t3 join test.t4) on(((test.t3.a = 1) and (test.t2.b = test.t4.b))) join test.t5 left join (test.t6 join test.t7 left join test.t8 on(((test.t7.b = test.t8.b) and (test.t6.b < 10)))) on(((test.t6.b >= 2) and (test.t5.b = test.t7.b)))) on((((test.t3.b = 2) or isnull(test.t3.c)) and ((test.t6.b = 2) or isnull(test.t6.c)) and ((test.t1.b = test.t5.b) or isnull(test.t3.c) or isnull(test.t6.c) or isnull(test.t8.c)) and (test.t1.a <> 2))) join test.t9 where ((test.t0.a = 1) and (test.t0.b = test.t1.b) and ((test.t2.a >= 4) or isnull(test.t2.c)) and ((test.t3.a < 5) or isnull(test.t3.c)) and ((test.t3.b = test.t4.b) or isnull(test.t3.c) or isnull(test.t4.c)) and ((test.t5.a >= 2) or isnull(test.t5.c)) and ((test.t6.a >= 4) or isnull(test.t6.c)) and ((test.t7.a <= 2) or isnull(test.t7.c)) and ((test.t8.a < 1) or isnull(test.t8.c)) and ((test.t8.b = test.t9.b) or isnull(test.t8.c)) and (test.t9.a = 1))
@@ -966,8 +985,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 Using where
Warnings:
Note 1003 select test.t0.a AS `a`,test.t0.b AS `b`,test.t1.a AS `a`,test.t1.b AS `b`,test.t2.a AS `a`,test.t2.b AS `b`,test.t3.a AS `a`,test.t3.b AS `b`,test.t4.a AS `a`,test.t4.b AS `b`,test.t5.a AS `a`,test.t5.b AS `b`,test.t6.a AS `a`,test.t6.b AS `b`,test.t7.a AS `a`,test.t7.b AS `b`,test.t8.a AS `a`,test.t8.b AS `b`,test.t9.a AS `a`,test.t9.b AS `b` from test.t0 join test.t1 left join (test.t2 left join (test.t3 join test.t4) on(((test.t3.a = 1) and (test.t2.b = test.t4.b))) join test.t5 left join (test.t6 join test.t7 left join test.t8 on(((test.t7.b = test.t8.b) and (test.t6.b < 10)))) on(((test.t6.b >= 2) and (test.t5.b = test.t7.b)))) on((((test.t3.b = 2) or isnull(test.t3.c)) and ((test.t6.b = 2) or isnull(test.t6.c)) and ((test.t1.b = test.t5.b) or isnull(test.t3.c) or isnull(test.t6.c) or isnull(test.t8.c)) and (test.t1.a <> 2))) join test.t9 where ((test.t0.a = 1) and (test.t0.b = test.t1.b) and ((test.t2.a >= 4) or isnull(test.t2.c)) and ((test.t3.a < 5) or isnull(test.t3.c)) and ((test.t3.b = test.t4.b) or isnull(test.t3.c) or isnull(test.t4.c)) and ((test.t5.a >= 2) or isnull(test.t5.c)) and ((test.t6.a >= 4) or isnull(test.t6.c)) and ((test.t7.a <= 2) or isnull(test.t7.c)) and ((test.t8.a < 1) or isnull(test.t8.c)) and ((test.t8.b = test.t9.b) or isnull(test.t8.c)) and (test.t9.a = 1))
@@ -1014,9 +1035,11 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t8 ref idx_b idx_b 5 test.t7.b 2 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 Using where
Warnings:
Note 1003 select test.t0.a AS `a`,test.t0.b AS `b`,test.t1.a AS `a`,test.t1.b AS `b`,test.t2.a AS `a`,test.t2.b AS `b`,test.t3.a AS `a`,test.t3.b AS `b`,test.t4.a AS `a`,test.t4.b AS `b`,test.t5.a AS `a`,test.t5.b AS `b`,test.t6.a AS `a`,test.t6.b AS `b`,test.t7.a AS `a`,test.t7.b AS `b`,test.t8.a AS `a`,test.t8.b AS `b`,test.t9.a AS `a`,test.t9.b AS `b` from test.t0 join test.t1 left join (test.t2 left join (test.t3 join test.t4) on(((test.t3.a = 1) and (test.t2.b = test.t4.b))) join test.t5 left join (test.t6 join test.t7 left join test.t8 on(((test.t7.b = test.t8.b) and (test.t6.b < 10)))) on(((test.t6.b >= 2) and (test.t5.b = test.t7.b)))) on((((test.t3.b = 2) or isnull(test.t3.c)) and ((test.t6.b = 2) or isnull(test.t6.c)) and ((test.t1.b = test.t5.b) or isnull(test.t3.c) or isnull(test.t6.c) or isnull(test.t8.c)) and (test.t1.a <> 2))) join test.t9 where ((test.t0.a = 1) and (test.t0.b = test.t1.b) and ((test.t2.a >= 4) or isnull(test.t2.c)) and ((test.t3.a < 5) or isnull(test.t3.c)) and ((test.t3.b = test.t4.b) or isnull(test.t3.c) or isnull(test.t4.c)) and ((test.t5.a >= 2) or isnull(test.t5.c)) and ((test.t6.a >= 4) or isnull(test.t6.c)) and ((test.t7.a <= 2) or isnull(test.t7.c)) and ((test.t8.a < 1) or isnull(test.t8.c)) and ((test.t8.b = test.t9.b) or isnull(test.t8.c)) and (test.t9.a = 1))
@@ -1063,6 +1086,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t8 ref idx_b idx_b 5 test.t7.b 2 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 Using where
Warnings:
Note 1003 select test.t0.a AS `a`,test.t0.b AS `b`,test.t1.a AS `a`,test.t1.b AS `b`,test.t2.a AS `a`,test.t2.b AS `b`,test.t3.a AS `a`,test.t3.b AS `b`,test.t4.a AS `a`,test.t4.b AS `b`,test.t5.a AS `a`,test.t5.b AS `b`,test.t6.a AS `a`,test.t6.b AS `b`,test.t7.a AS `a`,test.t7.b AS `b`,test.t8.a AS `a`,test.t8.b AS `b`,test.t9.a AS `a`,test.t9.b AS `b` from test.t0 join test.t1 left join (test.t2 left join (test.t3 join test.t4) on(((test.t3.a = 1) and (test.t2.b = test.t4.b))) join test.t5 left join (test.t6 join test.t7 left join test.t8 on(((test.t7.b = test.t8.b) and (test.t6.b < 10)))) on(((test.t6.b >= 2) and (test.t5.b = test.t7.b)))) on((((test.t3.b = 2) or isnull(test.t3.c)) and ((test.t6.b = 2) or isnull(test.t6.c)) and ((test.t1.b = test.t5.b) or isnull(test.t3.c) or isnull(test.t6.c) or isnull(test.t8.c)) and (test.t1.a <> 2))) join test.t9 where ((test.t0.a = 1) and (test.t0.b = test.t1.b) and ((test.t2.a >= 4) or isnull(test.t2.c)) and ((test.t3.a < 5) or isnull(test.t3.c)) and ((test.t3.b = test.t4.b) or isnull(test.t3.c) or isnull(test.t4.c)) and ((test.t5.a >= 2) or isnull(test.t5.c)) and ((test.t6.a >= 4) or isnull(test.t6.c)) and ((test.t7.a <= 2) or isnull(test.t7.c)) and ((test.t8.a < 1) or isnull(test.t8.c)) and ((test.t8.b = test.t9.b) or isnull(test.t8.c)) and (test.t9.a = 1))