diff --git a/mysql-test/include/subquery_sj.inc b/mysql-test/include/subquery_sj.inc index d713546345fa..0bc88c5908e4 100644 --- a/mysql-test/include/subquery_sj.inc +++ b/mysql-test/include/subquery_sj.inc @@ -98,13 +98,13 @@ explain select * from t1 where a in (select t10.pk from t10, t12 where t12.pk=t1 --echo subqueries within outer joins go into ON expr. # TODO: psergey: check if case conversions like those are ok (it broke on windows) ---replace_result a A b B +--replace_regex /\ba\b/A/ /\bb\b/B/ explain select * from t1 left join (t2 a, t2 b) on ( a.a= t1.a and b.a in (select pk from t10)); # TODO: psergey: check if case conversions like those are ok (it broke on windows) --echo t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" ---replace_result a A b B +--replace_regex /\ba\b/A/ /\bb\b/B/ explain select * from t1 left join t2 on (t2.a= t1.a and t2.a in (select pk from t10)); diff --git a/mysql-test/r/subquery_sj_all.result b/mysql-test/r/subquery_sj_all.result index 32649d058875..8afd3aaa52e3 100644 --- a/mysql-test/r/subquery_sj_all.result +++ b/mysql-test/r/subquery_sj_all.result @@ -182,24 +182,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_all_bka.result b/mysql-test/r/subquery_sj_all_bka.result index ebfbe33cd890..24e01c74f546 100644 --- a/mysql-test/r/subquery_sj_all_bka.result +++ b/mysql-test/r/subquery_sj_all_bka.result @@ -183,24 +183,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_all_bka_nobnl.result b/mysql-test/r/subquery_sj_all_bka_nobnl.result index 1c27411147b9..c510a1bb1bc9 100644 --- a/mysql-test/r/subquery_sj_all_bka_nobnl.result +++ b/mysql-test/r/subquery_sj_all_bka_nobnl.result @@ -183,24 +183,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_dupsweed.result b/mysql-test/r/subquery_sj_dupsweed.result index eaf72131143b..6f8ea8160e3c 100644 --- a/mysql-test/r/subquery_sj_dupsweed.result +++ b/mysql-test/r/subquery_sj_dupsweed.result @@ -180,24 +180,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_dupsweed_bka.result b/mysql-test/r/subquery_sj_dupsweed_bka.result index cc7aef63fb9d..3e9419df4c91 100644 --- a/mysql-test/r/subquery_sj_dupsweed_bka.result +++ b/mysql-test/r/subquery_sj_dupsweed_bka.result @@ -181,24 +181,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_dupsweed_bka_nobnl.result b/mysql-test/r/subquery_sj_dupsweed_bka_nobnl.result index dab410f6108f..f1ac004b81b6 100644 --- a/mysql-test/r/subquery_sj_dupsweed_bka_nobnl.result +++ b/mysql-test/r/subquery_sj_dupsweed_bka_nobnl.result @@ -181,24 +181,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_firstmatch.result b/mysql-test/r/subquery_sj_firstmatch.result index 7a8cb93b44c0..557bb015cbe9 100644 --- a/mysql-test/r/subquery_sj_firstmatch.result +++ b/mysql-test/r/subquery_sj_firstmatch.result @@ -181,24 +181,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_firstmatch_bka.result b/mysql-test/r/subquery_sj_firstmatch_bka.result index 1a149883f6eb..fd1458a5a872 100644 --- a/mysql-test/r/subquery_sj_firstmatch_bka.result +++ b/mysql-test/r/subquery_sj_firstmatch_bka.result @@ -182,24 +182,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_firstmatch_bka_nobnl.result b/mysql-test/r/subquery_sj_firstmatch_bka_nobnl.result index 69744c1b9716..0a1f28beee17 100644 --- a/mysql-test/r/subquery_sj_firstmatch_bka_nobnl.result +++ b/mysql-test/r/subquery_sj_firstmatch_bka_nobnl.result @@ -182,24 +182,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_loosescan.result b/mysql-test/r/subquery_sj_loosescan.result index 2221445daaa0..b05e12ab988b 100644 --- a/mysql-test/r/subquery_sj_loosescan.result +++ b/mysql-test/r/subquery_sj_loosescan.result @@ -181,24 +181,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_loosescan_bka.result b/mysql-test/r/subquery_sj_loosescan_bka.result index aba99afdf92b..de6afd9b4b7b 100644 --- a/mysql-test/r/subquery_sj_loosescan_bka.result +++ b/mysql-test/r/subquery_sj_loosescan_bka.result @@ -182,24 +182,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_loosescan_bka_nobnl.result b/mysql-test/r/subquery_sj_loosescan_bka_nobnl.result index ac8bd0070125..b03c63528b67 100644 --- a/mysql-test/r/subquery_sj_loosescan_bka_nobnl.result +++ b/mysql-test/r/subquery_sj_loosescan_bka_nobnl.result @@ -182,24 +182,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_mat.result b/mysql-test/r/subquery_sj_mat.result index 8312f9c05d52..9447ea5ebad8 100644 --- a/mysql-test/r/subquery_sj_mat.result +++ b/mysql-test/r/subquery_sj_mat.result @@ -186,24 +186,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_mat_bka.result b/mysql-test/r/subquery_sj_mat_bka.result index f2669717b518..ddd7e9b30ea6 100644 --- a/mysql-test/r/subquery_sj_mat_bka.result +++ b/mysql-test/r/subquery_sj_mat_bka.result @@ -187,24 +187,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_mat_bka_nobnl.result b/mysql-test/r/subquery_sj_mat_bka_nobnl.result index d5b1530b8396..593d7b70c460 100644 --- a/mysql-test/r/subquery_sj_mat_bka_nobnl.result +++ b/mysql-test/r/subquery_sj_mat_bka_nobnl.result @@ -187,24 +187,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`)) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.B.A 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`t10`.`pk` = `test`.`B`.`A`) and (`test`.`A`.`A` = `test`.`t1`.`A`))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 SIMPLE t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.A 1 100.00 Using index 1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join (`test`.`t10` join `test`.`t2`) on(((`test`.`t10`.`pk` = `test`.`t1`.`A`) and (`test`.`t2`.`A` = `test`.`t1`.`A`))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_mat_nosj.result b/mysql-test/r/subquery_sj_mat_nosj.result index 3b0fca4d50a0..074cca9a55be 100644 --- a/mysql-test/r/subquery_sj_mat_nosj.result +++ b/mysql-test/r/subquery_sj_mat_nosj.result @@ -182,24 +182,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a`,`test`.`t1`.`a` in ( (/* select#2 */ select `test`.`t10`.`pk` from `test`.`t10` join `test`.`t12` where (`test`.`t12`.`pk` = `test`.`t10`.`a`) ), (`test`.`t1`.`a` in on where ((`test`.`t1`.`a` = `materialized-subquery`.`pk`))))) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL -1 PRIMARY A NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (Block Nested Loop) -1 PRIMARY B NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (Block Nested Loop) +1 PRIMARY A NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop) +1 PRIMARY B NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop) 2 SUBQUERY t10 NULL index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) And (`test`.`B`.`A`,`test`.`B`.`A` in ( (/* select#2 */ select `test`.`t10`.`pk` from `test`.`t10` where true ), (`test`.`B`.`A` in on where ((`test`.`B`.`A` = `mAteriAlized-suBquery`.`pk`))))))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) and (`test`.`B`.`A`,`test`.`B`.`A` in ( (/* select#2 */ select `test`.`t10`.`pk` from `test`.`t10` where true ), (`test`.`B`.`A` in on where ((`test`.`B`.`A` = `materialized-subquery`.`pk`))))))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL -1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (Block Nested Loop) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop) 2 SUBQUERY t10 NULL index PRIMARY PRIMARY 4 NULL 10 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And (`test`.`t1`.`A`,`test`.`t1`.`A` in ( (/* select#2 */ select `test`.`t10`.`pk` from `test`.`t10` where true ), (`test`.`t1`.`A` in on where ((`test`.`t1`.`A` = `mAteriAlized-suBquery`.`pk`))))))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) and (`test`.`t1`.`A`,`test`.`t1`.`A` in ( (/* select#2 */ select `test`.`t10`.`pk` from `test`.`t10` where true ), (`test`.`t1`.`A` in on where ((`test`.`t1`.`A` = `materialized-subquery`.`pk`))))))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_none.result b/mysql-test/r/subquery_sj_none.result index c942cbe53122..7b9cb85b2ad2 100644 --- a/mysql-test/r/subquery_sj_none.result +++ b/mysql-test/r/subquery_sj_none.result @@ -181,24 +181,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a`,(/* select#2 */ select 1 from `test`.`t10` join `test`.`t12` where ((`test`.`t12`.`pk` = `test`.`t10`.`a`) and ((`test`.`t1`.`a`) = `test`.`t10`.`pk`)))) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL -1 PRIMARY A NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (Block Nested Loop) -1 PRIMARY B NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (Block Nested Loop) -2 DEPENDENT SUBQUERY t10 NULL unique_suBquery PRIMARY PRIMARY 4 func 1 100.00 Using index +1 PRIMARY A NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop) +1 PRIMARY B NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop) +2 DEPENDENT SUBQUERY t10 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) And (`test`.`B`.`A`,(((`test`.`B`.`A`) in t10 on PRIMARY))))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) and (`test`.`B`.`A`,(((`test`.`B`.`A`) in t10 on PRIMARY))))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL -1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (Block Nested Loop) -2 DEPENDENT SUBQUERY t10 NULL unique_suBquery PRIMARY PRIMARY 4 func 1 100.00 Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop) +2 DEPENDENT SUBQUERY t10 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And (`test`.`t1`.`A`,(((`test`.`t2`.`A`) in t10 on PRIMARY))))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) and (`test`.`t1`.`A`,(((`test`.`t2`.`A`) in t10 on PRIMARY))))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_none_bka.result b/mysql-test/r/subquery_sj_none_bka.result index 24b5b436f1f3..511fc3bc3e8b 100644 --- a/mysql-test/r/subquery_sj_none_bka.result +++ b/mysql-test/r/subquery_sj_none_bka.result @@ -182,24 +182,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a`,(/* select#2 */ select 1 from `test`.`t10` join `test`.`t12` where ((`test`.`t12`.`pk` = `test`.`t10`.`a`) and ((`test`.`t1`.`a`) = `test`.`t10`.`pk`)))) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL -1 PRIMARY A NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (Block Nested Loop) -1 PRIMARY B NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (Block Nested Loop) -2 DEPENDENT SUBQUERY t10 NULL unique_suBquery PRIMARY PRIMARY 4 func 1 100.00 Using index +1 PRIMARY A NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop) +1 PRIMARY B NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop) +2 DEPENDENT SUBQUERY t10 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) And (`test`.`B`.`A`,(((`test`.`B`.`A`) in t10 on PRIMARY))))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) and (`test`.`B`.`A`,(((`test`.`B`.`A`) in t10 on PRIMARY))))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL -1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (Block Nested Loop) -2 DEPENDENT SUBQUERY t10 NULL unique_suBquery PRIMARY PRIMARY 4 func 1 100.00 Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (Block Nested Loop) +2 DEPENDENT SUBQUERY t10 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And (`test`.`t1`.`A`,(((`test`.`t2`.`A`) in t10 on PRIMARY))))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) and (`test`.`t1`.`A`,(((`test`.`t2`.`A`) in t10 on PRIMARY))))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09, diff --git a/mysql-test/r/subquery_sj_none_bka_nobnl.result b/mysql-test/r/subquery_sj_none_bka_nobnl.result index 0565d8c9d408..aa629844a24a 100644 --- a/mysql-test/r/subquery_sj_none_bka_nobnl.result +++ b/mysql-test/r/subquery_sj_none_bka_nobnl.result @@ -182,24 +182,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a`,(/* select#2 */ select 1 from `test`.`t10` join `test`.`t12` where ((`test`.`t12`.`pk` = `test`.`t10`.`a`) and ((`test`.`t1`.`a`) = `test`.`t10`.`pk`)))) subqueries within outer joins go into ON expr. -explAin -select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A and B.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 PRIMARY A NULL ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY B NULL ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t10 NULL unique_suBquery PRIMARY PRIMARY 4 func 1 100.00 Using index +2 DEPENDENT SUBQUERY t10 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) And (`test`.`B`.`A`,(((`test`.`B`.`A`) in t10 on PRIMARY))))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) and (`test`.`B`.`A`,(((`test`.`B`.`A`) in t10 on PRIMARY))))) where true t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)" -explAin -select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10)); -id select_type tABle pArtitions type possiBle_keys key key_len ref rows filtered ExtrA +explain +select * from t1 left join t2 on (t2.A= t1.A and t2.A in (select pk from t10)); +id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 NULL 1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where -2 DEPENDENT SUBQUERY t10 NULL unique_suBquery PRIMARY PRIMARY 4 func 1 100.00 Using index +2 DEPENDENT SUBQUERY t10 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And (`test`.`t1`.`A`,(((`test`.`t2`.`A`) in t10 on PRIMARY))))) where true +Note 1003 /* select#1 */ select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) and (`test`.`t1`.`A`,(((`test`.`t2`.`A`) in t10 on PRIMARY))))) where true we shouldn't flatten if we're going to get a join of > MAX_TABLES. explain select * from t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09,