| 1 |
create table parent(a int primary key, b int, key(b)) engine=ndb |
| 2 |
comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM"; |
| 3 |
create table child(a int primary key, b int) engine=ndb |
| 4 |
comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM"; |
| 5 |
insert into parent values (1,1), (2,2), (3,3), (4,4); |
| 6 |
insert into parent select a+4, b+4 from parent; |
| 7 |
insert into parent select a+8, b+8 from parent; |
| 8 |
insert into parent select a+16, b+16 from parent; |
| 9 |
insert into parent select a+32, b+32 from parent; |
| 10 |
insert into parent select a+64, b+64 from parent; |
| 11 |
insert into parent select a+128, b+128 from parent; |
| 12 |
insert into parent select a+256, b+256 from parent; |
| 13 |
insert into parent select a+512, b+512 from parent; |
| 14 |
insert into parent select a+1024, b+1024 from parent; |
| 15 |
insert into parent select a+2048, b+2048 from parent; |
| 16 |
insert into parent select a+4096, b+4096 from parent; |
| 17 |
insert into child select * from parent; |
| 18 |
set ndb_join_pushdown = false; |
| 19 |
explain |
| 20 |
select count(*) |
| 21 |
from parent join child |
| 22 |
on (parent.b = child.a) |
| 23 |
where parent.b > 5; |
| 24 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 25 |
1 SIMPLE parent p0,p1,p2,p3,p4,p5,p6,p7 range b b 5 NULL 819 100.00 Using pushed condition ((`test`.`parent`.`b` > 5) and (`test`.`parent`.`b` is not null)); Using MRR |
| 26 |
1 SIMPLE child p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.parent.b 1 100.00 NULL |
| 27 |
Warnings: |
| 28 |
Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`parent` join `test`.`child` where ((`test`.`child`.`a` = `test`.`parent`.`b`) and (`test`.`parent`.`b` > 5)) |
| 29 |
Starting engines... |
| 30 |
call queryload(10); |
| 31 |
call queryload(10); |
| 32 |
call queryload(10); |
| 33 |
call queryload(10); |
| 34 |
Beginning alter table child partition by key(a) partitions 4; |
| 35 |
call mtr.add_suppression("Failed to acquire exclusive metadata lock"); |
| 36 |
call mtr.add_suppression("Failed to update table definition in DD"); |
| 37 |
call mtr.add_suppression("Distribution of ALTER TABLE 'test.child' failed"); |
| 38 |
alter table child partition by key(a) partitions 4; |
| 39 |
Completed. |
| 40 |
Ending test. Droping table parent |
| 41 |
drop table parent; |
| 42 |
drop table child; |
| 43 |
drop procedure queryload; |