@@ -2096,6 +2096,7 @@ insert into t1 values (1, 2);
2096
2096
insert into t1 values (2, 3);
2097
2097
insert into t1 values (3, 1);
2098
2098
set ndb_join_pushdown=true;
2099
+ set autocommit=off;
2099
2100
explain extended
2100
2101
select *
2101
2102
from t1, t1 as t2
@@ -2113,12 +2114,17 @@ and t2.a = t1.b;
2113
2114
a b a b
2114
2115
1 2 2 3
2115
2116
3 1 1 2
2117
+ @ndb_execute_count:=VARIABLE_VALUE-@ndb_init_execute_count
2118
+ 3
2119
+ This should yield 3 executes (for now...buh)
2120
+ set autocommit=on;
2116
2121
drop table t1;
2117
2122
create table t1 (a int, b int, primary key(a)) engine = ndb;
2118
2123
insert into t1 values (1, 2);
2119
2124
insert into t1 values (2, 3);
2120
2125
insert into t1 values (3, 1);
2121
2126
set ndb_join_pushdown=true;
2127
+ set autocommit=off;
2122
2128
explain extended
2123
2129
select *
2124
2130
from t1, t1 as t2
@@ -2136,6 +2142,10 @@ and t2.a = t1.b;
2136
2142
a b a b
2137
2143
1 2 2 3
2138
2144
3 1 1 2
2145
+ @ndb_execute_count:=VARIABLE_VALUE-@ndb_init_execute_count
2146
+ 1
2147
+ This should yield 1 execute (but inefficient since it's based on scan)
2148
+ set autocommit=on;
2139
2149
explain extended
2140
2150
select *
2141
2151
from t1, t1 as t2
@@ -5468,6 +5478,38 @@ select count(*) from t1 as x1 join t1 as x2 on x1.b = x2.c;
5468
5478
count(*)
5469
5479
3
5470
5480
drop table t1;
5481
+ create table t1
5482
+ (a int not null,
5483
+ b int not null,
5484
+ c int not null,
5485
+ d int not null,
5486
+ primary key(a,b,c,d)) engine=ndb partition by key (b,c);
5487
+ insert into t1 values (0x4f, 0x4f, 0x4f, 0x4f);
5488
+ explain select * from t1 as x1
5489
+ join t1 as x2 on x1.c=0x4f and x2.a=0+x1.b and x2.b=x1.b
5490
+ join t1 as x3 on x3.a=x2.d and x3.b=x1.d and x3.c=x2.c;
5491
+ id select_type table type possible_keys key key_len ref rows Extra
5492
+ 1 SIMPLE x1 ALL NULL NULL NULL NULL 2 Using where with pushed condition
5493
+ 1 SIMPLE x2 ref PRIMARY PRIMARY 8 func,test.x1.b 1 Parent of 2 pushed join@1; Using where
5494
+ 1 SIMPLE x3 ref PRIMARY PRIMARY 12 test.x2.d,test.x1.d,test.x2.c 1 Child of 'x2' in pushed join@1
5495
+ select * from t1 as x1
5496
+ join t1 as x2 on x1.c=0x4f and x2.a=0+x1.b and x2.b=x1.b
5497
+ join t1 as x3 on x3.a=x2.c and x3.b=x1.d and x3.c=x2.c;
5498
+ a b c d a b c d a b c d
5499
+ 79 79 79 79 79 79 79 79 79 79 79 79
5500
+ explain select * from t1 as x1
5501
+ join t1 as x2 on x1.c=0x4f and x2.a=0+x1.b and x2.b=x1.b
5502
+ join t1 as x3 on x3.a=x2.d and x3.b=x1.d and x3.c=0x4f;
5503
+ id select_type table type possible_keys key key_len ref rows Extra
5504
+ 1 SIMPLE x1 ALL NULL NULL NULL NULL 2 Using where with pushed condition
5505
+ 1 SIMPLE x2 ref PRIMARY PRIMARY 8 func,test.x1.b 1 Parent of 2 pushed join@1; Using where
5506
+ 1 SIMPLE x3 ref PRIMARY PRIMARY 12 test.x2.d,test.x1.d,const 1 Child of 'x2' in pushed join@1
5507
+ select * from t1 as x1
5508
+ join t1 as x2 on x1.c=0x4f and x2.a=0+x1.b and x2.b=x1.b
5509
+ join t1 as x3 on x3.a=x2.c and x3.b=x1.d and x3.c=0x4f;
5510
+ a b c d a b c d a b c d
5511
+ 79 79 79 79 79 79 79 79 79 79 79 79
5512
+ drop table t1;
5471
5513
create temporary table spj_counts_at_end
5472
5514
select counter_name, sum(val) as val
5473
5515
from ndbinfo.counters
@@ -5484,10 +5526,10 @@ and spj_counts_at_end.counter_name <> 'READS_NOT_FOUND'
5484
5526
and spj_counts_at_end.counter_name <> 'SCAN_ROWS_RETURNED'
5485
5527
and spj_counts_at_end.counter_name <> 'SCAN_BATCHES_RETURNED';
5486
5528
counter_name spj_counts_at_end.val - spj_counts_at_startup.val
5487
- CONST_PRUNED_RANGE_SCANS_RECEIVED 6
5529
+ CONST_PRUNED_RANGE_SCANS_RECEIVED 8
5488
5530
LOCAL_TABLE_SCANS_SENT 250
5489
- PRUNED_RANGE_SCANS_RECEIVED 25
5490
- RANGE_SCANS_RECEIVED 726
5531
+ PRUNED_RANGE_SCANS_RECEIVED 27
5532
+ RANGE_SCANS_RECEIVED 730
5491
5533
READS_RECEIVED 58
5492
5534
TABLE_SCANS_RECEIVED 250
5493
5535
drop table spj_counts_at_startup;
@@ -5499,9 +5541,9 @@ pruned_scan_count
5499
5541
sorted_scan_count
5500
5542
35
5501
5543
pushed_queries_defined
5502
- 401
5544
+ 405
5503
5545
pushed_queries_dropped
5504
5546
9
5505
5547
pushed_queries_executed
5506
- 547
5548
+ 549
5507
5549
set ndb_join_pushdown = @save_ndb_join_pushdown;
0 commit comments