Commit b8fb0521 authored by Sergey Petrunya's avatar Sergey Petrunya

MWL#90, Code cleanup:

- Fix test failures: do not use make_cond_after_sjm()'s result in case
  of merged SJ-Materialization lookup
- Update test results
parent f49ea935
...@@ -86,7 +86,7 @@ a1 a2 ...@@ -86,7 +86,7 @@ a1 a2
explain extended explain extended
select * from t1i where a1 in (select b1 from t2i where b1 > '0'); select * from t1i where a1 in (select b1 from t2i where b1 > '0');
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2i index it2i1,it2i3 it2i1 9 NULL 5 50.00 Using where; Using index; LooseScan 1 PRIMARY t2i index it2i1,it2i3 it2i1 9 NULL 5 40.00 Using where; Using index; LooseScan
1 PRIMARY t1i ref it1i1,it1i3 it1i3 9 test.t2i.b1 1 100.00 Using index 1 PRIMARY t1i ref it1i1,it1i3 it1i3 9 test.t2i.b1 1 100.00 Using index
Warnings: Warnings:
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0')) Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0'))
...@@ -109,7 +109,7 @@ a1 a2 ...@@ -109,7 +109,7 @@ a1 a2
explain extended explain extended
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0'); select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 50.00 Using where; Using index; LooseScan 1 PRIMARY t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 40.00 Using where; Using index; LooseScan
1 PRIMARY t1i ref it1i1,it1i2,it1i3 it1i3 18 test.t2i.b1,test.t2i.b2 1 100.00 Using index 1 PRIMARY t1i ref it1i1,it1i2,it1i3 it1i3 18 test.t2i.b1,test.t2i.b2 1 100.00 Using index
Warnings: Warnings:
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where ((`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0')) Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where ((`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0'))
...@@ -312,7 +312,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -312,7 +312,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 SUBQUERY t2i index it2i1,it2i2,it2i3 # # # 5 100.00 # 3 SUBQUERY t2i index it2i1,it2i2,it2i3 # # # 5 100.00 #
3 SUBQUERY t3i index it3i1,it3i2,it3i3 # # # 4 75.00 # 3 SUBQUERY t3i index it3i1,it3i2,it3i3 # # # 4 75.00 #
Warnings: Warnings:
Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0')) Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t2i`.`b2` = `test`.`t3i`.`c2`) and (`test`.`t2i`.`b1` = `test`.`t3i`.`c1`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t3i`.`c2` > '0'))
select * from t1i select * from t1i
where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
(a1, a2) in (select c1, c2 from t3i (a1, a2) in (select c1, c2 from t3i
...@@ -402,7 +402,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -402,7 +402,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
9 SUBQUERY t3i index it3i1,it3i2,it3i3 # # # 4 75.00 # 9 SUBQUERY t3i index it3i1,it3i2,it3i3 # # # 4 75.00 #
NULL UNION RESULT <union1,7> ALL NULL # # # NULL NULL # NULL UNION RESULT <union1,7> ALL NULL # # # NULL NULL #
Warnings: Warnings:
Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`)))))) group by `test`.`t2`.`b1`,`test`.`t2`.`b2`) semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t1` where ((`test`.`t3`.`c2` = `<subquery2>`.`b2`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`) and (`test`.`t2i`.`b2` = `<subquery2>`.`b2`) and (`test`.`t3`.`c1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t2i`.`b1` = `<subquery2>`.`b1`) and (`<subquery2>`.`b2` > '0'))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0'))) Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1` AS `b1`,`test`.`t2`.`b2` AS `b2` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`))))) or <in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` AS `c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`)))))) group by `test`.`t2`.`b1`,`test`.`t2`.`b2`) semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t1` where ((`test`.`t3`.`c2` = `<subquery2>`.`b2`) and (`test`.`t1`.`a2` = `<subquery2>`.`b2`) and (`test`.`t2i`.`b2` = `<subquery2>`.`b2`) and (`test`.`t3`.`c1` = `<subquery2>`.`b1`) and (`test`.`t1`.`a1` = `<subquery2>`.`b1`) and (`test`.`t2i`.`b1` = `<subquery2>`.`b1`) and (`<subquery2>`.`b2` > '0'))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t2i`.`b2` = `test`.`t3i`.`c2`) and (`test`.`t2i`.`b1` = `test`.`t3i`.`c1`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t3i`.`c2` > '0')))
(select * from t1 (select * from t1
where (a1, a2) in (select b1, b2 from t2 where (a1, a2) in (select b1, b2 from t2
where b2 in (select c2 from t3 where c2 LIKE '%02') or where b2 in (select c2 from t3 where c2 LIKE '%02') or
......
...@@ -2742,6 +2742,7 @@ bool setup_sj_materialization(JOIN_TAB *sjm_tab) ...@@ -2742,6 +2742,7 @@ bool setup_sj_materialization(JOIN_TAB *sjm_tab)
emb_sj_nest->sj_subq_pred))) emb_sj_nest->sj_subq_pred)))
DBUG_RETURN(TRUE); /* purecov: inspected */ DBUG_RETURN(TRUE); /* purecov: inspected */
sjm_tab->type= JT_EQ_REF; sjm_tab->type= JT_EQ_REF;
sjm_tab->select_cond= sjm->in_equality;
} }
else else
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment