Skip to content

Commit 581eeaa

Browse files
author
Ole John Aske
committed
Bug#26984919 SPJ: 'DUPLICATE WEEDOUT' STRATEGY MAY RETURN INCORRECT RESULTS
This is a problem similar to what was recently fixed in - Bug#26926666 SPJ: 'LOOSESCAN' TABLES SHOULD NOT BE CHILD MEMBERS IN A PUSHED JOIN Furthermore, there also existed a similar 'push limitation' for child tables using the 'FirstMatch' semi join strategy, probably since the first release of the join pushdown feature. After studying all these 3 limitations, we realize that the common denominator for them all, is that a scan-child being part of a semi join 'nest', should not be pushdown joined with a parent table not being within the same semi joined 'nest'. This patch takes advantage if this realization and thus implement a single mechanism covering this pushability limitation for both the existing 'FirstMatch' and 'LooseScan' strategy, as well as the 'Duplicate weedout' being the subject of this bug report. The abstract_query_plan method ::get_join_type() is extended to also identify JT_SEMI_JOIN between a tableand its predecessor. ::is_pushable_as_child() replace its current logic to catch 'FirstMatch' and 'LooseScan' handling with checking for JT_SEMI_JOIN instead, which now will also automagically catch 'Duplicate weedout'. As a side effect a MTR testcase which previously incorrectly rejected 'FirstMatch' pushing of two tables inside the *same* semi join nest is now allowed to be pushed. The 'explain' -> show warnings output is slightly changed as a result of not specifically checking for 'FirstMatch' and 'LooseScan' anymore. Instead 'semi join' is reported as the reject reason.
1 parent edcba4d commit 581eeaa

9 files changed

+739
-133
lines changed

mysql-test/suite/ndb/r/ndb_join_pushdown_bka.result

