Skip to content

Commit

Permalink
Bug #30473261: CONVERT THE INDEX SUBQUERY ENGINES INTO USING THE ITER…
Browse files Browse the repository at this point in the history
…ATOR EXECUTOR [patch 1/10, case folding]

Fix broken case folding in subquery_sj.inc.

There was a regex in the test file that was probably intended to work around
differences between case-sensitive and case-insensitive platforms, but it was
way too broad, leading to “explAin” and so on. Fix the regex to only work on
the separate tokens “a” and “b”, not every letter a and b anywhere.

Change-Id: I760a0c8712df72e5a6a310aae869e3ba447ccc84
  • Loading branch information
Steinar H. Gunderson committed Dec 20, 2019
1 parent 82d8338 commit 609b86e
Show file tree
Hide file tree
Showing 20 changed files with 169 additions and 169 deletions.
4 changes: 2 additions & 2 deletions mysql-test/include/subquery_sj.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
16 changes: 8 additions & 8 deletions mysql-test/r/subquery_sj_all.result
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions mysql-test/r/subquery_sj_all_bka.result
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions mysql-test/r/subquery_sj_all_bka_nobnl.result
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions mysql-test/r/subquery_sj_dupsweed.result
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions mysql-test/r/subquery_sj_dupsweed_bka.result
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions mysql-test/r/subquery_sj_dupsweed_bka_nobnl.result
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 609b86e

Please sign in to comment.