| 1 |
create table t1 ( |
| 2 |
a int, |
| 3 |
b int not null, |
| 4 |
c1 char(255) CHARSET latin1, |
| 5 |
c2 char(255) CHARSET latin1, |
| 6 |
key k1(b, c1, c2) |
| 7 |
) |
| 8 |
engine = ndb |
| 9 |
comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM"; |
| 10 |
insert into t1(a,b,c1,c2) values |
| 11 |
(0, 0, 0, 0), |
| 12 |
(1, 1, 1, 1), |
| 13 |
(2, 2, 2, 1), |
| 14 |
(3, 3, 3, 3), |
| 15 |
(4, 4, 4, 4), |
| 16 |
(5, 5, 5, 5), |
| 17 |
(6, 6, 6, 6), |
| 18 |
(7, 7, 7, 7), |
| 19 |
(8, 8, 8, 8), |
| 20 |
(9, 9, 9, 9); |
| 21 |
insert into t1 select a + 10, b, c1, c2 from t1; |
| 22 |
insert into t1 select a + 20, b, c1, c2 from t1; |
| 23 |
insert into t1 select a + 40, b, c1, c2 from t1; |
| 24 |
insert into t1 select a + 80, b, c1, c2 from t1; |
| 25 |
insert into t1 select a + 160, b, c1, c2 from t1; |
| 26 |
insert into t1 select a + 320, b, c1, c2 from t1; |
| 27 |
insert into t1 select a + 640, b, c1, c2 from t1; |
| 28 |
insert into t1 select a + 1280, b, c1, c2 from t1; |
| 29 |
explain |
| 30 |
select * from t1 as x, t1 as y |
| 31 |
where y.b = x.a and y.c1 = x.c1 and y.c2 = x.c1; |
| 32 |
id select_type table partitions type possible_keys key key_len ref rows filtered Extra |
| 33 |
1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 2560 100.00 Parent of 2 pushed join@1; Using pushed condition ((`test`.`x`.`a` is not null) and (`test`.`x`.`c1` is not null)) |
| 34 |
1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 ref k1 k1 516 test.x.a,test.x.c1,test.x.c1 10 100.00 Child of 'x' in pushed join@1 |
| 35 |
Warnings: |
| 36 |
Note 1003 /* select#1 */ select `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c1` AS `c1`,`test`.`x`.`c2` AS `c2`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c1` AS `c1`,`test`.`y`.`c2` AS `c2` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`c1` = `test`.`x`.`c1`) and (`test`.`y`.`c2` = `test`.`x`.`c1`) and (`test`.`y`.`b` = `test`.`x`.`a`)) |
| 37 |
select count(*) from t1 as x, t1 as y |
| 38 |
where y.b = x.a and y.c1 = x.c1 and y.c2 = x.c1; |
| 39 |
count(*) |
| 40 |
2304 |
| 41 |
drop table t1; |