Lines changed: 136 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6777,8 +6777,9 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
67776777
1 SIMPLE subq1 ref c c 4 test.t1.c 2 100.00 NULL
67786778
1 SIMPLE subq2 ref c c 4 test.t1.c 2 100.00 FirstMatch(t1)
67796779
Warnings:
6780-
Note 1003 Can't push table 'subq1' as child of 't1', 'FirstMatch' not allowed to contain scan-child
6781-
Note 1003 Can't push table 'subq2' as child of 't1', 'FirstMatch' not allowed to contain scan-child
6780+
Note 1003 Can't push table 'subq1' as child of 't1', semi join of scan-child not implemented
6781+
Note 1003 Can't push table 'subq2' as child of 't1', semi join of scan-child not implemented
6782+
Note 1003 Can't push table 'subq2' as child of 'subq1', their dependency is 'const'
67826783
Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` semi join (`test`.`t1` `subq2` join `test`.`t1` `subq1`) where ((`test`.`subq1`.`c` = `test`.`t1`.`c`) and (`test`.`subq2`.`c` = `test`.`t1`.`c`))
67836784
select count(*) from t1 where
67846785
t1.c in (select c from t1 as subq1 where
@@ -6790,12 +6791,11 @@ select count(*) from t1 where
67906791
t1.c in (select subq1.c from t1 as subq1 straight_join t1 as subq2 on subq1.a = subq2.c);
67916792
id select_type table type possible_keys key key_len ref rows filtered Extra
67926793
1 SIMPLE t1 ALL c NULL NULL NULL 16 100.00 NULL
6793-
1 SIMPLE subq1 ref PRIMARY,c c 4 test.t1.c 2 100.00 NULL
6794-
1 SIMPLE subq2 ref c c 4 test.subq1.a 2 100.00 FirstMatch(t1)
6794+
1 SIMPLE subq1 ref PRIMARY,c c 4 test.t1.c 2 100.00 Parent of 2 pushed join@1
6795+
1 SIMPLE subq2 ref c c 4 test.subq1.a 2 100.00 Child of 'subq1' in pushed join@1; FirstMatch(t1)
67956796
Warnings:
6796-
Note 1003 Can't push table 'subq1' as child of 't1', 'FirstMatch' not allowed to contain scan-child
6797+
Note 1003 Can't push table 'subq1' as child of 't1', semi join of scan-child not implemented
67976798
Note 1003 Can't push table 'subq2' as child of 't1', column 'subq1.a' is outside scope of pushable join
6798-
Note 1003 Can't push table 'subq2' as child of 'subq1', 'FirstMatch' not allowed to contain scan-child
67996799
Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` semi join (`test`.`t1` `subq1` straight_join `test`.`t1` `subq2`) where ((`test`.`subq2`.`c` = `test`.`subq1`.`a`) and (`test`.`subq1`.`c` = `test`.`t1`.`c`))
68006800
select count(*) from t1 where
68016801
t1.c in (select subq1.c from t1 as subq1 straight_join t1 as subq2 on subq1.a = subq2.c);
@@ -6913,6 +6913,134 @@ from t1 as t3s join t1 as t4s on t4s.a = t3s.b);
69136913
count(*)
69146914
256
69156915
SET optimizer_switch=@save_optimizer_switch;
6916+
set global debug='+d,max_4rows_in_spj_batches';
6917+
explain
6918+
select count(*)
6919+
from t1
6920+
join t1 as t2 on t2.a = t1.b
6921+
where t1.c IN (
6922+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t3s.c from t1 as t3s
6923+
join t1 as t4s on t4s.a = t3s.b);
6924+
id select_type table type possible_keys key key_len ref rows Extra
6925+
1 SIMPLE <subquery2> ALL NULL NULL NULL NULL NULL NULL
6926+
1 SIMPLE t1 ref c c 4 <subquery2>.c 2 Using join buffer (Batched Key Access)
6927+
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.b 1 Using join buffer (Batched Key Access)
6928+
2 MATERIALIZED t3s ALL c NULL NULL NULL 16 NULL
6929+
2 MATERIALIZED t4s ref PRIMARY PRIMARY 4 test.t3s.b 1 Using join buffer (Batched Key Access)
6930+
select count(*)
6931+
from t1
6932+
join t1 as t2 on t2.a = t1.b
6933+
where t1.c IN (
6934+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t3s.c from t1 as t3s
6935+
join t1 as t4s on t4s.a = t3s.b);
6936+
count(*)
6937+
64
6938+
explain
6939+
select count(*)
6940+
from t1
6941+
join t1 as t2 on t2.a = t1.b
6942+
where t2.c IN (
6943+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t3s.c from t1 as t3s
6944+
join t1 as t4s on t4s.a = t3s.b);
6945+
id select_type table type possible_keys key key_len ref rows Extra
6946+
1 SIMPLE t1 ALL NULL NULL NULL NULL 16 NULL
6947+
1 SIMPLE t2 ref PRIMARY,c PRIMARY 4 test.t1.b 1 Using join buffer (Batched Key Access)
6948+
1 SIMPLE t3s ref c c 4 test.t2.c 2 Parent of 2 pushed join@1
6949+
1 SIMPLE t4s ref PRIMARY PRIMARY 4 test.t3s.b 1 Child of 't3s' in pushed join@1; FirstMatch(t2)
6950+
select count(*)
6951+
from t1
6952+
join t1 as t2 on t2.a = t1.b
6953+
where t2.c IN (
6954+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t3s.c from t1 as t3s
6955+
join t1 as t4s on t4s.a = t3s.b);
6956+
count(*)
6957+
64
6958+
explain
6959+
select count(*)
6960+
from t1
6961+
join t1 as t2 on t2.a = t1.b
6962+
join t1 as t3 on t3.a = t2.b
6963+
where t1.c IN (
6964+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
6965+
join t1 as t5s on t5s.a = t4s.b
6966+
join t1 as t6s on t6s.a = t5s.b
6967+
);
6968+
id select_type table type possible_keys key key_len ref rows Extra
6969+
1 SIMPLE <subquery2> ALL NULL NULL NULL NULL NULL NULL
6970+
1 SIMPLE t1 ref c c 4 <subquery2>.c 2 Using join buffer (Batched Key Access)
6971+
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.b 1 Using join buffer (Batched Key Access)
6972+
1 SIMPLE t3 ref PRIMARY PRIMARY 4 test.t2.b 1 Using join buffer (Batched Key Access)
6973+
2 MATERIALIZED t4s ALL c NULL NULL NULL 16 NULL
6974+
2 MATERIALIZED t5s ref PRIMARY PRIMARY 4 test.t4s.b 1 Using join buffer (Batched Key Access)
6975+
2 MATERIALIZED t6s ref PRIMARY PRIMARY 4 test.t5s.b 1 Using join buffer (Batched Key Access)
6976+
select count(*)
6977+
from t1
6978+
join t1 as t2 on t2.a = t1.b
6979+
join t1 as t3 on t3.a = t2.b
6980+
where t1.c IN (
6981+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
6982+
join t1 as t5s on t5s.a = t4s.b
6983+
join t1 as t6s on t6s.a = t5s.b
6984+
);
6985+
count(*)
6986+
256
6987+
explain
6988+
select count(*)
6989+
from t1
6990+
join t1 as t2 on t2.a = t1.b
6991+
join t1 as t3 on t3.a = t2.b
6992+
where t2.c IN (
6993+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
6994+
join t1 as t5s on t5s.a = t4s.b
6995+
join t1 as t6s on t6s.a = t5s.b
6996+
);
6997+
id select_type table type possible_keys key key_len ref rows Extra
6998+
1 SIMPLE t1 ALL NULL NULL NULL NULL 16 NULL
6999+
1 SIMPLE t2 ref PRIMARY,c PRIMARY 4 test.t1.b 1 Using join buffer (Batched Key Access)
7000+
1 SIMPLE t3 ref PRIMARY PRIMARY 4 test.t2.b 1 Using join buffer (Batched Key Access)
7001+
1 SIMPLE t4s ref c c 4 test.t2.c 2 Parent of 3 pushed join@1
7002+
1 SIMPLE t5s ref PRIMARY PRIMARY 4 test.t4s.b 1 Child of 't4s' in pushed join@1
7003+
1 SIMPLE t6s ref PRIMARY PRIMARY 4 test.t5s.b 1 Child of 't5s' in pushed join@1; FirstMatch(t3)
7004+
select count(*)
7005+
from t1
7006+
join t1 as t2 on t2.a = t1.b
7007+
join t1 as t3 on t3.a = t2.b
7008+
where t2.c IN (
7009+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
7010+
join t1 as t5s on t5s.a = t4s.b
7011+
join t1 as t6s on t6s.a = t5s.b
7012+
);
7013+
count(*)
7014+
256
7015+
explain
7016+
select count(*)
7017+
from t1
7018+
join t1 as t2 on t2.a = t1.b
7019+
join t1 as t3 on t3.a = t2.b
7020+
where t3.c IN (
7021+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
7022+
join t1 as t5s on t5s.a = t4s.b
7023+
join t1 as t6s on t6s.a = t5s.b
7024+
);
7025+
id select_type table type possible_keys key key_len ref rows Extra
7026+
1 SIMPLE t1 ALL NULL NULL NULL NULL 16 NULL
7027+
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.b 1 Using join buffer (Batched Key Access)
7028+
1 SIMPLE t3 ref PRIMARY,c PRIMARY 4 test.t2.b 1 Using join buffer (Batched Key Access)
7029+
1 SIMPLE t4s ref c c 4 test.t3.c 2 Parent of 3 pushed join@1
7030+
1 SIMPLE t5s ref PRIMARY PRIMARY 4 test.t4s.b 1 Child of 't4s' in pushed join@1
7031+
1 SIMPLE t6s ref PRIMARY PRIMARY 4 test.t5s.b 1 Child of 't5s' in pushed join@1; FirstMatch(t3)
7032+
select count(*)
7033+
from t1
7034+
join t1 as t2 on t2.a = t1.b
7035+
join t1 as t3 on t3.a = t2.b
7036+
where t3.c IN (
7037+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
7038+
join t1 as t5s on t5s.a = t4s.b
7039+
join t1 as t6s on t6s.a = t5s.b
7040+
);
7041+
count(*)
7042+
256
7043+
set global debug=@save_debug;
69167044
drop table t1;
69177045
CREATE TABLE ndb_order_test (
69187046
node_id int(10) unsigned NOT NULL,
@@ -6968,9 +7096,9 @@ where new.variable_name = old.variable_name
69687096
order by new.variable_name;
69697097
variable_name new.variable_value - old.variable_value
69707098
NDB_PRUNED_SCAN_COUNT 24
6971-
NDB_PUSHED_QUERIES_DEFINED 0
7099+
NDB_PUSHED_QUERIES_DEFINED 8
69727100
NDB_PUSHED_QUERIES_DROPPED 0
6973-
NDB_PUSHED_QUERIES_EXECUTED 0
7101+
NDB_PUSHED_QUERIES_EXECUTED 592
69747102
NDB_SORTED_SCAN_COUNT 0
69757103
drop table server_counts_at_startup;
69767104
set ndb_join_pushdown = @save_ndb_join_pushdown;

mysql-test/suite/ndb/r/ndb_join_pushdown_default.result

Lines changed: 140 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6069,7 +6069,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
60696069
1 SIMPLE t1 ALL c NULL NULL NULL 16 100.00 NULL
60706070
1 SIMPLE subq ref c c 4 test.t1.c 2 100.00 FirstMatch(t1)
60716071
Warnings:
6072-
Note 1003 Can't push table 'subq' as child of 't1', 'FirstMatch' not allowed to contain scan-child
6072+
Note 1003 Can't push table 'subq' as child of 't1', semi join of scan-child not implemented
60736073
Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` semi join (`test`.`t1` `subq`) where (`test`.`subq`.`c` = `test`.`t1`.`c`)
60746074
select count(*) from t1 where
60756075
t1.c in (select c from t1 as subq);
@@ -6084,8 +6084,9 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
60846084
1 SIMPLE subq1 ref c c 4 test.t1.c 2 100.00 FirstMatch(t1)
60856085
1 SIMPLE subq2 ref d d 4 test.t1.d 2 100.00 FirstMatch(subq1)
60866086
Warnings:
6087-
Note 1003 Can't push table 'subq1' as child of 't1', 'FirstMatch' not allowed to contain scan-child
6088-
Note 1003 Can't push table 'subq2' as child of 't1', 'FirstMatch' not allowed to contain scan-child
6087+
Note 1003 Can't push table 'subq1' as child of 't1', semi join of scan-child not implemented
6088+
Note 1003 Can't push table 'subq2' as child of 't1', semi join of scan-child not implemented
6089+
Note 1003 Can't push table 'subq2' as child of 'subq1', their dependency is 'const'
60896090
Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` semi join (`test`.`t1` `subq1`) semi join (`test`.`t1` `subq2`) where ((`test`.`subq2`.`d` = `test`.`t1`.`d`) and (`test`.`subq1`.`c` = `test`.`t1`.`c`))
60906091
select count(*) from t1 where
60916092
t1.c in (select c from t1 as subq1) and
@@ -6101,8 +6102,9 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
61016102
1 SIMPLE subq1 ref c c 4 test.t1.c 2 100.00 NULL
61026103
1 SIMPLE subq2 ref c c 4 test.t1.c 2 100.00 FirstMatch(t1)
61036104
Warnings:
6104-
Note 1003 Can't push table 'subq1' as child of 't1', 'FirstMatch' not allowed to contain scan-child
6105-
Note 1003 Can't push table 'subq2' as child of 't1', 'FirstMatch' not allowed to contain scan-child
6105+
Note 1003 Can't push table 'subq1' as child of 't1', semi join of scan-child not implemented
6106+
Note 1003 Can't push table 'subq2' as child of 't1', semi join of scan-child not implemented
6107+
Note 1003 Can't push table 'subq2' as child of 'subq1', their dependency is 'const'
61066108
Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` semi join (`test`.`t1` `subq2` join `test`.`t1` `subq1`) where ((`test`.`subq1`.`c` = `test`.`t1`.`c`) and (`test`.`subq2`.`c` = `test`.`t1`.`c`))
61076109
select count(*) from t1 where
61086110
t1.c in (select c from t1 as subq1 where
@@ -6114,12 +6116,11 @@ select count(*) from t1 where
61146116
t1.c in (select subq1.c from t1 as subq1 straight_join t1 as subq2 on subq1.a = subq2.c);
61156117
id select_type table type possible_keys key key_len ref rows filtered Extra
61166118
1 SIMPLE t1 ALL c NULL NULL NULL 16 100.00 NULL
6117-
1 SIMPLE subq1 ref PRIMARY,c c 4 test.t1.c 2 100.00 NULL
6118-
1 SIMPLE subq2 ref c c 4 test.subq1.a 2 100.00 FirstMatch(t1)
6119+
1 SIMPLE subq1 ref PRIMARY,c c 4 test.t1.c 2 100.00 Parent of 2 pushed join@1
6120+
1 SIMPLE subq2 ref c c 4 test.subq1.a 2 100.00 Child of 'subq1' in pushed join@1; FirstMatch(t1)
61196121
Warnings:
6120-
Note 1003 Can't push table 'subq1' as child of 't1', 'FirstMatch' not allowed to contain scan-child
6122+
Note 1003 Can't push table 'subq1' as child of 't1', semi join of scan-child not implemented
61216123
Note 1003 Can't push table 'subq2' as child of 't1', column 'subq1.a' is outside scope of pushable join
6122-
Note 1003 Can't push table 'subq2' as child of 'subq1', 'FirstMatch' not allowed to contain scan-child
61236124
Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` semi join (`test`.`t1` `subq1` straight_join `test`.`t1` `subq2`) where ((`test`.`subq2`.`c` = `test`.`subq1`.`a`) and (`test`.`subq1`.`c` = `test`.`t1`.`c`))
61246125
select count(*) from t1 where
61256126
t1.c in (select subq1.c from t1 as subq1 straight_join t1 as subq2 on subq1.a = subq2.c);
@@ -6237,6 +6238,134 @@ from t1 as t3s join t1 as t4s on t4s.a = t3s.b);
62376238
count(*)
62386239
256
62396240
SET optimizer_switch=@save_optimizer_switch;
6241+
set global debug='+d,max_4rows_in_spj_batches';
6242+
explain
6243+
select count(*)
6244+
from t1
6245+
join t1 as t2 on t2.a = t1.b
6246+
where t1.c IN (
6247+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t3s.c from t1 as t3s
6248+
join t1 as t4s on t4s.a = t3s.b);
6249+
id select_type table type possible_keys key key_len ref rows Extra
6250+
1 SIMPLE <subquery2> ALL NULL NULL NULL NULL NULL NULL
6251+
1 SIMPLE t1 ref c c 4 <subquery2>.c 2 Parent of 2 pushed join@1
6252+
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.b 1 Child of 't1' in pushed join@1
6253+
2 MATERIALIZED t3s ALL c NULL NULL NULL 16 NULL
6254+
2 MATERIALIZED t4s ref PRIMARY PRIMARY 4 test.t3s.b 1 NULL
6255+
select count(*)
6256+
from t1
6257+
join t1 as t2 on t2.a = t1.b
6258+
where t1.c IN (
6259+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t3s.c from t1 as t3s
6260+
join t1 as t4s on t4s.a = t3s.b);
6261+
count(*)
6262+
64
6263+
explain
6264+
select count(*)
6265+
from t1
6266+
join t1 as t2 on t2.a = t1.b
6267+
where t2.c IN (
6268+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t3s.c from t1 as t3s
6269+
join t1 as t4s on t4s.a = t3s.b);
6270+
id select_type table type possible_keys key key_len ref rows Extra
6271+
1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Parent of 2 pushed join@1
6272+
1 SIMPLE t2 ref PRIMARY,c PRIMARY 4 test.t1.b 1 Child of 't1' in pushed join@1
6273+
1 SIMPLE t3s ref c c 4 test.t2.c 2 Parent of 2 pushed join@2
6274+
1 SIMPLE t4s ref PRIMARY PRIMARY 4 test.t3s.b 1 Child of 't3s' in pushed join@2; FirstMatch(t2)
6275+
select count(*)
6276+
from t1
6277+
join t1 as t2 on t2.a = t1.b
6278+
where t2.c IN (
6279+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t3s.c from t1 as t3s
6280+
join t1 as t4s on t4s.a = t3s.b);
6281+
count(*)
6282+
64
6283+
explain
6284+
select count(*)
6285+
from t1
6286+
join t1 as t2 on t2.a = t1.b
6287+
join t1 as t3 on t3.a = t2.b
6288+
where t1.c IN (
6289+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
6290+
join t1 as t5s on t5s.a = t4s.b
6291+
join t1 as t6s on t6s.a = t5s.b
6292+
);
6293+
id select_type table type possible_keys key key_len ref rows Extra
6294+
1 SIMPLE <subquery2> ALL NULL NULL NULL NULL NULL NULL
6295+
1 SIMPLE t1 ref c c 4 <subquery2>.c 2 Parent of 3 pushed join@1
6296+
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.b 1 Child of 't1' in pushed join@1
6297+
1 SIMPLE t3 ref PRIMARY PRIMARY 4 test.t2.b 1 Child of 't2' in pushed join@1
6298+
2 MATERIALIZED t4s ALL c NULL NULL NULL 16 NULL
6299+
2 MATERIALIZED t5s ref PRIMARY PRIMARY 4 test.t4s.b 1 NULL
6300+
2 MATERIALIZED t6s ref PRIMARY PRIMARY 4 test.t5s.b 1 NULL
6301+
select count(*)
6302+
from t1
6303+
join t1 as t2 on t2.a = t1.b
6304+
join t1 as t3 on t3.a = t2.b
6305+
where t1.c IN (
6306+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
6307+
join t1 as t5s on t5s.a = t4s.b
6308+
join t1 as t6s on t6s.a = t5s.b
6309+
);
6310+
count(*)
6311+
256
6312+
explain
6313+
select count(*)
6314+
from t1
6315+
join t1 as t2 on t2.a = t1.b
6316+
join t1 as t3 on t3.a = t2.b
6317+
where t2.c IN (
6318+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
6319+
join t1 as t5s on t5s.a = t4s.b
6320+
join t1 as t6s on t6s.a = t5s.b
6321+
);
6322+
id select_type table type possible_keys key key_len ref rows Extra
6323+
1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Parent of 3 pushed join@1
6324+
1 SIMPLE t2 ref PRIMARY,c PRIMARY 4 test.t1.b 1 Child of 't1' in pushed join@1
6325+
1 SIMPLE t3 ref PRIMARY PRIMARY 4 test.t2.b 1 Child of 't2' in pushed join@1
6326+
1 SIMPLE t4s ref c c 4 test.t2.c 2 Parent of 3 pushed join@2
6327+
1 SIMPLE t5s ref PRIMARY PRIMARY 4 test.t4s.b 1 Child of 't4s' in pushed join@2
6328+
1 SIMPLE t6s ref PRIMARY PRIMARY 4 test.t5s.b 1 Child of 't5s' in pushed join@2; FirstMatch(t3)
6329+
select count(*)
6330+
from t1
6331+
join t1 as t2 on t2.a = t1.b
6332+
join t1 as t3 on t3.a = t2.b
6333+
where t2.c IN (
6334+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
6335+
join t1 as t5s on t5s.a = t4s.b
6336+
join t1 as t6s on t6s.a = t5s.b
6337+
);
6338+
count(*)
6339+
256
6340+
explain
6341+
select count(*)
6342+
from t1
6343+
join t1 as t2 on t2.a = t1.b
6344+
join t1 as t3 on t3.a = t2.b
6345+
where t3.c IN (
6346+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
6347+
join t1 as t5s on t5s.a = t4s.b
6348+
join t1 as t6s on t6s.a = t5s.b
6349+
);
6350+
id select_type table type possible_keys key key_len ref rows Extra
6351+
1 SIMPLE t1 ALL NULL NULL NULL NULL 16 Parent of 3 pushed join@1
6352+
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.b 1 Child of 't1' in pushed join@1
6353+
1 SIMPLE t3 ref PRIMARY,c PRIMARY 4 test.t2.b 1 Child of 't2' in pushed join@1
6354+
1 SIMPLE t4s ref c c 4 test.t3.c 2 Parent of 3 pushed join@2
6355+
1 SIMPLE t5s ref PRIMARY PRIMARY 4 test.t4s.b 1 Child of 't4s' in pushed join@2
6356+
1 SIMPLE t6s ref PRIMARY PRIMARY 4 test.t5s.b 1 Child of 't5s' in pushed join@2; FirstMatch(t3)
6357+
select count(*)
6358+
from t1
6359+
join t1 as t2 on t2.a = t1.b
6360+
join t1 as t3 on t3.a = t2.b
6361+
where t3.c IN (
6362+
select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
6363+
join t1 as t5s on t5s.a = t4s.b
6364+
join t1 as t6s on t6s.a = t5s.b
6365+
);
6366+
count(*)
6367+
256
6368+
set global debug=@save_debug;
62406369
drop table t1;
62416370
CREATE TABLE ndb_order_test (
62426371
node_id int(10) unsigned NOT NULL,
@@ -6292,9 +6421,9 @@ where new.variable_name = old.variable_name
62926421
order by new.variable_name;
62936422
variable_name new.variable_value - old.variable_value
62946423
NDB_PRUNED_SCAN_COUNT 8
6295-
NDB_PUSHED_QUERIES_DEFINED 439
6424+
NDB_PUSHED_QUERIES_DEFINED 457
62966425
NDB_PUSHED_QUERIES_DROPPED 8
6297-
NDB_PUSHED_QUERIES_EXECUTED 558
6426+
NDB_PUSHED_QUERIES_EXECUTED 1163
62986427
NDB_SORTED_SCAN_COUNT 13
62996428
drop table server_counts_at_startup;
63006429
set ndb_join_pushdown = @save_ndb_join_pushdown;

0 commit comments

Comments
 (0)