You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mysql-test/suite/ndb/t/ndb_join_pushdown.test
+162-47
Original file line number
Diff line number
Diff line change
@@ -37,30 +37,6 @@ let $pushed_queries_dropped_at_startup = query_get_value(show status like 'Ndb_p
37
37
let $pushed_queries_executed_at_startup = query_get_value(show status like 'Ndb_pushed_queries_executed', Value, 1);
38
38
let $pushed_reads_at_startup = query_get_value(show status like 'Ndb_pushed_reads', Value, 1);
39
39
40
-
# Use this table and the two queries below to turn of meassuring
41
-
# SCAN_ROWS_RETURNED for certain bushy scan queries. The reason for this is
42
-
# that growth of this counter is platform dependent for these queries. There
43
-
# are two reasons for this:
44
-
# 1. Distribution hashing (partitioning) of tables is endian dependent. This
45
-
# may cause data to be more skewed on some platforms. This again requires more
46
-
# batches to scan the table and thus more repeats of repeatable scans (i.e.
47
-
# those that will be repeated for each batch of the other branch of a bushy
48
-
# scan). This increases the overall scan row count.
49
-
# 2. If a timer expires in LQH after receiving SCAN_FRAGREQ, LQH may decide to
50
-
# send SCAN_FRAGCONF immediately, even if more tuples could fit in the batch.
51
-
# As above this causes more repeats of repeatable scans.
52
-
53
-
create temporary table spj_save_counts like spj_counts_at_startup;
54
-
55
-
insert into spj_save_counts values ('SCAN_ROWS_RETURNED', 0);
56
-
57
-
# Record current counter value.
58
-
let $save_scan_rows_returned = update spj_save_counts set val = (select sum(val) from ndbinfo.counters where block_name='DBSPJ' and counter_name='SCAN_ROWS_RETURNED') where counter_name='SCAN_ROWS_RETURNED';
59
-
60
-
# Update spj_counts_at_startup to compensate for counter increments since
61
-
# running save_scan_rows_returned.
62
-
let $compensate_scan_rows_returned = update spj_counts_at_startup set val = val + (select sum(val) from ndbinfo.counters where block_name='DBSPJ' and counter_name='SCAN_ROWS_RETURNED') - (select val from spj_save_counts where counter_name='SCAN_ROWS_RETURNED') where counter_name='SCAN_ROWS_RETURNED';
63
-
64
40
##############
65
41
# Test start
66
42
@@ -1046,7 +1022,6 @@ connection ddl;
1046
1022
alter table t1 partition by key(a);
1047
1023
1048
1024
connection spj;
1049
-
eval $save_scan_rows_returned;
1050
1025
1051
1026
explain select count(*) from t1
1052
1027
join t1 as t2 on t2.a = t1.c
@@ -1077,8 +1052,6 @@ select count(*) from t1 as x1
1077
1052
join t1 as x2 on x2.a = x1.c and x1.b < 2
1078
1053
join t1 as x3 on x3.a = x1.c;
1079
1054
1080
-
eval $compensate_scan_rows_returned;
1081
-
1082
1055
connection ddl;
1083
1056
drop table t1;
1084
1057
drop table tx;
@@ -1281,6 +1254,162 @@ insert into t1 values (0x4f, null);
1281
1254
--sorted_result
1282
1255
select * from t1 left join t1 as t2 on t2.a = t1.b;
1283
1256
1257
+
### Test max number of pushable operations.
1258
+
1259
+
insert into t3 values (8,8,8,8);
1260
+
1261
+
# Unique lookups only.
1262
+
explain extended select count(*) from t3 as x0
1263
+
join t3 as x1 on x0.b3=x1.d3 and x0.d3=8
1264
+
join t3 as x2 on x1.b3=x2.d3
1265
+
join t3 as x3 on x2.b3=x3.d3
1266
+
join t3 as x4 on x3.b3=x4.d3
1267
+
join t3 as x5 on x4.b3=x5.d3
1268
+
join t3 as x6 on x5.b3=x6.d3
1269
+
join t3 as x7 on x6.b3=x7.d3
1270
+
join t3 as x8 on x7.b3=x8.d3
1271
+
join t3 as x9 on x8.b3=x9.d3
1272
+
join t3 as x10 on x9.b3=x10.d3
1273
+
join t3 as x11 on x10.b3=x11.d3
1274
+
join t3 as x12 on x11.b3=x12.d3
1275
+
join t3 as x13 on x12.b3=x13.d3
1276
+
join t3 as x14 on x13.b3=x14.d3
1277
+
join t3 as x15 on x14.b3=x15.d3
1278
+
join t3 as x16 on x15.b3=x16.d3
1279
+
join t3 as x17 on x16.b3=x17.d3;
1280
+
1281
+
select count(*) from t3 as x0
1282
+
join t3 as x1 on x0.b3=x1.d3 and x0.d3=8
1283
+
join t3 as x2 on x1.b3=x2.d3
1284
+
join t3 as x3 on x2.b3=x3.d3
1285
+
join t3 as x4 on x3.b3=x4.d3
1286
+
join t3 as x5 on x4.b3=x5.d3
1287
+
join t3 as x6 on x5.b3=x6.d3
1288
+
join t3 as x7 on x6.b3=x7.d3
1289
+
join t3 as x8 on x7.b3=x8.d3
1290
+
join t3 as x9 on x8.b3=x9.d3
1291
+
join t3 as x10 on x9.b3=x10.d3
1292
+
join t3 as x11 on x10.b3=x11.d3
1293
+
join t3 as x12 on x11.b3=x12.d3
1294
+
join t3 as x13 on x12.b3=x13.d3
1295
+
join t3 as x14 on x13.b3=x14.d3
1296
+
join t3 as x15 on x14.b3=x15.d3
1297
+
join t3 as x16 on x15.b3=x16.d3
1298
+
join t3 as x17 on x16.b3=x17.d3;
1299
+
1300
+
1301
+
# Max scans
1302
+
explain extended select count(*) from t3 as x0
1303
+
join t3 as x1 on x0.c3=x1.a3
1304
+
join t3 as x2 on x1.c3=x2.a3
1305
+
join t3 as x3 on x2.c3=x3.a3
1306
+
join t3 as x4 on x3.c3=x4.a3
1307
+
join t3 as x5 on x4.c3=x5.a3
1308
+
join t3 as x6 on x5.c3=x6.a3
1309
+
join t3 as x7 on x6.c3=x7.a3
1310
+
join t3 as x8 on x7.c3=x8.a3
1311
+
join t3 as x9 on x8.c3=x9.a3
1312
+
join t3 as x10 on x9.c3=x10.a3
1313
+
join t3 as x11 on x10.c3=x11.a3
1314
+
join t3 as x12 on x11.c3=x12.a3
1315
+
join t3 as x13 on x12.c3=x13.a3
1316
+
join t3 as x14 on x13.c3=x14.a3
1317
+
join t3 as x15 on x14.c3=x15.a3
1318
+
join t3 as x16 on x15.c3=x16.a3
1319
+
join t3 as x17 on x16.c3=x17.a3
1320
+
join t3 as x18 on x17.c3=x18.a3
1321
+
join t3 as x19 on x18.c3=x19.a3
1322
+
join t3 as x20 on x19.c3=x20.a3
1323
+
join t3 as x21 on x20.c3=x21.a3
1324
+
join t3 as x22 on x21.c3=x22.a3
1325
+
join t3 as x23 on x22.c3=x23.a3
1326
+
join t3 as x24 on x23.c3=x24.a3
1327
+
join t3 as x25 on x24.c3=x25.a3
1328
+
join t3 as x26 on x25.c3=x26.a3
1329
+
join t3 as x27 on x26.c3=x27.a3
1330
+
join t3 as x28 on x27.c3=x28.a3
1331
+
join t3 as x29 on x28.c3=x29.a3
1332
+
join t3 as x30 on x29.c3=x30.a3
1333
+
join t3 as x31 on x30.c3=x31.a3
1334
+
join t3 as x32 on x31.c3=x32.a3
1335
+
join t3 as x33 on x32.c3=x33.a3;
1336
+
1337
+
select count(*) from t3 as x0
1338
+
join t3 as x1 on x0.c3=x1.a3
1339
+
join t3 as x2 on x1.c3=x2.a3
1340
+
join t3 as x3 on x2.c3=x3.a3
1341
+
join t3 as x4 on x3.c3=x4.a3
1342
+
join t3 as x5 on x4.c3=x5.a3
1343
+
join t3 as x6 on x5.c3=x6.a3
1344
+
join t3 as x7 on x6.c3=x7.a3
1345
+
join t3 as x8 on x7.c3=x8.a3
1346
+
join t3 as x9 on x8.c3=x9.a3
1347
+
join t3 as x10 on x9.c3=x10.a3
1348
+
join t3 as x11 on x10.c3=x11.a3
1349
+
join t3 as x12 on x11.c3=x12.a3
1350
+
join t3 as x13 on x12.c3=x13.a3
1351
+
join t3 as x14 on x13.c3=x14.a3
1352
+
join t3 as x15 on x14.c3=x15.a3
1353
+
join t3 as x16 on x15.c3=x16.a3
1354
+
join t3 as x17 on x16.c3=x17.a3
1355
+
join t3 as x18 on x17.c3=x18.a3
1356
+
join t3 as x19 on x18.c3=x19.a3
1357
+
join t3 as x20 on x19.c3=x20.a3
1358
+
join t3 as x21 on x20.c3=x21.a3
1359
+
join t3 as x22 on x21.c3=x22.a3
1360
+
join t3 as x23 on x22.c3=x23.a3
1361
+
join t3 as x24 on x23.c3=x24.a3
1362
+
join t3 as x25 on x24.c3=x25.a3
1363
+
join t3 as x26 on x25.c3=x26.a3
1364
+
join t3 as x27 on x26.c3=x27.a3
1365
+
join t3 as x28 on x27.c3=x28.a3
1366
+
join t3 as x29 on x28.c3=x29.a3
1367
+
join t3 as x30 on x29.c3=x30.a3
1368
+
join t3 as x31 on x30.c3=x31.a3
1369
+
join t3 as x32 on x31.c3=x32.a3
1370
+
join t3 as x33 on x32.c3=x33.a3;
1371
+
1372
+
#Mixed join
1373
+
explain extended select count(*) from t3 as x0
1374
+
join t3 as x1 on x0.b3=x1.d3
1375
+
join t3 as x2 on x1.b3=x2.d3
1376
+
join t3 as x3 on x2.b3=x3.d3
1377
+
join t3 as x4 on x3.b3=x4.d3
1378
+
join t3 as x5 on x4.b3=x5.d3
1379
+
join t3 as x6 on x5.b3=x6.d3
1380
+
join t3 as x7 on x6.b3=x7.d3
1381
+
join t3 as x8 on x7.b3=x8.d3
1382
+
join t3 as x9 on x8.b3=x9.d3
1383
+
join t3 as x10 on x9.b3=x10.d3
1384
+
join t3 as x11 on x10.b3=x11.d3
1385
+
join t3 as x12 on x11.b3=x12.d3
1386
+
join t3 as x13 on x12.b3=x13.d3
1387
+
join t3 as x14 on x13.b3=x14.d3
1388
+
join t3 as x15 on x14.b3=x15.d3
1389
+
join t3 as x16 on x15.b3=x16.d3
1390
+
join t3 as x17 on x15.b3=x17.a3
1391
+
join t3 as x18 on x16.b3=x18.d3;
1392
+
1393
+
select count(*) from t3 as x0
1394
+
join t3 as x1 on x0.b3=x1.d3
1395
+
join t3 as x2 on x1.b3=x2.d3
1396
+
join t3 as x3 on x2.b3=x3.d3
1397
+
join t3 as x4 on x3.b3=x4.d3
1398
+
join t3 as x5 on x4.b3=x5.d3
1399
+
join t3 as x6 on x5.b3=x6.d3
1400
+
join t3 as x7 on x6.b3=x7.d3
1401
+
join t3 as x8 on x7.b3=x8.d3
1402
+
join t3 as x9 on x8.b3=x9.d3
1403
+
join t3 as x10 on x9.b3=x10.d3
1404
+
join t3 as x11 on x10.b3=x11.d3
1405
+
join t3 as x12 on x11.b3=x12.d3
1406
+
join t3 as x13 on x12.b3=x13.d3
1407
+
join t3 as x14 on x13.b3=x14.d3
1408
+
join t3 as x15 on x14.b3=x15.d3
1409
+
join t3 as x16 on x15.b3=x16.d3
1410
+
join t3 as x17 on x15.b3=x17.a3
1411
+
join t3 as x18 on x16.b3=x18.d3;
1412
+
1284
1413
connection ddl;
1285
1414
drop table t1,t2,t3, t3_hash;
1286
1415
@@ -2987,7 +3116,6 @@ explain extended select straight_join * from
2987
3116
# These should be allowed to be executed in 'parallel', depending on
2988
3117
# only the root operation
2989
3118
#
2990
-
eval $save_scan_rows_returned;
2991
3119
2992
3120
explain extended select straight_join count(*) from t1 as x1
2993
3121
join t1 as x2 on x2.b = x1.a
@@ -3023,8 +3151,6 @@ select straight_join count(*) from t1 as x1
3023
3151
join t1 as x7 on x7.b = x1.a
3024
3152
where x3.a < x2.pk and x4.a < x3.pk;
3025
3153
3026
-
eval $compensate_scan_rows_returned;
3027
-
3028
3154
#############
3029
3155
# If we have an outer join, we can't create an artificial dep. 'through' the outer join.
3030
3156
# In this case the child scan can't be part of the pushed query.
@@ -3064,8 +3190,6 @@ select straight_join count(*) from t1 as x1
3064
3190
#
3065
3191
# Bushy execution is expected for these scans (x2 & x4) wrt. root (x1)
3066
3192
#
3067
-
eval $save_scan_rows_returned;
3068
-
3069
3193
explain extended
3070
3194
select straight_join count(*) from t1 as x1
3071
3195
join t1 as x2 on x2.b = x1.a
@@ -3080,8 +3204,6 @@ select straight_join count(*) from t1 as x1
3080
3204
join t1 as x2 on x2.b = x1.a
3081
3205
join t1 as x3 on x3.pk = x1.a join t1 as x4 on x4.b = x3.a;
3082
3206
3083
-
eval $compensate_scan_rows_returned;
3084
-
3085
3207
#############
3086
3208
# Test bushy lookups + 1scan,
3087
3209
# (Regression test for previous commit: http://lists.mysql.com/commits/117571)
@@ -3195,16 +3317,12 @@ explain select straight_join count(*) from t1 as x0
0 commit comments