@@ -6069,7 +6069,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
6069
6069
1 SIMPLE t1 ALL c NULL NULL NULL 16 100.00 NULL
6070
6070
1 SIMPLE subq ref c c 4 test.t1.c 2 100.00 FirstMatch(t1)
6071
6071
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
6073
6073
Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` semi join (`test`.`t1` `subq`) where (`test`.`subq`.`c` = `test`.`t1`.`c`)
6074
6074
select count(*) from t1 where
6075
6075
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
6084
6084
1 SIMPLE subq1 ref c c 4 test.t1.c 2 100.00 FirstMatch(t1)
6085
6085
1 SIMPLE subq2 ref d d 4 test.t1.d 2 100.00 FirstMatch(subq1)
6086
6086
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'
6089
6090
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`))
6090
6091
select count(*) from t1 where
6091
6092
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
6101
6102
1 SIMPLE subq1 ref c c 4 test.t1.c 2 100.00 NULL
6102
6103
1 SIMPLE subq2 ref c c 4 test.t1.c 2 100.00 FirstMatch(t1)
6103
6104
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'
6106
6108
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`))
6107
6109
select count(*) from t1 where
6108
6110
t1.c in (select c from t1 as subq1 where
@@ -6114,12 +6116,11 @@ select count(*) from t1 where
6114
6116
t1.c in (select subq1.c from t1 as subq1 straight_join t1 as subq2 on subq1.a = subq2.c);
6115
6117
id select_type table type possible_keys key key_len ref rows filtered Extra
6116
6118
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)
6119
6121
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
6121
6123
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
6123
6124
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`))
6124
6125
select count(*) from t1 where
6125
6126
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);
6237
6238
count(*)
6238
6239
256
6239
6240
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;
6240
6369
drop table t1;
6241
6370
CREATE TABLE ndb_order_test (
6242
6371
node_id int(10) unsigned NOT NULL,
@@ -6292,9 +6421,9 @@ where new.variable_name = old.variable_name
6292
6421
order by new.variable_name;
6293
6422
variable_name new.variable_value - old.variable_value
6294
6423
NDB_PRUNED_SCAN_COUNT 8
6295
- NDB_PUSHED_QUERIES_DEFINED 439
6424
+ NDB_PUSHED_QUERIES_DEFINED 457
6296
6425
NDB_PUSHED_QUERIES_DROPPED 8
6297
- NDB_PUSHED_QUERIES_EXECUTED 558
6426
+ NDB_PUSHED_QUERIES_EXECUTED 1163
6298
6427
NDB_SORTED_SCAN_COUNT 13
6299
6428
drop table server_counts_at_startup;
6300
6429
set ndb_join_pushdown = @save_ndb_join_pushdown;
0 commit comments