65 lines
1.7 KiB
Plaintext
65 lines
1.7 KiB
Plaintext
Check that ndb_join_pushdown variable exists and is enabled
|
|
#####
|
|
# Create test table and data
|
|
create table t1 (
|
|
a int not null,
|
|
b int not null,
|
|
c int not null,
|
|
d int not null,
|
|
primary key (`a`,`b`)
|
|
) engine=ndbcluster;
|
|
insert into t1 values
|
|
(1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4),
|
|
(1,2,5,1), (1,3,1,2), (1,4,2,3),
|
|
(2,1,3,4), (2,3,4,5), (2,4,5,1),
|
|
(3,1,1,2), (3,2,2,3), (3,4,3,4),
|
|
(4,1,4,5), (4,2,5,1), (4,3,1,2);
|
|
####
|
|
# Check the basic pushed query
|
|
select * from t1
|
|
join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
|
|
|
|
####
|
|
# Check that operation is not pushed if it prevents 'join buffer'
|
|
select straight_join count(*)
|
|
from t1 as x1
|
|
join t1 as x2 on x1.d > x2.a + 1000
|
|
join t1 as x3 on x1.c=x3.a and x1.d=x3.b;
|
|
Expected push message found in EXPLAIN;
|
|
|
|
####
|
|
# Check that operation is not pushed if it prevents 'join buffer'
|
|
# even though other operation is pushed
|
|
select *
|
|
from t1 as x1
|
|
join t1 as x2 on x1.a=1 and x1.c=x2.a and x1.d=x2.b
|
|
join t1 as x3
|
|
join t1 as x4 where x4.a=x3.c and x4.b=x1.d;
|
|
Expected push message found in EXPLAIN;
|
|
|
|
drop table t1;
|
|
create table t1 (
|
|
a int primary key,
|
|
b int,
|
|
c int,
|
|
index(b,c)
|
|
) engine = ndb;
|
|
insert into t1 values (1,null, 2);
|
|
insert into t1 values (2,1, null);
|
|
insert into t1 values (3,2,2);
|
|
insert into t1 values (4,null, 2);
|
|
insert into t1 values (5,1, null);
|
|
insert into t1 values (6,2,2);
|
|
####
|
|
# The query contains a 'dynamic range'("Range checked for each
|
|
# record..") and access type can not be choosen at prepare time
|
|
# Make sure t2 is not pushed.
|
|
select *
|
|
from t1
|
|
join t1 as t2 on (t2.b = t1.b or t2.b = t1.a)
|
|
join t1 as t3 on t3.a = t2.a
|
|
join t1 as t4 on t4.a = t3.b /* index scan disguised as JT_ALL */;
|
|
Expected push message found in EXPLAIN;
|
|
|
|
drop table t1;
|