851
851
id select_type table type possible_keys key key_len ref rows filtered Extra
852
852
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00
853
853
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer
854
1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00
854
1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 1 100.00
855
855
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
857
857
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
958
958
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
959
959
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
960
960
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
961
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
961
962
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
962
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where
963
963
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
964
964
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
965
965
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
966
966
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
967
967
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
969
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"."t4"."b" = "test"."t2"."b") and ("test"."t3"."a" = 1))) join "test"."t5" left join ("test"."t6" join "test"."t7" left join "test"."t8" on((("test"."t8"."b" = "test"."t5"."b") and ("test"."t6"."b" < 10)))) on((("test"."t7"."b" = "test"."t5"."b") and ("test"."t6"."b" >= 2)))) on(((("test"."t3"."b" = 2) or isnull("test"."t3"."c")) and (("test"."t6"."b" = 2) or isnull("test"."t6"."c")) and (("test"."t5"."b" = "test"."t0"."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"."t9"."a" = 1) and ("test"."t1"."b" = "test"."t0"."b") and ("test"."t0"."a" = 1) and (("test"."t2"."a" >= 4) or isnull("test"."t2"."c")) and (("test"."t3"."a" < 5) or isnull("test"."t3"."c")) and (("test"."t4"."b" = "test"."t3"."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"."t9"."b" = "test"."t8"."b") or isnull("test"."t8"."c")))
969
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"."t4"."b" = "test"."t2"."b") and ("test"."t3"."a" = 1))) join "test"."t5" left join ("test"."t6" join "test"."t7" left join "test"."t8" on((("test"."t8"."b" = "test"."t5"."b") and ("test"."t6"."b" < 10)))) on((("test"."t7"."b" = "test"."t5"."b") and ("test"."t6"."b" >= 2)))) on(((("test"."t3"."b" = 2) or isnull("test"."t3"."c")) and (("test"."t6"."b" = 2) or isnull("test"."t6"."c")) and (("test"."t5"."b" = "test"."t0"."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"."t9"."a" = 1) and ("test"."t1"."b" = "test"."t0"."b") and ("test"."t0"."a" = 1) 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"."t9"."b" = "test"."t8"."b") or isnull("test"."t8"."c")))
970
970
CREATE INDEX idx_b ON t8(b);
972
972
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
1007
1007
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
1008
1008
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1009
1009
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
1010
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
1010
1011
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1011
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where
1012
1012
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
1013
1013
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
1014
1014
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1015
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where
1015
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where
1016
1016
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1018
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"."t4"."b" = "test"."t2"."b") and ("test"."t3"."a" = 1))) join "test"."t5" left join ("test"."t6" join "test"."t7" left join "test"."t8" on((("test"."t8"."b" = "test"."t5"."b") and ("test"."t6"."b" < 10)))) on((("test"."t7"."b" = "test"."t5"."b") and ("test"."t6"."b" >= 2)))) on(((("test"."t3"."b" = 2) or isnull("test"."t3"."c")) and (("test"."t6"."b" = 2) or isnull("test"."t6"."c")) and (("test"."t5"."b" = "test"."t0"."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"."t9"."a" = 1) and ("test"."t1"."b" = "test"."t0"."b") and ("test"."t0"."a" = 1) and (("test"."t2"."a" >= 4) or isnull("test"."t2"."c")) and (("test"."t3"."a" < 5) or isnull("test"."t3"."c")) and (("test"."t4"."b" = "test"."t3"."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"."t9"."b" = "test"."t8"."b") or isnull("test"."t8"."c")))
1018
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"."t4"."b" = "test"."t2"."b") and ("test"."t3"."a" = 1))) join "test"."t5" left join ("test"."t6" join "test"."t7" left join "test"."t8" on((("test"."t8"."b" = "test"."t5"."b") and ("test"."t6"."b" < 10)))) on((("test"."t7"."b" = "test"."t5"."b") and ("test"."t6"."b" >= 2)))) on(((("test"."t3"."b" = 2) or isnull("test"."t3"."c")) and (("test"."t6"."b" = 2) or isnull("test"."t6"."c")) and (("test"."t5"."b" = "test"."t0"."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"."t9"."a" = 1) and ("test"."t1"."b" = "test"."t0"."b") and ("test"."t0"."a" = 1) 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"."t9"."b" = "test"."t8"."b") or isnull("test"."t8"."c")))
1019
1019
CREATE INDEX idx_b ON t1(b);
1020
1020
CREATE INDEX idx_a ON t0(a);
1021
1021
EXPLAIN EXTENDED
1056
1056
id select_type table type possible_keys key key_len ref rows filtered Extra
1057
1057
1 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00
1058
1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 2 100.00
1058
1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1 100.00
1059
1059
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
1060
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00
1060
1061
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1061
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where
1062
1062
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
1063
1063
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
1064
1064
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1065
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where
1065
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where
1066
1066
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1068
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"."t4"."b" = "test"."t2"."b") and ("test"."t3"."a" = 1))) join "test"."t5" left join ("test"."t6" join "test"."t7" left join "test"."t8" on((("test"."t8"."b" = "test"."t5"."b") and ("test"."t6"."b" < 10)))) on((("test"."t7"."b" = "test"."t5"."b") and ("test"."t6"."b" >= 2)))) on(((("test"."t3"."b" = 2) or isnull("test"."t3"."c")) and (("test"."t6"."b" = 2) or isnull("test"."t6"."c")) and (("test"."t5"."b" = "test"."t0"."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"."t9"."a" = 1) and ("test"."t1"."b" = "test"."t0"."b") and ("test"."t0"."a" = 1) and (("test"."t2"."a" >= 4) or isnull("test"."t2"."c")) and (("test"."t3"."a" < 5) or isnull("test"."t3"."c")) and (("test"."t4"."b" = "test"."t3"."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"."t9"."b" = "test"."t8"."b") or isnull("test"."t8"."c")))
1068
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"."t4"."b" = "test"."t2"."b") and ("test"."t3"."a" = 1))) join "test"."t5" left join ("test"."t6" join "test"."t7" left join "test"."t8" on((("test"."t8"."b" = "test"."t5"."b") and ("test"."t6"."b" < 10)))) on((("test"."t7"."b" = "test"."t5"."b") and ("test"."t6"."b" >= 2)))) on(((("test"."t3"."b" = 2) or isnull("test"."t3"."c")) and (("test"."t6"."b" = 2) or isnull("test"."t6"."c")) and (("test"."t5"."b" = "test"."t0"."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"."t9"."a" = 1) and ("test"."t1"."b" = "test"."t0"."b") and ("test"."t0"."a" = 1) 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"."t9"."b" = "test"."t8"."b") or isnull("test"."t8"."c")))
1069
1069
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
1070
1070
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
1197
1197
id select_type table type possible_keys key key_len ref rows Extra
1198
1198
1 SIMPLE t1 index NULL a 5 NULL 21 Using index
1199
1199
1 SIMPLE t3 index c c 5 NULL 6 Using index
1200
1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index
1200
1 SIMPLE t2 ref b b 5 test.t3.c 1 Using index
1201
1201
EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
1202
1202
id select_type table type possible_keys key key_len ref rows Extra
1203
1203
1 SIMPLE t1 index NULL a 5 NULL 21 Using index
1204
1204
1 SIMPLE t3 index c c 5 NULL 6 Using index
1205
1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index
1205
1 SIMPLE t2 ref b b 5 test.t3.c 1 Using index
1206
1206
SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
1272
1272
EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
1273
1273
id select_type table type possible_keys key key_len ref rows Extra
1274
1274
1 SIMPLE t1 index NULL a 5 NULL 21 Using index
1275
1 SIMPLE t3 index c c 5 NULL 0 Using index
1276
1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index
1275
1 SIMPLE t3 index c c 5 NULL 1 Using index
1276
1 SIMPLE t2 ref b b 5 test.t3.c 1 Using index
1277
1277
SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
1309
1309
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21;
1310
1310
id select_type table type possible_keys key key_len ref rows Extra
1311
1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found
1312
1311
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1312
1 SIMPLE t2 ALL NULL NULL NULL NULL 1
1313
1313
SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
1317
1317
EXPLAIN SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21;
1318
1318
id select_type table type possible_keys key key_len ref rows Extra
1319
1319
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1320
1 SIMPLE t2 ALL NULL NULL NULL NULL 0
1321
1 SIMPLE t3 ALL NULL NULL NULL NULL 0
1320
1 SIMPLE t2 ALL NULL NULL NULL NULL 1
1321
1 SIMPLE t3 ALL NULL NULL NULL NULL 1
1322
1322
DROP TABLE t1,t2,t3;
1323
1323
create table t1 (a int);
1324
1324
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
1501
1501
(t5 JOIN t4 ON t5.carrier_id = t4.id)
1502
1502
ON t4.carrier = t1.carrier;
1503
1503
id select_type table type possible_keys key key_len ref rows Extra
1504
1 SIMPLE t2 index package_id package_id 5 NULL 45 Using index
1505
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.package_id 1
1504
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 36
1506
1505
1 SIMPLE t4 eq_ref PRIMARY,id PRIMARY 2 test.t1.carrier 1
1507
1 SIMPLE t5 ref carrier_id carrier_id 5 test.t4.id 22 Using index
1508
1 SIMPLE t3 ref package_id package_id 5 test.t1.id 1 Using where; Using index
1506
1 SIMPLE t5 ref carrier_id carrier_id 5 test.t4.id 1 Using index
1507
1 SIMPLE t2 ref package_id package_id 5 test.t1.id 1 Using index
1508
1 SIMPLE t3 ref package_id package_id 5 test.t1.id 1 Using index
1509
1509
SELECT COUNT(*)
1510
1510
FROM ((t2 JOIN t1 ON t2.package_id = t1.id)
1511
1511
JOIN t3 ON t3.package_id = t1.id)