[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@13.59.116.142: ~ $
drop table if exists t1,t2,t3,t4;
create temporary table spj_counts_at_startup 
select counter_name, sum(val) as val 
from ndbinfo.counters 
where block_name='DBSPJ' 
group by counter_name;
create temporary table spj_save_counts like spj_counts_at_startup;
insert into spj_save_counts values ('SCAN_ROWS_RETURNED', 0);
set @save_ndb_join_pushdown = @@session.ndb_join_pushdown;
set ndb_join_pushdown = true;
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);
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`))
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1
1	3	1	2	3	1	1	2
1	4	2	3	4	2	5	1
2	1	3	4	1	3	1	2
2	2	2	2	2	2	2	2
2	3	4	5	3	4	3	4
3	1	1	2	1	1	1	1
3	2	2	3	2	2	2	2
3	3	3	3	3	3	3	3
3	4	3	4	4	3	1	2
4	1	4	5	1	4	2	3
4	3	1	2	3	1	1	2
4	4	4	4	4	4	4	4
explain extended 
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;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	16	100.00	
1	SIMPLE	x2	ALL	NULL	NULL	NULL	NULL	16	100.00	Using where; Using join buffer (Block Nested Loop)
1	SIMPLE	x3	eq_ref	PRIMARY	PRIMARY	8	test.x1.c,test.x1.d	1	100.00	
Warnings:
Note	9999	Can't push table 'x2' as child, 'type' must be a 'ref' access
Note	9999	Cannot push table 'x3' as child of table 'x1'. Doing so would prevent using join buffer for table 'x2'.
Note	9999	Cannot push table 'x3' as child of 'x2', since it referes to column 'x1.c' which will be stored in a join buffer.
Note	1003	/* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x3`.`b` = `test`.`x1`.`d`) and (`test`.`x3`.`a` = `test`.`x1`.`c`) and (`test`.`x1`.`d` > (`test`.`x2`.`a` + 1000)))
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;
count(*)
0
explain extended 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;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	8	test.x1.c,test.x1.d	1	100.00	Child of 'x1' in pushed join@1
1	SIMPLE	x3	ALL	NULL	NULL	NULL	NULL	16	100.00	Using join buffer (Block Nested Loop)
1	SIMPLE	x4	eq_ref	PRIMARY	PRIMARY	8	test.x3.c,test.x1.d	1	100.00	
Warnings:
Note	9999	Can't push table 'x3' as child, 'type' must be a 'ref' access
Note	9999	Cannot push table 'x4' as child of table 'x1'. Doing so would prevent using join buffer for table 'x3'.
Note	9999	Cannot push table 'x4' as child of 'x3', since it referes to column 'x1.d' which will be stored in a join buffer.
Note	1003	/* select#1 */ select `test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x1`.`c` AS `c`,`test`.`x1`.`d` AS `d`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b`,`test`.`x2`.`c` AS `c`,`test`.`x2`.`d` AS `d`,`test`.`x3`.`a` AS `a`,`test`.`x3`.`b` AS `b`,`test`.`x3`.`c` AS `c`,`test`.`x3`.`d` AS `d`,`test`.`x4`.`a` AS `a`,`test`.`x4`.`b` AS `b`,`test`.`x4`.`c` AS `c`,`test`.`x4`.`d` AS `d` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` join `test`.`t1` `x4` where ((`test`.`x2`.`a` = `test`.`x1`.`c`) and (`test`.`x1`.`a` = 1) and (`test`.`x2`.`b` = `test`.`x1`.`d`) and (`test`.`x4`.`b` = `test`.`x1`.`d`) and (`test`.`x4`.`a` = `test`.`x3`.`c`))
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;
a	b	c	d	a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1
1	1	1	1	1	1	1	1	1	3	1	2	1	1	1	1
1	1	1	1	1	1	1	1	1	4	2	3	2	1	3	4
1	1	1	1	1	1	1	1	2	1	3	4	3	1	1	2
1	1	1	1	1	1	1	1	2	2	2	2	2	1	3	4
1	1	1	1	1	1	1	1	2	3	4	5	4	1	4	5
1	1	1	1	1	1	1	1	3	1	1	2	1	1	1	1
1	1	1	1	1	1	1	1	3	2	2	3	2	1	3	4
1	1	1	1	1	1	1	1	3	3	3	3	3	1	1	2
1	1	1	1	1	1	1	1	3	4	3	4	3	1	1	2
1	1	1	1	1	1	1	1	4	1	4	5	4	1	4	5
1	1	1	1	1	1	1	1	4	3	1	2	1	1	1	1
1	1	1	1	1	1	1	1	4	4	4	4	4	1	4	5
1	3	1	2	1	2	5	1	1	1	1	1	1	2	5	1
1	3	1	2	1	2	5	1	1	3	1	2	1	2	5	1
1	3	1	2	1	2	5	1	1	4	2	3	2	2	2	2
1	3	1	2	1	2	5	1	2	1	3	4	3	2	2	3
1	3	1	2	1	2	5	1	2	2	2	2	2	2	2	2
1	3	1	2	1	2	5	1	2	3	4	5	4	2	5	1
1	3	1	2	1	2	5	1	3	1	1	2	1	2	5	1
1	3	1	2	1	2	5	1	3	2	2	3	2	2	2	2
1	3	1	2	1	2	5	1	3	3	3	3	3	2	2	3
1	3	1	2	1	2	5	1	3	4	3	4	3	2	2	3
1	3	1	2	1	2	5	1	4	1	4	5	4	2	5	1
1	3	1	2	1	2	5	1	4	3	1	2	1	2	5	1
1	3	1	2	1	2	5	1	4	4	4	4	4	2	5	1
1	4	2	3	2	3	4	5	1	1	1	1	1	3	1	2
1	4	2	3	2	3	4	5	1	3	1	2	1	3	1	2
1	4	2	3	2	3	4	5	1	4	2	3	2	3	4	5
1	4	2	3	2	3	4	5	2	1	3	4	3	3	3	3
1	4	2	3	2	3	4	5	2	2	2	2	2	3	4	5
1	4	2	3	2	3	4	5	2	3	4	5	4	3	1	2
1	4	2	3	2	3	4	5	3	1	1	2	1	3	1	2
1	4	2	3	2	3	4	5	3	2	2	3	2	3	4	5
1	4	2	3	2	3	4	5	3	3	3	3	3	3	3	3
1	4	2	3	2	3	4	5	3	4	3	4	3	3	3	3
1	4	2	3	2	3	4	5	4	1	4	5	4	3	1	2
1	4	2	3	2	3	4	5	4	3	1	2	1	3	1	2
1	4	2	3	2	3	4	5	4	4	4	4	4	3	1	2
explain extended
select *
from t1
left join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` left join `test`.`t1` `t2` on(((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t1`.`c`))) where 1
select *
from t1
left join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1
1	2	5	1	NULL	NULL	NULL	NULL
1	3	1	2	3	1	1	2
1	4	2	3	4	2	5	1
2	1	3	4	1	3	1	2
2	2	2	2	2	2	2	2
2	3	4	5	3	4	3	4
2	4	5	1	NULL	NULL	NULL	NULL
3	1	1	2	1	1	1	1
3	2	2	3	2	2	2	2
3	3	3	3	3	3	3	3
3	4	3	4	4	3	1	2
4	1	4	5	1	4	2	3
4	2	5	1	NULL	NULL	NULL	NULL
4	3	1	2	3	1	1	2
4	4	4	4	4	4	4	4
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`))
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	3	1	2	3	1	1	2	3	1	1	2
1	4	2	3	4	2	5	1	4	2	5	1
2	1	3	4	1	3	1	2	1	3	1	2
2	2	2	2	2	2	2	2	2	2	2	2
2	3	4	5	3	4	3	4	3	4	3	4
3	1	1	2	1	1	1	1	1	1	1	1
3	2	2	3	2	2	2	2	2	2	2	2
3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	4	3	1	2	4	3	1	2
4	1	4	5	1	4	2	3	1	4	2	3
4	3	1	2	3	1	1	2	3	1	1	2
4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
left join t1 as t3 on t3.a = t2.a and t3.b = t2.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t2.a,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` left join `test`.`t1` `t3` on(((`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`a` = `test`.`t1`.`b`))) where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`))
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
left join t1 as t3 on t3.a = t2.a and t3.b = t2.b;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	3	1	2	3	1	1	2	3	1	1	2
1	4	2	3	4	2	5	1	4	2	5	1
2	1	3	4	1	3	1	2	1	3	1	2
2	2	2	2	2	2	2	2	2	2	2	2
2	3	4	5	3	4	3	4	3	4	3	4
3	1	1	2	1	1	1	1	1	1	1	1
3	2	2	3	2	2	2	2	2	2	2	2
3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	4	3	1	2	4	3	1	2
4	1	4	5	1	4	2	3	1	4	2	3
4	3	1	2	3	1	1	2	3	1	1	2
4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select *
from t1
left join t1 as t2 on t2.a = t1.b and t2.b = t1.c
left join t1 as t3 on t3.a = t2.a and t3.b = t2.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t2.a,test.t2.b	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` left join `test`.`t1` `t2` on(((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`b` = `test`.`t1`.`c`))) left join `test`.`t1` `t3` on(((`test`.`t3`.`a` = `test`.`t2`.`a`) and (`test`.`t3`.`b` = `test`.`t2`.`b`))) where 1
select *
from t1
left join t1 as t2 on t2.a = t1.b and t2.b = t1.c
left join t1 as t3 on t3.a = t2.a and t3.b = t2.b;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	2	5	1	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
1	3	1	2	3	1	1	2	3	1	1	2
1	4	2	3	4	2	5	1	4	2	5	1
2	1	3	4	1	3	1	2	1	3	1	2
2	2	2	2	2	2	2	2	2	2	2	2
2	3	4	5	3	4	3	4	3	4	3	4
2	4	5	1	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
3	1	1	2	1	1	1	1	1	1	1	1
3	2	2	3	2	2	2	2	2	2	2	2
3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	4	3	1	2	4	3	1	2
4	1	4	5	1	4	2	3	1	4	2	3
4	2	5	1	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
4	3	1	2	3	1	1	2	3	1	1	2
4	4	4	4	4	4	4	4	4	4	4	4
set ndb_join_pushdown=true;
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d procedure analyse();
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	
Warnings:
Note	9999	Table 't1' is not pushable: 'PROCEDURE'-clause post processing cannot be pushed.
Note	9999	Table 't2' is not pushable: 'PROCEDURE'-clause post processing cannot be pushed.
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`b` = `test`.`t1`.`d`) and (`test`.`t2`.`a` = `test`.`t1`.`c`))
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 2 and t1.b = 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`b` = `test`.`t1`.`d`) and (`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t1`.`b` = 3) and (`test`.`t1`.`a` = 2))
select *
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 2 and t1.b = 3;
a	b	c	d	a	b	c	d
explain extended
select *
from t1
left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 2 and t1.b = 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` left join `test`.`t1` `t2` on(((`test`.`t2`.`b` = `test`.`t1`.`d`) and (`test`.`t2`.`a` = `test`.`t1`.`c`))) where ((`test`.`t1`.`b` = 3) and (`test`.`t1`.`a` = 2))
select *
from t1
left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 2 and t1.b = 3;
a	b	c	d	a	b	c	d
2	3	4	5	NULL	NULL	NULL	NULL
explain extended
select *
from t1
left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 2 and t1.b = 3
order by t1.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	Parent of 2 pushed join@1; Using where; Using filesort
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` left join `test`.`t1` `t2` on(((`test`.`t2`.`b` = `test`.`t1`.`d`) and (`test`.`t2`.`a` = `test`.`t1`.`c`))) where ((`test`.`t1`.`b` = 3) and (`test`.`t1`.`a` = 2)) order by `test`.`t1`.`c`
select *
from t1
left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 2 and t1.b = 3
order by t1.c;
a	b	c	d	a	b	c	d
2	3	4	5	NULL	NULL	NULL	NULL
set ndb_join_pushdown=false;
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 2 and t1.b = 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
Warnings:
Note	1003	/* select#1 */ select '2' AS `a`,'3' AS `b`,'4' AS `c`,'5' AS `d`,NULL AS `a`,NULL AS `b`,NULL AS `c`,NULL AS `d` from `test`.`t1` join `test`.`t1` `t2` where 0
select *
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 2 and t1.b = 3;
a	b	c	d	a	b	c	d
explain extended
select *
from t1
left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 2 and t1.b = 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	
1	SIMPLE	t2	const	PRIMARY	PRIMARY	8	const,const	0	0.00	unique row not found
Warnings:
Note	1003	/* select#1 */ select '2' AS `a`,'3' AS `b`,'4' AS `c`,'5' AS `d`,NULL AS `a`,NULL AS `b`,NULL AS `c`,NULL AS `d` from `test`.`t1` left join `test`.`t1` `t2` on((multiple equal('4', NULL) and multiple equal('5', NULL))) where 1
select *
from t1
left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 2 and t1.b = 3;
a	b	c	d	a	b	c	d
2	3	4	5	NULL	NULL	NULL	NULL
set ndb_join_pushdown=true;
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 1 and t1.b = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`b` = `test`.`t1`.`d`) and (`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t1`.`b` = 1) and (`test`.`t1`.`a` = 1))
select *
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 1 and t1.b = 1;
a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1
explain extended
select *
from t1
left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 1 and t1.b = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` left join `test`.`t1` `t2` on(((`test`.`t2`.`b` = `test`.`t1`.`d`) and (`test`.`t2`.`a` = `test`.`t1`.`c`))) where ((`test`.`t1`.`b` = 1) and (`test`.`t1`.`a` = 1))
select *
from t1
left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 1 and t1.b = 1;
a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1
set ndb_join_pushdown=false;
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 1 and t1.b = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	
1	SIMPLE	t2	const	PRIMARY	PRIMARY	8	const,const	1	100.00	
Warnings:
Note	1003	/* select#1 */ select '1' AS `a`,'1' AS `b`,'1' AS `c`,'1' AS `d`,'1' AS `a`,'1' AS `b`,'1' AS `c`,'1' AS `d` from `test`.`t1` join `test`.`t1` `t2` where 1
select *
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 1 and t1.b = 1;
a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1
explain extended
select *
from t1
left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 1 and t1.b = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	
1	SIMPLE	t2	const	PRIMARY	PRIMARY	8	const,const	1	100.00	
Warnings:
Note	1003	/* select#1 */ select '1' AS `a`,'1' AS `b`,'1' AS `c`,'1' AS `d`,'1' AS `a`,'1' AS `b`,'1' AS `c`,'1' AS `d` from `test`.`t1` left join `test`.`t1` `t2` on((multiple equal('1', '1') and multiple equal('1', '1'))) where 1
select *
from t1
left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.a = 1 and t1.b = 1;
a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1
set ndb_join_pushdown=true;
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.c
join t1 as t3 on t3.a = t1.c and t3.b = t2.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t2.b	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t3`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t3`.`a` = `test`.`t1`.`c`))
select *
from t1
join t1 as t2 on t2.a = t1.c
join t1 as t3 on t3.a = t1.c and t3.b = t2.b;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	1	1	1	1	2	5	1	1	2	5	1
1	1	1	1	1	3	1	2	1	3	1	2
1	1	1	1	1	4	2	3	1	4	2	3
1	3	1	2	1	1	1	1	1	1	1	1
1	3	1	2	1	2	5	1	1	2	5	1
1	3	1	2	1	3	1	2	1	3	1	2
1	3	1	2	1	4	2	3	1	4	2	3
1	4	2	3	2	1	3	4	2	1	3	4
1	4	2	3	2	2	2	2	2	2	2	2
1	4	2	3	2	3	4	5	2	3	4	5
1	4	2	3	2	4	5	1	2	4	5	1
2	1	3	4	3	1	1	2	3	1	1	2
2	1	3	4	3	2	2	3	3	2	2	3
2	1	3	4	3	3	3	3	3	3	3	3
2	1	3	4	3	4	3	4	3	4	3	4
2	2	2	2	2	1	3	4	2	1	3	4
2	2	2	2	2	2	2	2	2	2	2	2
2	2	2	2	2	3	4	5	2	3	4	5
2	2	2	2	2	4	5	1	2	4	5	1
2	3	4	5	4	1	4	5	4	1	4	5
2	3	4	5	4	2	5	1	4	2	5	1
2	3	4	5	4	3	1	2	4	3	1	2
2	3	4	5	4	4	4	4	4	4	4	4
3	1	1	2	1	1	1	1	1	1	1	1
3	1	1	2	1	2	5	1	1	2	5	1
3	1	1	2	1	3	1	2	1	3	1	2
3	1	1	2	1	4	2	3	1	4	2	3
3	2	2	3	2	1	3	4	2	1	3	4
3	2	2	3	2	2	2	2	2	2	2	2
3	2	2	3	2	3	4	5	2	3	4	5
3	2	2	3	2	4	5	1	2	4	5	1
3	3	3	3	3	1	1	2	3	1	1	2
3	3	3	3	3	2	2	3	3	2	2	3
3	3	3	3	3	3	3	3	3	3	3	3
3	3	3	3	3	4	3	4	3	4	3	4
3	4	3	4	3	1	1	2	3	1	1	2
3	4	3	4	3	2	2	3	3	2	2	3
3	4	3	4	3	3	3	3	3	3	3	3
3	4	3	4	3	4	3	4	3	4	3	4
4	1	4	5	4	1	4	5	4	1	4	5
4	1	4	5	4	2	5	1	4	2	5	1
4	1	4	5	4	3	1	2	4	3	1	2
4	1	4	5	4	4	4	4	4	4	4	4
4	3	1	2	1	1	1	1	1	1	1	1
4	3	1	2	1	2	5	1	1	2	5	1
4	3	1	2	1	3	1	2	1	3	1	2
4	3	1	2	1	4	2	3	1	4	2	3
4	4	4	4	4	1	4	5	4	1	4	5
4	4	4	4	4	2	5	1	4	2	5	1
4	4	4	4	4	3	1	2	4	3	1	2
4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select straight_join *
from (t1 as x cross join t1 as y)
join t1 as z on z.a=x.a and z.b=y.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	
1	SIMPLE	y	ALL	NULL	NULL	NULL	NULL	16	100.00	Using join buffer (Block Nested Loop)
1	SIMPLE	z	eq_ref	PRIMARY	PRIMARY	8	test.x.a,test.y.b	1	100.00	
Warnings:
Note	9999	Can't push table 'y' as child, 'type' must be a 'ref' access
Note	9999	Cannot push table 'z' as child of table 'x'. Doing so would prevent using join buffer for table 'y'.
Note	9999	Cannot push table 'z' as child of 'y', since it referes to column 'x.a' which will be stored in a join buffer.
Note	1003	/* select#1 */ select straight_join `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`x`.`d` AS `d`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c`,`test`.`y`.`d` AS `d`,`test`.`z`.`a` AS `a`,`test`.`z`.`b` AS `b`,`test`.`z`.`c` AS `c`,`test`.`z`.`d` AS `d` from `test`.`t1` `x` join `test`.`t1` `y` join `test`.`t1` `z` where ((`test`.`z`.`b` = `test`.`y`.`b`) and (`test`.`z`.`a` = `test`.`x`.`a`))
select straight_join *
from (t1 as x cross join t1 as y)
join t1 as z on z.a=x.a and z.b=y.b;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	1	1	1	1	2	5	1	1	2	5	1
1	1	1	1	1	3	1	2	1	3	1	2
1	1	1	1	1	4	2	3	1	4	2	3
1	1	1	1	2	1	3	4	1	1	1	1
1	1	1	1	2	2	2	2	1	2	5	1
1	1	1	1	2	3	4	5	1	3	1	2
1	1	1	1	2	4	5	1	1	4	2	3
1	1	1	1	3	1	1	2	1	1	1	1
1	1	1	1	3	2	2	3	1	2	5	1
1	1	1	1	3	3	3	3	1	3	1	2
1	1	1	1	3	4	3	4	1	4	2	3
1	1	1	1	4	1	4	5	1	1	1	1
1	1	1	1	4	2	5	1	1	2	5	1
1	1	1	1	4	3	1	2	1	3	1	2
1	1	1	1	4	4	4	4	1	4	2	3
1	2	5	1	1	1	1	1	1	1	1	1
1	2	5	1	1	2	5	1	1	2	5	1
1	2	5	1	1	3	1	2	1	3	1	2
1	2	5	1	1	4	2	3	1	4	2	3
1	2	5	1	2	1	3	4	1	1	1	1
1	2	5	1	2	2	2	2	1	2	5	1
1	2	5	1	2	3	4	5	1	3	1	2
1	2	5	1	2	4	5	1	1	4	2	3
1	2	5	1	3	1	1	2	1	1	1	1
1	2	5	1	3	2	2	3	1	2	5	1
1	2	5	1	3	3	3	3	1	3	1	2
1	2	5	1	3	4	3	4	1	4	2	3
1	2	5	1	4	1	4	5	1	1	1	1
1	2	5	1	4	2	5	1	1	2	5	1
1	2	5	1	4	3	1	2	1	3	1	2
1	2	5	1	4	4	4	4	1	4	2	3
1	3	1	2	1	1	1	1	1	1	1	1
1	3	1	2	1	2	5	1	1	2	5	1
1	3	1	2	1	3	1	2	1	3	1	2
1	3	1	2	1	4	2	3	1	4	2	3
1	3	1	2	2	1	3	4	1	1	1	1
1	3	1	2	2	2	2	2	1	2	5	1
1	3	1	2	2	3	4	5	1	3	1	2
1	3	1	2	2	4	5	1	1	4	2	3
1	3	1	2	3	1	1	2	1	1	1	1
1	3	1	2	3	2	2	3	1	2	5	1
1	3	1	2	3	3	3	3	1	3	1	2
1	3	1	2	3	4	3	4	1	4	2	3
1	3	1	2	4	1	4	5	1	1	1	1
1	3	1	2	4	2	5	1	1	2	5	1
1	3	1	2	4	3	1	2	1	3	1	2
1	3	1	2	4	4	4	4	1	4	2	3
1	4	2	3	1	1	1	1	1	1	1	1
1	4	2	3	1	2	5	1	1	2	5	1
1	4	2	3	1	3	1	2	1	3	1	2
1	4	2	3	1	4	2	3	1	4	2	3
1	4	2	3	2	1	3	4	1	1	1	1
1	4	2	3	2	2	2	2	1	2	5	1
1	4	2	3	2	3	4	5	1	3	1	2
1	4	2	3	2	4	5	1	1	4	2	3
1	4	2	3	3	1	1	2	1	1	1	1
1	4	2	3	3	2	2	3	1	2	5	1
1	4	2	3	3	3	3	3	1	3	1	2
1	4	2	3	3	4	3	4	1	4	2	3
1	4	2	3	4	1	4	5	1	1	1	1
1	4	2	3	4	2	5	1	1	2	5	1
1	4	2	3	4	3	1	2	1	3	1	2
1	4	2	3	4	4	4	4	1	4	2	3
2	1	3	4	1	1	1	1	2	1	3	4
2	1	3	4	1	2	5	1	2	2	2	2
2	1	3	4	1	3	1	2	2	3	4	5
2	1	3	4	1	4	2	3	2	4	5	1
2	1	3	4	2	1	3	4	2	1	3	4
2	1	3	4	2	2	2	2	2	2	2	2
2	1	3	4	2	3	4	5	2	3	4	5
2	1	3	4	2	4	5	1	2	4	5	1
2	1	3	4	3	1	1	2	2	1	3	4
2	1	3	4	3	2	2	3	2	2	2	2
2	1	3	4	3	3	3	3	2	3	4	5
2	1	3	4	3	4	3	4	2	4	5	1
2	1	3	4	4	1	4	5	2	1	3	4
2	1	3	4	4	2	5	1	2	2	2	2
2	1	3	4	4	3	1	2	2	3	4	5
2	1	3	4	4	4	4	4	2	4	5	1
2	2	2	2	1	1	1	1	2	1	3	4
2	2	2	2	1	2	5	1	2	2	2	2
2	2	2	2	1	3	1	2	2	3	4	5
2	2	2	2	1	4	2	3	2	4	5	1
2	2	2	2	2	1	3	4	2	1	3	4
2	2	2	2	2	2	2	2	2	2	2	2
2	2	2	2	2	3	4	5	2	3	4	5
2	2	2	2	2	4	5	1	2	4	5	1
2	2	2	2	3	1	1	2	2	1	3	4
2	2	2	2	3	2	2	3	2	2	2	2
2	2	2	2	3	3	3	3	2	3	4	5
2	2	2	2	3	4	3	4	2	4	5	1
2	2	2	2	4	1	4	5	2	1	3	4
2	2	2	2	4	2	5	1	2	2	2	2
2	2	2	2	4	3	1	2	2	3	4	5
2	2	2	2	4	4	4	4	2	4	5	1
2	3	4	5	1	1	1	1	2	1	3	4
2	3	4	5	1	2	5	1	2	2	2	2
2	3	4	5	1	3	1	2	2	3	4	5
2	3	4	5	1	4	2	3	2	4	5	1
2	3	4	5	2	1	3	4	2	1	3	4
2	3	4	5	2	2	2	2	2	2	2	2
2	3	4	5	2	3	4	5	2	3	4	5
2	3	4	5	2	4	5	1	2	4	5	1
2	3	4	5	3	1	1	2	2	1	3	4
2	3	4	5	3	2	2	3	2	2	2	2
2	3	4	5	3	3	3	3	2	3	4	5
2	3	4	5	3	4	3	4	2	4	5	1
2	3	4	5	4	1	4	5	2	1	3	4
2	3	4	5	4	2	5	1	2	2	2	2
2	3	4	5	4	3	1	2	2	3	4	5
2	3	4	5	4	4	4	4	2	4	5	1
2	4	5	1	1	1	1	1	2	1	3	4
2	4	5	1	1	2	5	1	2	2	2	2
2	4	5	1	1	3	1	2	2	3	4	5
2	4	5	1	1	4	2	3	2	4	5	1
2	4	5	1	2	1	3	4	2	1	3	4
2	4	5	1	2	2	2	2	2	2	2	2
2	4	5	1	2	3	4	5	2	3	4	5
2	4	5	1	2	4	5	1	2	4	5	1
2	4	5	1	3	1	1	2	2	1	3	4
2	4	5	1	3	2	2	3	2	2	2	2
2	4	5	1	3	3	3	3	2	3	4	5
2	4	5	1	3	4	3	4	2	4	5	1
2	4	5	1	4	1	4	5	2	1	3	4
2	4	5	1	4	2	5	1	2	2	2	2
2	4	5	1	4	3	1	2	2	3	4	5
2	4	5	1	4	4	4	4	2	4	5	1
3	1	1	2	1	1	1	1	3	1	1	2
3	1	1	2	1	2	5	1	3	2	2	3
3	1	1	2	1	3	1	2	3	3	3	3
3	1	1	2	1	4	2	3	3	4	3	4
3	1	1	2	2	1	3	4	3	1	1	2
3	1	1	2	2	2	2	2	3	2	2	3
3	1	1	2	2	3	4	5	3	3	3	3
3	1	1	2	2	4	5	1	3	4	3	4
3	1	1	2	3	1	1	2	3	1	1	2
3	1	1	2	3	2	2	3	3	2	2	3
3	1	1	2	3	3	3	3	3	3	3	3
3	1	1	2	3	4	3	4	3	4	3	4
3	1	1	2	4	1	4	5	3	1	1	2
3	1	1	2	4	2	5	1	3	2	2	3
3	1	1	2	4	3	1	2	3	3	3	3
3	1	1	2	4	4	4	4	3	4	3	4
3	2	2	3	1	1	1	1	3	1	1	2
3	2	2	3	1	2	5	1	3	2	2	3
3	2	2	3	1	3	1	2	3	3	3	3
3	2	2	3	1	4	2	3	3	4	3	4
3	2	2	3	2	1	3	4	3	1	1	2
3	2	2	3	2	2	2	2	3	2	2	3
3	2	2	3	2	3	4	5	3	3	3	3
3	2	2	3	2	4	5	1	3	4	3	4
3	2	2	3	3	1	1	2	3	1	1	2
3	2	2	3	3	2	2	3	3	2	2	3
3	2	2	3	3	3	3	3	3	3	3	3
3	2	2	3	3	4	3	4	3	4	3	4
3	2	2	3	4	1	4	5	3	1	1	2
3	2	2	3	4	2	5	1	3	2	2	3
3	2	2	3	4	3	1	2	3	3	3	3
3	2	2	3	4	4	4	4	3	4	3	4
3	3	3	3	1	1	1	1	3	1	1	2
3	3	3	3	1	2	5	1	3	2	2	3
3	3	3	3	1	3	1	2	3	3	3	3
3	3	3	3	1	4	2	3	3	4	3	4
3	3	3	3	2	1	3	4	3	1	1	2
3	3	3	3	2	2	2	2	3	2	2	3
3	3	3	3	2	3	4	5	3	3	3	3
3	3	3	3	2	4	5	1	3	4	3	4
3	3	3	3	3	1	1	2	3	1	1	2
3	3	3	3	3	2	2	3	3	2	2	3
3	3	3	3	3	3	3	3	3	3	3	3
3	3	3	3	3	4	3	4	3	4	3	4
3	3	3	3	4	1	4	5	3	1	1	2
3	3	3	3	4	2	5	1	3	2	2	3
3	3	3	3	4	3	1	2	3	3	3	3
3	3	3	3	4	4	4	4	3	4	3	4
3	4	3	4	1	1	1	1	3	1	1	2
3	4	3	4	1	2	5	1	3	2	2	3
3	4	3	4	1	3	1	2	3	3	3	3
3	4	3	4	1	4	2	3	3	4	3	4
3	4	3	4	2	1	3	4	3	1	1	2
3	4	3	4	2	2	2	2	3	2	2	3
3	4	3	4	2	3	4	5	3	3	3	3
3	4	3	4	2	4	5	1	3	4	3	4
3	4	3	4	3	1	1	2	3	1	1	2
3	4	3	4	3	2	2	3	3	2	2	3
3	4	3	4	3	3	3	3	3	3	3	3
3	4	3	4	3	4	3	4	3	4	3	4
3	4	3	4	4	1	4	5	3	1	1	2
3	4	3	4	4	2	5	1	3	2	2	3
3	4	3	4	4	3	1	2	3	3	3	3
3	4	3	4	4	4	4	4	3	4	3	4
4	1	4	5	1	1	1	1	4	1	4	5
4	1	4	5	1	2	5	1	4	2	5	1
4	1	4	5	1	3	1	2	4	3	1	2
4	1	4	5	1	4	2	3	4	4	4	4
4	1	4	5	2	1	3	4	4	1	4	5
4	1	4	5	2	2	2	2	4	2	5	1
4	1	4	5	2	3	4	5	4	3	1	2
4	1	4	5	2	4	5	1	4	4	4	4
4	1	4	5	3	1	1	2	4	1	4	5
4	1	4	5	3	2	2	3	4	2	5	1
4	1	4	5	3	3	3	3	4	3	1	2
4	1	4	5	3	4	3	4	4	4	4	4
4	1	4	5	4	1	4	5	4	1	4	5
4	1	4	5	4	2	5	1	4	2	5	1
4	1	4	5	4	3	1	2	4	3	1	2
4	1	4	5	4	4	4	4	4	4	4	4
4	2	5	1	1	1	1	1	4	1	4	5
4	2	5	1	1	2	5	1	4	2	5	1
4	2	5	1	1	3	1	2	4	3	1	2
4	2	5	1	1	4	2	3	4	4	4	4
4	2	5	1	2	1	3	4	4	1	4	5
4	2	5	1	2	2	2	2	4	2	5	1
4	2	5	1	2	3	4	5	4	3	1	2
4	2	5	1	2	4	5	1	4	4	4	4
4	2	5	1	3	1	1	2	4	1	4	5
4	2	5	1	3	2	2	3	4	2	5	1
4	2	5	1	3	3	3	3	4	3	1	2
4	2	5	1	3	4	3	4	4	4	4	4
4	2	5	1	4	1	4	5	4	1	4	5
4	2	5	1	4	2	5	1	4	2	5	1
4	2	5	1	4	3	1	2	4	3	1	2
4	2	5	1	4	4	4	4	4	4	4	4
4	3	1	2	1	1	1	1	4	1	4	5
4	3	1	2	1	2	5	1	4	2	5	1
4	3	1	2	1	3	1	2	4	3	1	2
4	3	1	2	1	4	2	3	4	4	4	4
4	3	1	2	2	1	3	4	4	1	4	5
4	3	1	2	2	2	2	2	4	2	5	1
4	3	1	2	2	3	4	5	4	3	1	2
4	3	1	2	2	4	5	1	4	4	4	4
4	3	1	2	3	1	1	2	4	1	4	5
4	3	1	2	3	2	2	3	4	2	5	1
4	3	1	2	3	3	3	3	4	3	1	2
4	3	1	2	3	4	3	4	4	4	4	4
4	3	1	2	4	1	4	5	4	1	4	5
4	3	1	2	4	2	5	1	4	2	5	1
4	3	1	2	4	3	1	2	4	3	1	2
4	3	1	2	4	4	4	4	4	4	4	4
4	4	4	4	1	1	1	1	4	1	4	5
4	4	4	4	1	2	5	1	4	2	5	1
4	4	4	4	1	3	1	2	4	3	1	2
4	4	4	4	1	4	2	3	4	4	4	4
4	4	4	4	2	1	3	4	4	1	4	5
4	4	4	4	2	2	2	2	4	2	5	1
4	4	4	4	2	3	4	5	4	3	1	2
4	4	4	4	2	4	5	1	4	4	4	4
4	4	4	4	3	1	1	2	4	1	4	5
4	4	4	4	3	2	2	3	4	2	5	1
4	4	4	4	3	3	3	3	4	3	1	2
4	4	4	4	3	4	3	4	4	4	4	4
4	4	4	4	4	1	4	5	4	1	4	5
4	4	4	4	4	2	5	1	4	2	5	1
4	4	4	4	4	3	1	2	4	3	1	2
4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select *
from t1
straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	func,test.t1.c	1	100.00	Using where
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	9999	Can't push table 't2' as child, column 'a' does neither 'ref' a column nor a constant
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` straight_join `test`.`t1` `t2` straight_join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = (`test`.`t1`.`b` + 0)))
select *
from t1
straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	3	1	2	3	1	1	2	3	1	1	2
1	4	2	3	4	2	5	1	4	2	5	1
2	1	3	4	1	3	1	2	1	3	1	2
2	2	2	2	2	2	2	2	2	2	2	2
2	3	4	5	3	4	3	4	3	4	3	4
3	1	1	2	1	1	1	1	1	1	1	1
3	2	2	3	2	2	2	2	2	2	2	2
3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	4	3	1	2	4	3	1	2
4	1	4	5	1	4	2	3	1	4	2	3
4	3	1	2	3	1	1	2	3	1	1	2
4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select *
from t1
straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b
where t1.a=1 and t1.d=1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`t1`.`d` = 1)
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	func,test.t1.c	1	100.00	Using where
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	9999	Can't push table 't2' as child, column 'a' does neither 'ref' a column nor a constant
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` straight_join `test`.`t1` `t2` straight_join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`d` = 1) and (`test`.`t1`.`a` = 1) and (`test`.`t2`.`a` = (`test`.`t1`.`b` + 0)))
select *
from t1
straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b
where t1.a=1 and t1.d=1;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
explain extended
select *
from t1
straight_join t1 as t2 on t2.a = t1.b+0
straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	func	1	100.00	Parent of 2 pushed join@1; Using where
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	9999	Can't push table 't2' as child, column 'a' does neither 'ref' a column nor a constant
Note	9999	Can't push table 't3' as child of 't1', column 't2.b' is outside scope of pushable join
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` straight_join `test`.`t1` `t2` straight_join `test`.`t1` `t3` where ((`test`.`t3`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = (`test`.`t1`.`b` + 0)))
select *
from t1
straight_join t1 as t2 on t2.a = t1.b+0
straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	1	1	1	1	2	5	1	1	2	5	1
1	1	1	1	1	3	1	2	1	3	1	2
1	1	1	1	1	4	2	3	1	4	2	3
1	2	5	1	2	1	3	4	2	1	3	4
1	2	5	1	2	2	2	2	2	2	2	2
1	2	5	1	2	3	4	5	2	3	4	5
1	2	5	1	2	4	5	1	2	4	5	1
1	3	1	2	3	1	1	2	3	1	1	2
1	3	1	2	3	2	2	3	3	2	2	3
1	3	1	2	3	3	3	3	3	3	3	3
1	3	1	2	3	4	3	4	3	4	3	4
1	4	2	3	4	1	4	5	4	1	4	5
1	4	2	3	4	2	5	1	4	2	5	1
1	4	2	3	4	3	1	2	4	3	1	2
1	4	2	3	4	4	4	4	4	4	4	4
2	1	3	4	1	1	1	1	1	1	1	1
2	1	3	4	1	2	5	1	1	2	5	1
2	1	3	4	1	3	1	2	1	3	1	2
2	1	3	4	1	4	2	3	1	4	2	3
2	2	2	2	2	1	3	4	2	1	3	4
2	2	2	2	2	2	2	2	2	2	2	2
2	2	2	2	2	3	4	5	2	3	4	5
2	2	2	2	2	4	5	1	2	4	5	1
2	3	4	5	3	1	1	2	3	1	1	2
2	3	4	5	3	2	2	3	3	2	2	3
2	3	4	5	3	3	3	3	3	3	3	3
2	3	4	5	3	4	3	4	3	4	3	4
2	4	5	1	4	1	4	5	4	1	4	5
2	4	5	1	4	2	5	1	4	2	5	1
2	4	5	1	4	3	1	2	4	3	1	2
2	4	5	1	4	4	4	4	4	4	4	4
3	1	1	2	1	1	1	1	1	1	1	1
3	1	1	2	1	2	5	1	1	2	5	1
3	1	1	2	1	3	1	2	1	3	1	2
3	1	1	2	1	4	2	3	1	4	2	3
3	2	2	3	2	1	3	4	2	1	3	4
3	2	2	3	2	2	2	2	2	2	2	2
3	2	2	3	2	3	4	5	2	3	4	5
3	2	2	3	2	4	5	1	2	4	5	1
3	3	3	3	3	1	1	2	3	1	1	2
3	3	3	3	3	2	2	3	3	2	2	3
3	3	3	3	3	3	3	3	3	3	3	3
3	3	3	3	3	4	3	4	3	4	3	4
3	4	3	4	4	1	4	5	4	1	4	5
3	4	3	4	4	2	5	1	4	2	5	1
3	4	3	4	4	3	1	2	4	3	1	2
3	4	3	4	4	4	4	4	4	4	4	4
4	1	4	5	1	1	1	1	1	1	1	1
4	1	4	5	1	2	5	1	1	2	5	1
4	1	4	5	1	3	1	2	1	3	1	2
4	1	4	5	1	4	2	3	1	4	2	3
4	2	5	1	2	1	3	4	2	1	3	4
4	2	5	1	2	2	2	2	2	2	2	2
4	2	5	1	2	3	4	5	2	3	4	5
4	2	5	1	2	4	5	1	2	4	5	1
4	3	1	2	3	1	1	2	3	1	1	2
4	3	1	2	3	2	2	3	3	2	2	3
4	3	1	2	3	3	3	3	3	3	3	3
4	3	1	2	3	4	3	4	3	4	3	4
4	4	4	4	4	1	4	5	4	1	4	5
4	4	4	4	4	2	5	1	4	2	5	1
4	4	4	4	4	3	1	2	4	3	1	2
4	4	4	4	4	4	4	4	4	4	4	4
create table t1_myisam (
a int not null,
b int not null,
c int not null,
d int not null,
primary key (`a`,`b`)
) engine=myisam;
insert into t1_myisam values
(1,1,1,1), (2,2,1,1), (3,3,1,1), (4,4,1,1);
set ndb_join_pushdown=true;
explain extended
select *
from t1_myisam as t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
where t1.a=2 and t1.b=2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	const,const	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	const,test.t2.b	1	100.00	Child of 't2' in pushed join@1; Using where
Warnings:
Note	9999	Table 't1' not in ndb engine, not pushable
Note	1003	/* select#1 */ select '2' AS `a`,'2' AS `b`,'1' AS `c`,'1' AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1_myisam` `t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = '1') and (`test`.`t3`.`b` = '1') and (`test`.`t2`.`a` = '1') and (`test`.`t3`.`a` = '1'))
select *
from t1_myisam as t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
where t1.a=2 and t1.b=2;
a	b	c	d	a	b	c	d	a	b	c	d
2	2	1	1	1	1	1	1	1	1	1	1
drop table t1_myisam;
set ndb_join_pushdown=true;
explain extended select *
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.d = 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`t1`.`d` = 3)
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,const	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t1`.`d` = 3) and (`test`.`t2`.`b` = 3))
select *
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
where t1.d = 3;
a	b	c	d	a	b	c	d
1	4	2	3	2	3	4	5
3	2	2	3	2	3	4	5
3	3	3	3	3	3	3	3
explain extended select * 
from t1 
join t1 as t2 on t2.a = t1.c and t2.b = t1.d 
where t1.a > 2 and t1.d = 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`t1`.`d` = 3) and (`test`.`t1`.`a` > 2))
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,const	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t1`.`d` = 3) and (`test`.`t2`.`b` = 3) and (`test`.`t1`.`a` > 2))
select * 
from t1 
join t1 as t2 on t2.a = t1.c and t2.b = t1.d 
where t1.a > 2 and t1.d = 3;
a	b	c	d	a	b	c	d
3	2	2	3	2	3	4	5
3	3	3	3	3	3	3	3
explain extended select * 
from t1 join t1 as t2 on t2.a = t1.c and t2.b = t1.d 
where t1.d = 3 
order by t1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	index	NULL	PRIMARY	8	NULL	16	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`t1`.`d` = 3)
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,const	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t1`.`d` = 3) and (`test`.`t2`.`b` = 3)) order by `test`.`t1`.`a`
select * 
from t1 join t1 as t2 on t2.a = t1.c and t2.b = t1.d 
where t1.d = 3 
order by t1.a;
a	b	c	d	a	b	c	d
1	4	2	3	2	3	4	5
3	2	2	3	2	3	4	5
3	3	3	3	3	3	3	3
set ndb_join_pushdown=true;
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.c
join t1 as t3 on t3.a = t2.c and t3.b = t2.d
where t1.a = 1 and t1.b = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.c	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	9999	Push of table 't2' as scan-child with lookup-root 't1' not implemented
Note	9999	Can't push table 't3' as child of 't1', column 't2.c' is outside scope of pushable join
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t2`.`d`) and (`test`.`t3`.`a` = `test`.`t2`.`c`) and (`test`.`t1`.`b` = 1) and (`test`.`t1`.`a` = 1))
select *
from t1
join t1 as t2 on t2.a = t1.c
join t1 as t3 on t3.a = t2.c and t3.b = t2.d
where t1.a = 1 and t1.b = 1;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	1	1	1	1	3	1	2	1	2	5	1
1	1	1	1	1	4	2	3	2	3	4	5
explain extended
select *
from t1
left join t1 as t2 on t2.a = t1.c
left join t1 as t3 on t3.a = t2.c and t3.b = t2.d
where t1.a = 1 and t1.b = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.c	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	9999	Push of table 't2' as scan-child with lookup-root 't1' not implemented
Note	9999	Can't push table 't3' as child of 't1', column 't2.c' is outside scope of pushable join
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` left join `test`.`t1` `t2` on((`test`.`t2`.`a` = `test`.`t1`.`c`)) left join `test`.`t1` `t3` on(((`test`.`t3`.`b` = `test`.`t2`.`d`) and (`test`.`t3`.`a` = `test`.`t2`.`c`))) where ((`test`.`t1`.`b` = 1) and (`test`.`t1`.`a` = 1))
select *
from t1
left join t1 as t2 on t2.a = t1.c
left join t1 as t3 on t3.a = t2.c and t3.b = t2.d
where t1.a = 1 and t1.b = 1;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	1	1	1	1	2	5	1	NULL	NULL	NULL	NULL
1	1	1	1	1	3	1	2	1	2	5	1
1	1	1	1	1	4	2	3	2	3	4	5
set ndb_join_pushdown=false;
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.c
join t1 as t3 on t3.a = t2.c and t3.b = t2.d
where t1.a = 1 and t1.b = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	const	3	100.00	
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	
Warnings:
Note	1003	/* select#1 */ select '1' AS `a`,'1' AS `b`,'1' AS `c`,'1' AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`a` = '1') and (`test`.`t3`.`b` = `test`.`t2`.`d`) and (`test`.`t3`.`a` = `test`.`t2`.`c`))
select *
from t1
join t1 as t2 on t2.a = t1.c
join t1 as t3 on t3.a = t2.c and t3.b = t2.d
where t1.a = 1 and t1.b = 1;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	1	1	1	1	3	1	2	1	2	5	1
1	1	1	1	1	4	2	3	2	3	4	5
explain extended
select *
from t1
left join t1 as t2 on t2.a = t1.c
left join t1 as t3 on t3.a = t2.c and t3.b = t2.d
where t1.a = 1 and t1.b = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	100.00	
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	const	3	100.00	
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	
Warnings:
Note	1003	/* select#1 */ select '1' AS `a`,'1' AS `b`,'1' AS `c`,'1' AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` left join `test`.`t1` `t2` on((`test`.`t2`.`a` = '1')) left join `test`.`t1` `t3` on(((`test`.`t3`.`b` = `test`.`t2`.`d`) and (`test`.`t3`.`a` = `test`.`t2`.`c`))) where 1
select *
from t1
left join t1 as t2 on t2.a = t1.c
left join t1 as t3 on t3.a = t2.c and t3.b = t2.d
where t1.a = 1 and t1.b = 1;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	1	1	1	1	2	5	1	NULL	NULL	NULL	NULL
1	1	1	1	1	3	1	2	1	2	5	1
1	1	1	1	1	4	2	3	2	3	4	5
set ndb_join_pushdown=true;
explain extended
select *
from t1 as t2
join t1 as t3 on t3.a = t2.c and t3.b = t2.d
where t2.a = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t3`.`b` = `test`.`t2`.`d`) and (`test`.`t3`.`a` = `test`.`t2`.`c`) and (`test`.`t2`.`a` = 1))
select *
from t1 as t2
join t1 as t3 on t3.a = t2.c and t3.b = t2.d
where t2.a = 1;
a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1
1	3	1	2	1	2	5	1
1	4	2	3	2	3	4	5
set ndb_join_pushdown=true;
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t2.c and t3.b = t1.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t1.c	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`a` = `test`.`t2`.`c`))
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t2.c and t3.b = t1.c;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	3	1	2	1	3	1	2	1	1	1	1
1	4	2	3	1	4	2	3	2	2	2	2
2	1	3	4	2	1	3	4	3	3	3	3
2	2	2	2	2	2	2	2	2	2	2	2
2	3	4	5	2	3	4	5	4	4	4	4
3	1	1	2	3	1	1	2	1	1	1	1
3	2	2	3	3	2	2	3	2	2	2	2
3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	3	4	3	4	3	3	3	3
4	1	4	5	4	1	4	5	4	4	4	4
4	3	1	2	4	3	1	2	1	1	1	1
4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 4 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't2' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3.c,test.t2.c	1	100.00	Child of 't3' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` join `test`.`t1` `t4` where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t1`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t4`.`b` = `test`.`t2`.`c`) and (`test`.`t4`.`a` = `test`.`t3`.`c`))
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
a	b	c	d	a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1
1	4	2	3	1	4	2	3	2	3	4	5	4	2	5	1
2	1	3	4	2	1	3	4	3	4	3	4	3	3	3	3
2	2	2	2	2	2	2	2	2	2	2	2	2	2	2	2
3	2	2	3	3	2	2	3	2	3	4	5	4	2	5	1
3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	3	4	3	4	3	4	3	4	3	3	3	3
4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t2.d
join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 4 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t2.d	1	100.00	Child of 't2' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3.c,test.t2.c	1	100.00	Child of 't3' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` join `test`.`t1` `t4` where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t2`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t4`.`b` = `test`.`t2`.`c`) and (`test`.`t4`.`a` = `test`.`t3`.`c`))
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t2.d
join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
a	b	c	d	a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1
1	4	2	3	1	4	2	3	2	3	4	5	4	2	5	1
2	1	3	4	2	1	3	4	3	4	3	4	3	3	3	3
2	2	2	2	2	2	2	2	2	2	2	2	2	2	2	2
3	2	2	3	3	2	2	3	2	3	4	5	4	2	5	1
3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	3	4	3	4	3	4	3	4	3	3	3	3
4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t2.d
join t1 as t4 on t4.a = t3.c and t4.b = t1.d;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 4 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t2.d	1	100.00	Child of 't2' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3.c,test.t1.d	1	100.00	Child of 't3' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` join `test`.`t1` `t4` where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t2`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t4`.`b` = `test`.`t1`.`d`) and (`test`.`t4`.`a` = `test`.`t3`.`c`))
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t2.d
join t1 as t4 on t4.a = t3.c and t4.b = t1.d;
a	b	c	d	a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1
1	4	2	3	1	4	2	3	2	3	4	5	4	3	1	2
2	1	3	4	2	1	3	4	3	4	3	4	3	4	3	4
2	2	2	2	2	2	2	2	2	2	2	2	2	2	2	2
3	2	2	3	3	2	2	3	2	3	4	5	4	3	1	2
3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	3	4	3	4	3	4	3	4	3	4	3	4
4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t3.a and t4.b = t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 4 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t2.c	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` join `test`.`t1` `t4` where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t1`.`d`) and (`test`.`t4`.`b` = `test`.`t2`.`c`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t4`.`a` = `test`.`t1`.`c`))
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t3.a and t4.b = t2.c;
a	b	c	d	a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1
1	3	1	2	1	3	1	2	1	2	5	1	1	1	1	1
1	4	2	3	1	4	2	3	2	3	4	5	2	2	2	2
2	1	3	4	2	1	3	4	3	4	3	4	3	3	3	3
2	2	2	2	2	2	2	2	2	2	2	2	2	2	2	2
3	1	1	2	3	1	1	2	1	2	5	1	1	1	1	1
3	2	2	3	3	2	2	3	2	3	4	5	2	2	2	2
3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	3	4	3	4	3	4	3	4	3	3	3	3
4	3	1	2	4	3	1	2	1	2	5	1	1	1	1	1
4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t3.b and t4.b = t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 4 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t1.d,test.t2.c	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` join `test`.`t1` `t4` where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t4`.`b` = `test`.`t2`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`d`) and (`test`.`t4`.`a` = `test`.`t1`.`d`))
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t3.b and t4.b = t2.c;
a	b	c	d	a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1
1	3	1	2	1	3	1	2	1	2	5	1	2	1	3	4
1	4	2	3	1	4	2	3	2	3	4	5	3	2	2	3
2	1	3	4	2	1	3	4	3	4	3	4	4	3	1	2
2	2	2	2	2	2	2	2	2	2	2	2	2	2	2	2
3	1	1	2	3	1	1	2	1	2	5	1	2	1	3	4
3	2	2	3	3	2	2	3	2	3	4	5	3	2	2	3
3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	3	4	3	4	3	4	3	4	4	3	1	2
4	3	1	2	4	3	1	2	1	2	5	1	2	1	3	4
4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t3.c and t4.b = t2.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 4 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3.c,test.t1.a	1	100.00	Child of 't3' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` join `test`.`t1` `t4` where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t3`.`b` = `test`.`t1`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t4`.`b` = `test`.`t1`.`a`) and (`test`.`t4`.`a` = `test`.`t3`.`c`))
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t3.c and t4.b = t2.a;
a	b	c	d	a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1
1	4	2	3	1	4	2	3	2	3	4	5	4	1	4	5
2	1	3	4	2	1	3	4	3	4	3	4	3	2	2	3
2	2	2	2	2	2	2	2	2	2	2	2	2	2	2	2
3	2	2	3	3	2	2	3	2	3	4	5	4	3	1	2
3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	3	4	3	4	3	4	3	4	3	3	3	3
4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t3.c and t4.b = t2.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 4 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3.c,test.t1.b	1	100.00	Child of 't3' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` join `test`.`t1` `t4` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t1`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t4`.`b` = `test`.`t1`.`b`) and (`test`.`t4`.`a` = `test`.`t3`.`c`))
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t3.c and t4.b = t2.b;
a	b	c	d	a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1
1	4	2	3	1	4	2	3	2	3	4	5	4	4	4	4
2	1	3	4	2	1	3	4	3	4	3	4	3	1	1	2
2	2	2	2	2	2	2	2	2	2	2	2	2	2	2	2
3	2	2	3	3	2	2	3	2	3	4	5	4	2	5	1
3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	3	4	3	4	3	4	3	4	3	4	3	4
4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t1.c and t4.b = t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 4 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3.a,test.t2.c	1	100.00	Child of 't2' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` join `test`.`t1` `t4` where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t1`.`d`) and (`test`.`t4`.`b` = `test`.`t2`.`c`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t4`.`a` = `test`.`t1`.`c`))
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t1.c and t4.b = t2.c;
a	b	c	d	a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1
1	3	1	2	1	3	1	2	1	2	5	1	1	1	1	1
1	4	2	3	1	4	2	3	2	3	4	5	2	2	2	2
2	1	3	4	2	1	3	4	3	4	3	4	3	3	3	3
2	2	2	2	2	2	2	2	2	2	2	2	2	2	2	2
3	1	1	2	3	1	1	2	1	2	5	1	1	1	1	1
3	2	2	3	3	2	2	3	2	3	4	5	2	2	2	2
3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	3	4	3	4	3	4	3	4	3	3	3	3
4	3	1	2	4	3	1	2	1	2	5	1	1	1	1	1
4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t3.c and t4.b = t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 4 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3.c,test.t2.b	1	100.00	Child of 't3' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` join `test`.`t1` `t4` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t1`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t4`.`b` = `test`.`t1`.`b`) and (`test`.`t4`.`a` = `test`.`t3`.`c`))
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
join t1 as t4 on t4.a = t3.c and t4.b = t1.b;
a	b	c	d	a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1
1	4	2	3	1	4	2	3	2	3	4	5	4	4	4	4
2	1	3	4	2	1	3	4	3	4	3	4	3	1	1	2
2	2	2	2	2	2	2	2	2	2	2	2	2	2	2	2
3	2	2	3	3	2	2	3	2	3	4	5	4	2	5	1
3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	3	4	3	4	3	4	3	4	3	4	3	4
4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select straight_join *
from t1
join t1 as t2  on t2.a = t1.a and t2.b = t1.b
join t1 as t2x on t2x.a = t2.c and t2x.b = t2.d
join t1 as t3x on t3x.a = t1.c and t3x.b = t1.d
join t1 as t4  on t4.a = t3x.c and t4.b = t2x.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 5 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t2x	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	Child of 't2' in pushed join@1
1	SIMPLE	t3x	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't2x' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3x.c,test.t2x.c	1	100.00	Child of 't3x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t2x`.`a` AS `a`,`test`.`t2x`.`b` AS `b`,`test`.`t2x`.`c` AS `c`,`test`.`t2x`.`d` AS `d`,`test`.`t3x`.`a` AS `a`,`test`.`t3x`.`b` AS `b`,`test`.`t3x`.`c` AS `c`,`test`.`t3x`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t2x` join `test`.`t1` `t3x` join `test`.`t1` `t4` where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2x`.`b` = `test`.`t2`.`d`) and (`test`.`t2x`.`a` = `test`.`t2`.`c`) and (`test`.`t3x`.`b` = `test`.`t1`.`d`) and (`test`.`t3x`.`a` = `test`.`t1`.`c`) and (`test`.`t4`.`b` = `test`.`t2x`.`c`) and (`test`.`t4`.`a` = `test`.`t3x`.`c`))
explain extended
select straight_join *
from t1
join t1 as t2  on t2.a = t1.a and t2.b = t1.b
join t1 as t2x on t2x.a = t2.c and t2x.b = t2.d
join t1 as t3  on t3.a = t1.c and t3.b = t1.d
join t1 as t3x on t3x.a = t3.c and t3x.b = t3.d
join t1 as t4  on t4.a = t3x.c and t4.b = t2x.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 6 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t2x	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	Child of 't2' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't2x' in pushed join@1
1	SIMPLE	t3x	eq_ref	PRIMARY	PRIMARY	8	test.t3.c,test.t3.d	1	100.00	Child of 't3' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3x.c,test.t2x.c	1	100.00	Child of 't3x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t2x`.`a` AS `a`,`test`.`t2x`.`b` AS `b`,`test`.`t2x`.`c` AS `c`,`test`.`t2x`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t3x`.`a` AS `a`,`test`.`t3x`.`b` AS `b`,`test`.`t3x`.`c` AS `c`,`test`.`t3x`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t2x` join `test`.`t1` `t3` join `test`.`t1` `t3x` join `test`.`t1` `t4` where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2x`.`b` = `test`.`t2`.`d`) and (`test`.`t2x`.`a` = `test`.`t2`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t3x`.`b` = `test`.`t3`.`d`) and (`test`.`t3x`.`a` = `test`.`t3`.`c`) and (`test`.`t4`.`b` = `test`.`t2x`.`c`) and (`test`.`t4`.`a` = `test`.`t3x`.`c`))
explain extended
select straight_join *
from t1
join t1 as t2  on t2.a = t1.a and t2.b = t1.b
join t1 as t3  on t3.a = t1.c and t3.b = t1.d
join t1 as t2x on t2x.a = t2.c and t2x.b = t2.d
join t1 as t3x on t3x.a = t3.c and t3x.b = t3.d
join t1 as t4  on t4.a = t3x.c and t4.b = t2x.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 6 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't2' in pushed join@1
1	SIMPLE	t2x	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	Child of 't3' in pushed join@1
1	SIMPLE	t3x	eq_ref	PRIMARY	PRIMARY	8	test.t3.c,test.t3.d	1	100.00	Child of 't2x' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3x.c,test.t2x.c	1	100.00	Child of 't3x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t2x`.`a` AS `a`,`test`.`t2x`.`b` AS `b`,`test`.`t2x`.`c` AS `c`,`test`.`t2x`.`d` AS `d`,`test`.`t3x`.`a` AS `a`,`test`.`t3x`.`b` AS `b`,`test`.`t3x`.`c` AS `c`,`test`.`t3x`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` join `test`.`t1` `t2x` join `test`.`t1` `t3x` join `test`.`t1` `t4` where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t1`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t2x`.`b` = `test`.`t2`.`d`) and (`test`.`t2x`.`a` = `test`.`t2`.`c`) and (`test`.`t3x`.`b` = `test`.`t3`.`d`) and (`test`.`t3x`.`a` = `test`.`t3`.`c`) and (`test`.`t4`.`b` = `test`.`t2x`.`c`) and (`test`.`t4`.`a` = `test`.`t3x`.`c`))
explain extended
select straight_join *
from t1
join t1 as t2  on t2.a = t1.a and t2.b = t1.b
join t1 as t2x on t2x.a = t2.c and t2x.b = t2.d
join t1 as t3  on t3.a = t1.c and t3.b = t1.d
join t1 as t3x on t3x.a = t1.c and t3x.b = t1.d
join t1 as t4  on t4.a = t3x.c and t4.b = t2x.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 6 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t2x	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	Child of 't2' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3x	eq_ref	PRIMARY	PRIMARY	8	test.t3.a,test.t3.b	1	100.00	Child of 't2x' in pushed join@1; Using where
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3x.c,test.t2x.c	1	100.00	Child of 't3x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t2x`.`a` AS `a`,`test`.`t2x`.`b` AS `b`,`test`.`t2x`.`c` AS `c`,`test`.`t2x`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t3x`.`a` AS `a`,`test`.`t3x`.`b` AS `b`,`test`.`t3x`.`c` AS `c`,`test`.`t3x`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t2x` join `test`.`t1` `t3` join `test`.`t1` `t3x` join `test`.`t1` `t4` where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2x`.`b` = `test`.`t2`.`d`) and (`test`.`t2x`.`a` = `test`.`t2`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`d`) and (`test`.`t3x`.`b` = `test`.`t1`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t3x`.`a` = `test`.`t1`.`c`) and (`test`.`t4`.`b` = `test`.`t2x`.`c`) and (`test`.`t4`.`a` = `test`.`t3x`.`c`))
explain extended
select straight_join *
from t1
join t1 as t2  on t2.a = t1.a and t2.b = t1.b
join t1 as t2x on t2x.a = t2.c and t2x.b = t2.d
join t1 as t3  on t3.a = t1.c and t3.b = t1.b
join t1 as t3x on t3x.a = t1.c and t3x.b = t1.d
join t1 as t4  on t4.a = t3x.c and t4.b = t2x.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 6 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t2x	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	Child of 't2' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
1	SIMPLE	t3x	eq_ref	PRIMARY	PRIMARY	8	test.t3.a,test.t1.d	1	100.00	Child of 't2x' in pushed join@1; Using where
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3x.c,test.t2x.c	1	100.00	Child of 't3x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t2x`.`a` AS `a`,`test`.`t2x`.`b` AS `b`,`test`.`t2x`.`c` AS `c`,`test`.`t2x`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t3x`.`a` AS `a`,`test`.`t3x`.`b` AS `b`,`test`.`t3x`.`c` AS `c`,`test`.`t3x`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t2x` join `test`.`t1` `t3` join `test`.`t1` `t3x` join `test`.`t1` `t4` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2x`.`b` = `test`.`t2`.`d`) and (`test`.`t2x`.`a` = `test`.`t2`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t3`.`b` = `test`.`t1`.`b`) and (`test`.`t3x`.`b` = `test`.`t1`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`c`) and (`test`.`t3x`.`a` = `test`.`t1`.`c`) and (`test`.`t4`.`b` = `test`.`t2x`.`c`) and (`test`.`t4`.`a` = `test`.`t3x`.`c`))
explain extended
select straight_join *
from t1
left join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.c and t3.b = t1.d
left join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3.c,test.t2.c	1	100.00	
Warnings:
Note	9999	Can't push table 't4' as child of 't1', dependencies on outer joined grandparents not implemented
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` left join `test`.`t1` `t2` on(((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`))) join `test`.`t1` `t3` left join `test`.`t1` `t4` on(((`test`.`t4`.`b` = `test`.`t2`.`c`) and (`test`.`t4`.`a` = `test`.`t3`.`c`))) where ((`test`.`t3`.`b` = `test`.`t1`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`c`))
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
left join t1 as t3 on t3.a = t1.c and t3.b = t1.d
left join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 4 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.c,test.t1.d	1	100.00	Child of 't2' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3.c,test.t2.c	1	100.00	Child of 't3' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` left join `test`.`t1` `t3` on(((`test`.`t3`.`b` = `test`.`t1`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`c`))) left join `test`.`t1` `t4` on(((`test`.`t4`.`b` = `test`.`t2`.`c`) and (`test`.`t4`.`a` = `test`.`t3`.`c`))) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`))
explain extended
select straight_join *
from t1
left join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.a
left join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	ref	PRIMARY	PRIMARY	4	test.t1.a	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3.c,test.t2.c	1	100.00	
Warnings:
Note	9999	Can't push table 't4' as child of 't1', dependencies on outer joined grandparents not implemented
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` left join `test`.`t1` `t2` on(((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`))) join `test`.`t1` `t3` left join `test`.`t1` `t4` on(((`test`.`t4`.`b` = `test`.`t2`.`c`) and (`test`.`t4`.`a` = `test`.`t3`.`c`))) where (`test`.`t3`.`a` = `test`.`t1`.`a`)
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
left join t1 as t3 on t3.a = t1.a
left join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	ref	PRIMARY	PRIMARY	4	test.t2.a	1	100.00	Parent of 2 pushed join@2; Using where
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	8	test.t3.c,test.t2.c	1	100.00	Child of 't3' in pushed join@2
Warnings:
Note	9999	Can't push table 't3' as child of 't1', outer join of scan-child not implemented
Note	9999	Can't push table 't4' as child of 't1', column 't3.c' is outside scope of pushable join
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` left join `test`.`t1` `t3` on(((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`a` = `test`.`t1`.`a`))) left join `test`.`t1` `t4` on(((`test`.`t4`.`b` = `test`.`t2`.`c`) and (`test`.`t4`.`a` = `test`.`t3`.`c`))) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`))
explain extended
select straight_join *
from t1
left join t1 as t2 on t2.a = t1.a and t2.b = t1.b
join t1 as t3 on t3.a = t1.a
left join t1 as t4 on t4.a = t3.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	ref	PRIMARY	PRIMARY	4	test.t1.a	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t4	ref	PRIMARY	PRIMARY	4	test.t3.c	1	100.00	
Warnings:
Note	9999	Can't push table 't4' as child of 't1', outer join of scan-child not implemented
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` left join `test`.`t1` `t2` on(((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`))) join `test`.`t1` `t3` left join `test`.`t1` `t4` on((`test`.`t4`.`a` = `test`.`t3`.`c`)) where (`test`.`t3`.`a` = `test`.`t1`.`a`)
explain extended
select straight_join *
from t1
join t1 as t2 on t2.a = t1.a and t2.b = t1.b
left join t1 as t3 on t3.a = t1.a
left join t1 as t4 on t4.a = t3.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	ref	PRIMARY	PRIMARY	4	test.t2.a	1	100.00	Using where
1	SIMPLE	t4	ref	PRIMARY	PRIMARY	4	test.t3.c	1	100.00	
Warnings:
Note	9999	Can't push table 't3' as child of 't1', outer join of scan-child not implemented
Note	9999	Can't push table 't4' as child of 't1', column 't3.c' is outside scope of pushable join
Note	9999	Can't push table 't4' as child of 't3', outer join of scan-child not implemented
Note	1003	/* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` left join `test`.`t1` `t3` on(((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`a` = `test`.`t1`.`a`))) left join `test`.`t1` `t4` on((`test`.`t4`.`a` = `test`.`t3`.`c`)) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`))
set ndb_join_pushdown=true;
explain extended 
select * from t1 x, t1 y, t1 z, t1 where 
y.a=x.d and y.b=x.b and 
z.a=y.d and 
t1.a = z.d and t1.b=z.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 4 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d,test.x.b	1	100.00	Child of 'x' in pushed join@1
1	SIMPLE	z	ref	PRIMARY	PRIMARY	4	test.y.d	1	100.00	Child of 'y' in pushed join@1
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	8	test.z.d,test.z.b	1	100.00	Child of 'z' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`x`.`d` AS `d`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c`,`test`.`y`.`d` AS `d`,`test`.`z`.`a` AS `a`,`test`.`z`.`b` AS `b`,`test`.`z`.`c` AS `c`,`test`.`z`.`d` AS `d`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` `x` join `test`.`t1` `y` join `test`.`t1` `z` join `test`.`t1` where ((`test`.`t1`.`b` = `test`.`z`.`b`) and (`test`.`t1`.`a` = `test`.`z`.`d`) and (`test`.`z`.`a` = `test`.`y`.`d`) and (`test`.`y`.`b` = `test`.`x`.`b`) and (`test`.`y`.`a` = `test`.`x`.`d`))
select * from t1 x, t1 y, t1 z, t1 where 
y.a=x.d and y.b=x.b and 
z.a=y.d and 
t1.a = z.d and t1.b=z.b;
a	b	c	d	a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1	1	1	1	1
1	1	1	1	1	1	1	1	1	2	5	1	1	2	5	1
1	1	1	1	1	1	1	1	1	3	1	2	2	3	4	5
1	1	1	1	1	1	1	1	1	4	2	3	3	4	3	4
1	2	5	1	1	2	5	1	1	1	1	1	1	1	1	1
1	2	5	1	1	2	5	1	1	2	5	1	1	2	5	1
1	2	5	1	1	2	5	1	1	3	1	2	2	3	4	5
1	2	5	1	1	2	5	1	1	4	2	3	3	4	3	4
1	4	2	3	3	4	3	4	4	2	5	1	1	2	5	1
1	4	2	3	3	4	3	4	4	3	1	2	2	3	4	5
1	4	2	3	3	4	3	4	4	4	4	4	4	4	4	4
2	2	2	2	2	2	2	2	2	1	3	4	4	1	4	5
2	2	2	2	2	2	2	2	2	2	2	2	2	2	2	2
2	2	2	2	2	2	2	2	2	4	5	1	1	4	2	3
2	4	5	1	1	4	2	3	3	1	1	2	2	1	3	4
2	4	5	1	1	4	2	3	3	2	2	3	3	2	2	3
2	4	5	1	1	4	2	3	3	3	3	3	3	3	3	3
2	4	5	1	1	4	2	3	3	4	3	4	4	4	4	4
3	1	1	2	2	1	3	4	4	2	5	1	1	2	5	1
3	1	1	2	2	1	3	4	4	3	1	2	2	3	4	5
3	1	1	2	2	1	3	4	4	4	4	4	4	4	4	4
3	2	2	3	3	2	2	3	3	1	1	2	2	1	3	4
3	2	2	3	3	2	2	3	3	2	2	3	3	2	2	3
3	2	2	3	3	2	2	3	3	3	3	3	3	3	3	3
3	2	2	3	3	2	2	3	3	4	3	4	4	4	4	4
3	3	3	3	3	3	3	3	3	1	1	2	2	1	3	4
3	3	3	3	3	3	3	3	3	2	2	3	3	2	2	3
3	3	3	3	3	3	3	3	3	3	3	3	3	3	3	3
3	3	3	3	3	3	3	3	3	4	3	4	4	4	4	4
3	4	3	4	4	4	4	4	4	2	5	1	1	2	5	1
3	4	3	4	4	4	4	4	4	3	1	2	2	3	4	5
3	4	3	4	4	4	4	4	4	4	4	4	4	4	4	4
4	2	5	1	1	2	5	1	1	1	1	1	1	1	1	1
4	2	5	1	1	2	5	1	1	2	5	1	1	2	5	1
4	2	5	1	1	2	5	1	1	3	1	2	2	3	4	5
4	2	5	1	1	2	5	1	1	4	2	3	3	4	3	4
4	4	4	4	4	4	4	4	4	2	5	1	1	2	5	1
4	4	4	4	4	4	4	4	4	3	1	2	2	3	4	5
4	4	4	4	4	4	4	4	4	4	4	4	4	4	4	4
explain extended 
select * from t1 x, t1 y where
x.a <= 2 and
y.a=x.d and y.b=x.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	range	PRIMARY	PRIMARY	4	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`a` <= 2)
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d,test.x.b	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`x`.`d` AS `d`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c`,`test`.`y`.`d` AS `d` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`b` = `test`.`x`.`b`) and (`test`.`y`.`a` = `test`.`x`.`d`) and (`test`.`x`.`a` <= 2))
select * from t1 x, t1 y where
x.a <= 2 and
y.a=x.d and y.b=x.b;
a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1
1	2	5	1	1	2	5	1
1	3	1	2	2	3	4	5
1	4	2	3	3	4	3	4
2	1	3	4	4	1	4	5
2	2	2	2	2	2	2	2
2	4	5	1	1	4	2	3
explain extended 
select * from t1 x, t1 y where
(x.a <= 2 or x.a > 3) and
y.a=x.d and y.b=x.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	range	PRIMARY	PRIMARY	4	NULL	6	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`x`.`a` <= 2) or (`test`.`x`.`a` > 3))
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d,test.x.b	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`x`.`d` AS `d`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c`,`test`.`y`.`d` AS `d` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`b` = `test`.`x`.`b`) and (`test`.`y`.`a` = `test`.`x`.`d`) and ((`test`.`x`.`a` <= 2) or (`test`.`x`.`a` > 3)))
select * from t1 x, t1 y where
(x.a <= 2 or x.a > 3) and
y.a=x.d and y.b=x.b;
a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1
1	2	5	1	1	2	5	1
1	3	1	2	2	3	4	5
1	4	2	3	3	4	3	4
2	1	3	4	4	1	4	5
2	2	2	2	2	2	2	2
2	4	5	1	1	4	2	3
4	2	5	1	1	2	5	1
4	3	1	2	2	3	4	5
4	4	4	4	4	4	4	4
explain extended 
select * from t1 x, t1 y where
(x.a >= 2 or x.a < 3) and
y.a=x.d and y.b=x.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	range	PRIMARY	PRIMARY	0	NULL	16	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`x`.`a` >= 2) or (`test`.`x`.`a` < 3))
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d,test.x.b	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`x`.`d` AS `d`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c`,`test`.`y`.`d` AS `d` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`b` = `test`.`x`.`b`) and (`test`.`y`.`a` = `test`.`x`.`d`) and ((`test`.`x`.`a` >= 2) or (`test`.`x`.`a` < 3)))
select * from t1 x, t1 y where
(x.a >= 2 or x.a < 3) and
y.a=x.d and y.b=x.b;
a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1
1	2	5	1	1	2	5	1
1	3	1	2	2	3	4	5
1	4	2	3	3	4	3	4
2	1	3	4	4	1	4	5
2	2	2	2	2	2	2	2
2	4	5	1	1	4	2	3
3	1	1	2	2	1	3	4
3	2	2	3	3	2	2	3
3	3	3	3	3	3	3	3
3	4	3	4	4	4	4	4
4	2	5	1	1	2	5	1
4	3	1	2	2	3	4	5
4	4	4	4	4	4	4	4
explain extended 
select * from t1 x, t1 y where
(x.a <= 2 or x.a in (0,5,4)) and
y.a=x.d and y.b=x.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	range	PRIMARY	PRIMARY	4	NULL	9	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`x`.`a` <= 2) or (`test`.`x`.`a` in (0,5,4)))
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d,test.x.b	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`x`.`d` AS `d`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c`,`test`.`y`.`d` AS `d` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`b` = `test`.`x`.`b`) and (`test`.`y`.`a` = `test`.`x`.`d`) and ((`test`.`x`.`a` <= 2) or (`test`.`x`.`a` in (0,5,4))))
select * from t1 x, t1 y where
(x.a <= 2 or x.a in (0,5,4)) and
y.a=x.d and y.b=x.b;
a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1
1	2	5	1	1	2	5	1
1	3	1	2	2	3	4	5
1	4	2	3	3	4	3	4
2	1	3	4	4	1	4	5
2	2	2	2	2	2	2	2
2	4	5	1	1	4	2	3
4	2	5	1	1	2	5	1
4	3	1	2	2	3	4	5
4	4	4	4	4	4	4	4
explain extended 
select * from t1 x, t1 y where
(x.a <= 2 or (x.a,x.b) in ((0,0),(5,0),(4,3))) and
y.a=x.d and y.b=x.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	PRIMARY	NULL	NULL	NULL	16	100.00	Parent of 2 pushed join@1; Using where
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d,test.x.b	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`x`.`d` AS `d`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c`,`test`.`y`.`d` AS `d` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`b` = `test`.`x`.`b`) and (`test`.`y`.`a` = `test`.`x`.`d`) and ((`test`.`x`.`a` <= 2) or ((`test`.`x`.`a`,`test`.`x`.`b`) in (<cache>((0,0)),<cache>((5,0)),<cache>((4,3))))))
select * from t1 x, t1 y where
(x.a <= 2 or (x.a,x.b) in ((0,0),(5,0),(4,3))) and
y.a=x.d and y.b=x.b;
a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1
1	2	5	1	1	2	5	1
1	3	1	2	2	3	4	5
1	4	2	3	3	4	3	4
2	1	3	4	4	1	4	5
2	2	2	2	2	2	2	2
2	4	5	1	1	4	2	3
4	3	1	2	2	3	4	5
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.c,t1.d,
t1.a, t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1; Using temporary; Using filesort
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) order by `test`.`t1`.`c`,`test`.`t1`.`d`,`test`.`t1`.`a`,`test`.`t1`.`b`
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.c,t1.d,
t1.a, t1.b;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	3	1	2	3	1	1	2	3	1	1	2
3	1	1	2	1	1	1	1	1	1	1	1
4	3	1	2	3	1	1	2	3	1	1	2
2	2	2	2	2	2	2	2	2	2	2	2
1	4	2	3	4	2	5	1	4	2	5	1
3	2	2	3	2	2	2	2	2	2	2	2
3	3	3	3	3	3	3	3	3	3	3	3
2	1	3	4	1	3	1	2	1	3	1	2
3	4	3	4	4	3	1	2	4	3	1	2
4	4	4	4	4	4	4	4	4	4	4	4
2	3	4	5	3	4	3	4	3	4	3	4
4	1	4	5	1	4	2	3	1	4	2	3
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.c,t2.d,
t1.a, t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1; Using temporary; Using filesort
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) order by `test`.`t1`.`c`,`test`.`t2`.`d`,`test`.`t1`.`a`,`test`.`t1`.`b`
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.c,t2.d,
t1.a, t1.b;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
3	1	1	2	1	1	1	1	1	1	1	1
1	3	1	2	3	1	1	2	3	1	1	2
4	3	1	2	3	1	1	2	3	1	1	2
1	4	2	3	4	2	5	1	4	2	5	1
2	2	2	2	2	2	2	2	2	2	2	2
3	2	2	3	2	2	2	2	2	2	2	2
2	1	3	4	1	3	1	2	1	3	1	2
3	4	3	4	4	3	1	2	4	3	1	2
3	3	3	3	3	3	3	3	3	3	3	3
4	1	4	5	1	4	2	3	1	4	2	3
2	3	4	5	3	4	3	4	3	4	3	4
4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.a,t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	index	NULL	PRIMARY	8	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) order by `test`.`t1`.`a`,`test`.`t1`.`b`
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.a,t1.b;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	3	1	2	3	1	1	2	3	1	1	2
1	4	2	3	4	2	5	1	4	2	5	1
2	1	3	4	1	3	1	2	1	3	1	2
2	2	2	2	2	2	2	2	2	2	2	2
2	3	4	5	3	4	3	4	3	4	3	4
3	1	1	2	1	1	1	1	1	1	1	1
3	2	2	3	2	2	2	2	2	2	2	2
3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	4	3	1	2	4	3	1	2
4	1	4	5	1	4	2	3	1	4	2	3
4	3	1	2	3	1	1	2	3	1	1	2
4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.a,t2.b,
t1.a, t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1; Using temporary; Using filesort
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) order by `test`.`t1`.`a`,`test`.`t2`.`b`,`test`.`t1`.`a`,`test`.`t1`.`b`
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.a,t2.b,
t1.a, t1.b;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
1	3	1	2	3	1	1	2	3	1	1	2
1	4	2	3	4	2	5	1	4	2	5	1
2	2	2	2	2	2	2	2	2	2	2	2
2	1	3	4	1	3	1	2	1	3	1	2
2	3	4	5	3	4	3	4	3	4	3	4
3	1	1	2	1	1	1	1	1	1	1	1
3	2	2	3	2	2	2	2	2	2	2	2
3	3	3	3	3	3	3	3	3	3	3	3
3	4	3	4	4	3	1	2	4	3	1	2
4	3	1	2	3	1	1	2	3	1	1	2
4	1	4	5	1	4	2	3	1	4	2	3
4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.a desc,t1.b desc;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	index	NULL	PRIMARY	8	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) order by `test`.`t1`.`a` desc,`test`.`t1`.`b` desc
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.a desc,t1.b desc;
a	b	c	d	a	b	c	d	a	b	c	d
4	4	4	4	4	4	4	4	4	4	4	4
4	3	1	2	3	1	1	2	3	1	1	2
4	1	4	5	1	4	2	3	1	4	2	3
3	4	3	4	4	3	1	2	4	3	1	2
3	3	3	3	3	3	3	3	3	3	3	3
3	2	2	3	2	2	2	2	2	2	2	2
3	1	1	2	1	1	1	1	1	1	1	1
2	3	4	5	3	4	3	4	3	4	3	4
2	2	2	2	2	2	2	2	2	2	2	2
2	1	3	4	1	3	1	2	1	3	1	2
1	4	2	3	4	2	5	1	4	2	5	1
1	3	1	2	3	1	1	2	3	1	1	2
1	1	1	1	1	1	1	1	1	1	1	1
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.b,t1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1; Using temporary; Using filesort
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) order by `test`.`t1`.`b`,`test`.`t1`.`a`
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.b,t1.a;
a	b	c	d	a	b	c	d	a	b	c	d
1	1	1	1	1	1	1	1	1	1	1	1
2	1	3	4	1	3	1	2	1	3	1	2
3	1	1	2	1	1	1	1	1	1	1	1
4	1	4	5	1	4	2	3	1	4	2	3
2	2	2	2	2	2	2	2	2	2	2	2
3	2	2	3	2	2	2	2	2	2	2	2
1	3	1	2	3	1	1	2	3	1	1	2
2	3	4	5	3	4	3	4	3	4	3	4
3	3	3	3	3	3	3	3	3	3	3	3
4	3	1	2	3	1	1	2	3	1	1	2
1	4	2	3	4	2	5	1	4	2	5	1
3	4	3	4	4	3	1	2	4	3	1	2
4	4	4	4	4	4	4	4	4	4	4	4
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	index	NULL	PRIMARY	8	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) order by `test`.`t1`.`a`
explain extended
select *
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
order by t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1; Using temporary; Using filesort
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t3`.`d` AS `d` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) order by `test`.`t1`.`b`
explain extended
select t1.a, t1.b, count(*)
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
group by t1.a, t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	index	NULL	PRIMARY	8	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) group by `test`.`t1`.`a`,`test`.`t1`.`b`
select t1.a, t1.b, count(*)
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
group by t1.a, t1.b;
a	b	count(*)
1	1	1
1	3	1
1	4	1
2	1	1
2	2	1
2	3	1
3	1	1
3	2	1
3	3	1
3	4	1
4	1	1
4	3	1
4	4	1
explain extended
select t1.a, count(*)
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
group by t1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	index	NULL	PRIMARY	8	NULL	16	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) group by `test`.`t1`.`a`
select t1.a, count(*)
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
group by t1.a;
a	count(*)
1	3
2	3
3	4
4	3
explain extended
select t1.b, count(*)
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
group by t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	100.00	Parent of 3 pushed join@1; Using temporary; Using filesort
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t1.c	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	8	test.t1.b,test.t2.b	1	100.00	Child of 't1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`b` AS `b`,count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t1`.`b`)) group by `test`.`t1`.`b`
select t1.b, count(*)
from t1
join t1 as t2 on t2.a = t1.b and t2.b = t1.c
join t1 as t3 on t3.a = t2.a and t3.b = t2.b
group by t1.b;
b	count(*)
1	4
2	2
3	4
4	3
explain extended
select t2.c, count(distinct t2.a)
from t1
join t1 as t2 on t1.a = t2.c and t1.b = t2.d
where t2.a = 4 and t2.b=4
group by t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	const	PRIMARY	PRIMARY	8	const,const	1	100.00	Using where; Using filesort
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	
Warnings:
Note	9999	Table 't2' is not pushable: GROUP BY cannot be done using index on grouped columns.
Note	9999	Table 't1' is not pushable: GROUP BY cannot be done using index on grouped columns.
Note	1003	/* select#1 */ select `test`.`t2`.`c` AS `c`,count(distinct `test`.`t2`.`a`) AS `count(distinct t2.a)` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t1`.`b` = `test`.`t2`.`d`) and (`test`.`t1`.`a` = `test`.`t2`.`c`) and (`test`.`t2`.`b` = 4) and (`test`.`t2`.`a` = 4)) group by `test`.`t2`.`c`
select t2.c, count(distinct t2.a)
from t1
join t1 as t2 on t1.a = t2.c and t1.b = t2.d
where t2.a = 4 and t2.b=4
group by t2.c;
c	count(distinct t2.a)
4	1
explain extended
select t2.c, count(distinct t2.a)
from t1
join t1 as t2 on t1.a = t2.c and t1.b = t2.d
where t2.a = 4
group by t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	const	3	100.00	Using where; Using filesort
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	
Warnings:
Note	9999	Table 't2' is not pushable: GROUP BY cannot be done using index on grouped columns.
Note	9999	Table 't1' is not pushable: GROUP BY cannot be done using index on grouped columns.
Note	1003	/* select#1 */ select `test`.`t2`.`c` AS `c`,count(distinct `test`.`t2`.`a`) AS `count(distinct t2.a)` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t1`.`b` = `test`.`t2`.`d`) and (`test`.`t1`.`a` = `test`.`t2`.`c`) and (`test`.`t2`.`a` = 4)) group by `test`.`t2`.`c`
select t2.c, count(distinct t2.a)
from t1
join t1 as t2 on t1.a = t2.c and t1.b = t2.d
where t2.a = 4
group by t2.c;
c	count(distinct t2.a)
1	1
4	1
explain extended
select t2.c, count(distinct t2.a)
from t1
join t1 as t2 on t1.a = t2.c and t1.b = t2.d
where t2.a = 4 and t2.b=4
group by t2.c order by t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	const	PRIMARY	PRIMARY	8	const,const	1	100.00	Using where; Using filesort
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	8	test.t2.c,test.t2.d	1	100.00	
Warnings:
Note	9999	Table 't2' is not pushable: GROUP BY cannot be done using index on grouped columns.
Note	9999	Table 't1' is not pushable: GROUP BY cannot be done using index on grouped columns.
Note	1003	/* select#1 */ select `test`.`t2`.`c` AS `c`,count(distinct `test`.`t2`.`a`) AS `count(distinct t2.a)` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t1`.`b` = `test`.`t2`.`d`) and (`test`.`t1`.`a` = `test`.`t2`.`c`) and (`test`.`t2`.`b` = 4) and (`test`.`t2`.`a` = 4)) group by `test`.`t2`.`c` order by `test`.`t2`.`c`
select t2.c, count(distinct t2.a)
from t1
join t1 as t2 on t1.a = t2.c and t1.b = t2.d
where t2.a = 4 and t2.b=4
group by t2.c order by t2.c;
c	count(distinct t2.a)
4	1
create table tx like t1;
insert into tx 
select x1.a+x2.a*16, x1.b+x2.b*16, x1.c+x2.c*16, x1.d+x2.d*16 
from t1 as x1 cross join t1 as x2;
explain select count(*) from tx as x1 
left join tx as x2 on x1.c=x2.a and x1.d=x2.d;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	256	
1	SIMPLE	x2	ref	PRIMARY	PRIMARY	4	test.x1.c	2	Using where
select count(*) from tx as x1 
left join tx as x2 on x1.c=x2.a and x1.d=x2.d;
count(*)
304
drop table tx;
alter table t1 partition by key(a);
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';
explain select count(*) from t1 
join t1 as t2 on t2.a = t1.c 
join t1 as t3 on t3.a = t1.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	16	Parent of 3 pushed join@1
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.c	1	Child of 't1' in pushed join@1
1	SIMPLE	t3	ref	PRIMARY	PRIMARY	4	test.t1.c	1	Child of 't1' in pushed join@1
select count(*) from t1 
join t1 as t2 on t2.a = t1.c 
join t1 as t3 on t3.a = t1.c;
count(*)
208
CREATE TABLE tx (
a int NOT NULL,
PRIMARY KEY (`a`)
);
delete from t1;
insert into tx values (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
insert into t1 select 1, x1.a * 10+x2.a, 1, 0 from tx as x1 cross join tx as x2;
explain select count(*) from t1 as x1
join t1 as x2 on x2.a = x1.c and x1.b < 2 
join t1 as x3 on x3.a = x1.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	100	Parent of 3 pushed join@1; Using where with pushed condition
1	SIMPLE	x2	ref	PRIMARY	PRIMARY	4	test.x1.c	1	Child of 'x1' in pushed join@1
1	SIMPLE	x3	ref	PRIMARY	PRIMARY	4	test.x1.c	1	Child of 'x1' in pushed join@1
select count(*) from t1 as x1
join t1 as x2 on x2.a = x1.c and x1.b < 2 
join t1 as x3 on x3.a = x1.c;
count(*)
20000
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';
drop table t1;
drop table tx;
create table t1 (a int, b int, primary key(a) using hash) engine = ndb;
insert into t1 values (1, 2);
insert into t1 values (2, 3);
insert into t1 values (3, 1);
set ndb_join_pushdown=true;
explain extended
select *
from t1, t1 as t2
where t1.a in (1,3,5)
and t2.a = t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`t1`.`a` in (1,3,5)) and (`test`.`t1`.`b` is not null))
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.b	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` in (1,3,5)))
select *
from t1, t1 as t2
where t1.a in (1,3,5)
and t2.a = t1.b;
a	b	a	b
1	2	2	3
3	1	1	2
drop table t1;
create table t1 (a int, b int, primary key(a)) engine = ndb;
insert into t1 values (1, 2);
insert into t1 values (2, 3);
insert into t1 values (3, 1);
set ndb_join_pushdown=true;
explain extended
select *
from t1, t1 as t2
where t1.a in (1,3,5)
and t2.a = t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`t1`.`a` in (1,3,5)) and (`test`.`t1`.`b` is not null))
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.b	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` in (1,3,5)))
select *
from t1, t1 as t2
where t1.a in (1,3,5)
and t2.a = t1.b;
a	b	a	b
1	2	2	3
3	1	1	2
explain extended
select *
from t1, t1 as t2
where t1.a in (1,3,5)
and t2.a = t1.b
order by t1.a desc;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`t1`.`a` in (1,3,5)) and (`test`.`t1`.`b` is not null))
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.b	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` in (1,3,5))) order by `test`.`t1`.`a` desc
select *
from t1, t1 as t2
where t1.a in (1,3,5)
and t2.a = t1.b
order by t1.a desc;
a	b	a	b
3	1	1	2
1	2	2	3
drop table t1;
set ndb_join_pushdown=true;
create table t1 (a int, b int, primary key(a)) engine = ndb;
create table t2 (c int, d int, primary key(c)) engine = ndb;
create table t3 (a3 int, b3 int, c3 int not null, d3 int not null,
primary key(a3, b3)) engine = ndb;
create table t3_hash (a3 int, b3 int, c3 int not null, d3 int not null,
primary key(a3, b3) using hash) engine = ndb;
insert into t1 values (0x1f, 0x2f);
insert into t1 values (0x2f, 0x3f);
insert into t1 values (0x3f, 0x1f);
insert into t2 values (0x1f, 0x2f);
insert into t2 values (0x2f, 0x3f);
insert into t2 values (0x3f, 0x1f);
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
insert into t3_hash values (0x1f, 0x2f, 1, 0x1f);
insert into t3_hash values (0x2f, 0x3f, 2, 0x2f);
insert into t3_hash values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y, t1 where y.a3=x.d3 and y.b3=x.b3 and t1.a = y.d3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	3	100.00	Parent of 3 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d3,test.x.b3	1	100.00	Child of 'x' in pushed join@1
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.y.d3	1	100.00	Child of 'y' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t3` `x` join `test`.`t3` `y` join `test`.`t1` where ((`test`.`t1`.`a` = `test`.`y`.`d3`) and (`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`))
select * from t3 x, t3 y, t1 where y.a3=x.d3 and y.b3=x.b3 and t1.a = y.d3;
a3	b3	c3	d3	a3	b3	c3	d3	a	b
31	47	1	31	31	47	1	31	31	47
47	63	2	47	47	63	2	47	47	63
63	31	3	63	63	31	3	63	63	31
explain extended
select *
from t3 x, t3 y, t3 z, t3 z2, t1
where y.a3=x.d3 and y.b3=x.b3 and
z.a3=y.d3 and z.b3=y.b3 and
z2.a3=z.d3 and z2.b3=z.b3 and
t1.a = z2.d3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	3	100.00	Parent of 5 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d3,test.x.b3	1	100.00	Child of 'x' in pushed join@1
1	SIMPLE	z	eq_ref	PRIMARY	PRIMARY	8	test.y.d3,test.x.b3	1	100.00	Child of 'y' in pushed join@1
1	SIMPLE	z2	eq_ref	PRIMARY	PRIMARY	8	test.z.d3,test.y.b3	1	100.00	Child of 'z' in pushed join@1; Using where
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.z2.d3	1	100.00	Child of 'z2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3`,`test`.`z`.`a3` AS `a3`,`test`.`z`.`b3` AS `b3`,`test`.`z`.`c3` AS `c3`,`test`.`z`.`d3` AS `d3`,`test`.`z2`.`a3` AS `a3`,`test`.`z2`.`b3` AS `b3`,`test`.`z2`.`c3` AS `c3`,`test`.`z2`.`d3` AS `d3`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t3` `x` join `test`.`t3` `y` join `test`.`t3` `z` join `test`.`t3` `z2` join `test`.`t1` where ((`test`.`t1`.`a` = `test`.`z2`.`d3`) and (`test`.`z2`.`a3` = `test`.`z`.`d3`) and (`test`.`z`.`a3` = `test`.`y`.`d3`) and (`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`z`.`b3` = `test`.`x`.`b3`) and (`test`.`z2`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`))
select *
from t3 x, t3 y, t3 z, t3 z2, t1
where y.a3=x.d3 and y.b3=x.b3 and
z.a3=y.d3 and z.b3=y.b3 and
z2.a3=z.d3 and z2.b3=z.b3 and
t1.a = z2.d3;
a3	b3	c3	d3	a3	b3	c3	d3	a3	b3	c3	d3	a3	b3	c3	d3	a	b
31	47	1	31	31	47	1	31	31	47	1	31	31	47	1	31	31	47
47	63	2	47	47	63	2	47	47	63	2	47	47	63	2	47	47	63
63	31	3	63	63	31	3	63	63	31	3	63	63	31	3	63	63	31
explain extended
select straight_join * from t1 x, t1 y where y.a=0x1f and x.b = 0x1f;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where with pushed condition: (`test`.`x`.`b` = 0x1f)
1	SIMPLE	y	const	PRIMARY	PRIMARY	4	const	1	100.00	
Warnings:
Note	9999	Can't push table 'y' as child of 'x', their dependency is 'const'
Note	1003	/* select#1 */ select straight_join `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`a` = 0x1f) and (`test`.`x`.`b` = 0x1f))
select straight_join * from t1 x, t1 y where y.a=0x1f and x.b = 0x1f;
a	b	a	b
63	31	31	47
explain extended
select straight_join * from t1 x, t1 y where y.a=x.b and x.b = 0x1f;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where with pushed condition: (`test`.`x`.`b` = 0x1f)
1	SIMPLE	y	const	PRIMARY	PRIMARY	4	const	1	100.00	Using where
Warnings:
Note	9999	Can't push table 'y' as child of 'x', their dependency is 'const'
Note	1003	/* select#1 */ select straight_join `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`a` = `test`.`x`.`b`) and (`test`.`x`.`b` = 0x1f))
select straight_join * from t1 x, t1 y where y.a=x.b and x.b = 0x1f;
a	b	a	b
63	31	31	47
create unique index t3_d3 on t3(d3);
create unique index t3_d3 on t3_hash(d3);
commit;
explain extended
select * from t3 x, t3 y where x.d3=31 and y.a3=x.d3 and y.b3=x.b3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	const	t3_d3	t3_d3	4	const	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	const,test.x.b3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`x`.`d3` = 31) and (`test`.`y`.`a3` = 31))
select * from t3 x, t3 y where x.d3=31 and y.a3=x.d3 and y.b3=x.b3;
a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	31	47	1	31
explain extended
select * from t3 x, t3 y where x.d3=0 and y.a3=x.d3 and y.b3=x.b3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	const	t3_d3	t3_d3	4	const	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	const,test.x.b3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`x`.`d3` = 0) and (`test`.`y`.`a3` = 0))
select * from t3 x, t3 y where x.d3=0 and y.a3=x.d3 and y.b3=x.b3;
a3	b3	c3	d3	a3	b3	c3	d3
explain extended
select * from t1 x, t3 y where y.d3=x.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`b` is not null)
1	SIMPLE	y	eq_ref	t3_d3	t3_d3	4	test.x.b	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t1` `x` join `test`.`t3` `y` where (`test`.`y`.`d3` = `test`.`x`.`b`)
select * from t1 x, t3 y where y.d3=x.b;
a	b	a3	b3	c3	d3
31	47	47	63	2	47
47	63	63	31	3	63
63	31	31	47	1	31
explain extended
select * from t3 x, t3 y where x.d3=31 and y.d3=x.b3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	const	t3_d3	t3_d3	4	const	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	t3_d3	t3_d3	4	test.x.b3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`d3` = `test`.`x`.`b3`) and (`test`.`x`.`d3` = 31))
select * from t3 x, t3 y where x.d3=31 and y.d3=x.b3;
a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	47	63	2	47
explain extended
select * from t3 x, t3 y where x.d3=31 and y.d3=x.c3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	const	t3_d3	t3_d3	4	const	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	t3_d3	t3_d3	4	test.x.c3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`d3` = `test`.`x`.`c3`) and (`test`.`x`.`d3` = 31))
select * from t3 x, t3 y where x.d3=31 and y.d3=x.c3;
a3	b3	c3	d3	a3	b3	c3	d3
explain extended
select * from t3 x, t3 y 
where ((x.a3=0x2f and x.b3=0x3f) or x.d3=0x1f)
and  (y.a3=x.d3 and y.b3=x.b3);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	index_merge	PRIMARY,t3_d3	t3_d3,PRIMARY	4,8	NULL	2	100.00	Parent of 2 pushed join@1; Using sort_union(t3_d3,PRIMARY); Using where with pushed condition: (((`test`.`x`.`a3` = 0x2f) and (`test`.`x`.`b3` = 0x3f)) or (`test`.`x`.`d3` = 0x1f))
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d3,test.x.b3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (((`test`.`x`.`a3` = 0x2f) and (`test`.`x`.`b3` = 0x3f)) or (`test`.`x`.`d3` = 0x1f)))
select * from t3 x, t3 y
where ((x.a3=0x2f and x.b3=0x3f) or x.d3=0x1f)
and  (y.a3=x.d3 and y.b3=x.b3);
a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	31	47	1	31
47	63	2	47	47	63	2	47
explain extended
select * from t3_hash x, t3_hash y
where ((x.a3=0x2f and x.b3=0x3f) or x.d3=0x1f)
and  (y.a3=x.d3 and y.b3=x.b3);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	index_merge	PRIMARY,t3_d3	PRIMARY,t3_d3	8,4	NULL	2	100.00	Parent of 2 pushed join@1; Using sort_union(PRIMARY,t3_d3); Using where with pushed condition: (((`test`.`x`.`a3` = 0x2f) and (`test`.`x`.`b3` = 0x3f)) or (`test`.`x`.`d3` = 0x1f))
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d3,test.x.b3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3_hash` `x` join `test`.`t3_hash` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (((`test`.`x`.`a3` = 0x2f) and (`test`.`x`.`b3` = 0x3f)) or (`test`.`x`.`d3` = 0x1f)))
select * from t3_hash x, t3_hash y
where ((x.a3=0x2f and x.b3=0x3f) or x.d3=0x1f)
and  (y.a3=x.d3 and y.b3=x.b3);
a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	31	47	1	31
47	63	2	47	47	63	2	47
explain extended
select * from t3 x, t3 y where x.d3>=31 and y.d3=x.b3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	range	t3_d3	t3_d3	4	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`d3` >= 31)
1	SIMPLE	y	eq_ref	t3_d3	t3_d3	4	test.x.b3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`d3` = `test`.`x`.`b3`) and (`test`.`x`.`d3` >= 31))
select * from t3 x, t3 y where x.d3>=31 and y.d3=x.b3;
a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	47	63	2	47
47	63	2	47	63	31	3	63
63	31	3	63	31	47	1	31
insert into t1 values (0x4f, null);
select * from t1 left join t1 as t2 on t2.a = t1.b;
a	b	a	b
31	47	47	63
47	63	63	31
63	31	31	47
79	NULL	NULL	NULL
drop table t1,t2,t3, t3_hash;
create table t3 (a3 int, b3 int, c3 int, d3 int,
primary key(b3, a3)) engine = ndb;
create table t3_hash (a3 int, b3 int, c3 int, d3 int,
primary key(b3,a3) using hash) engine = ndb;
create table t3_unq (pk int, a3 int not null, b3 int not null, c3 int, d3 int,
primary key(pk) using hash, unique key(b3,a3) using hash) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
insert into t3_hash values (0x1f, 0x2f, 1, 0x1f);
insert into t3_hash values (0x2f, 0x3f, 2, 0x2f);
insert into t3_hash values (0x3f, 0x1f, 3, 0x3f);
insert into t3_unq values (1001, 0x1f, 0x2f, 1, 0x1f);
insert into t3_unq values (1002, 0x2f, 0x3f, 2, 0x2f);
insert into t3_unq values (1003, 0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where y.a3=x.d3 and y.b3=x.b3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	PRIMARY	NULL	NULL	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`d3` is not null)
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.b3,test.x.d3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`))
select * from t3 x, t3 y where y.a3=x.d3 and y.b3=x.b3;
a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	31	47	1	31
47	63	2	47	47	63	2	47
63	31	3	63	63	31	3	63
explain extended
select * from t3_hash x, t3_hash y where y.a3=x.d3 and y.b3=x.b3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	PRIMARY	NULL	NULL	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`d3` is not null)
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.b3,test.x.d3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3_hash` `x` join `test`.`t3_hash` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`))
select * from t3_hash x, t3_hash y where y.a3=x.d3 and y.b3=x.b3;
a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	31	47	1	31
47	63	2	47	47	63	2	47
63	31	3	63	63	31	3	63
explain extended
select * from t3_unq x, t3_unq y where y.a3=x.d3 and y.b3=x.b3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	b3	NULL	NULL	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`d3` is not null)
1	SIMPLE	y	eq_ref	b3	b3	8	test.x.b3,test.x.d3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`pk` AS `pk`,`test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`pk` AS `pk`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3_unq` `x` join `test`.`t3_unq` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`))
select * from t3_unq x, t3_unq y where y.a3=x.d3 and y.b3=x.b3;
pk	a3	b3	c3	d3	pk	a3	b3	c3	d3
1001	31	47	1	31	1001	31	47	1	31
1002	47	63	2	47	1002	47	63	2	47
1003	63	31	3	63	1003	63	31	3	63
explain extended
select * from t3 x, t3 y where y.a3=x.d3 and y.b3=x.b3
and x.a3=0x2f and x.b3=0x3f;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	const	PRIMARY	PRIMARY	8	const,const	1	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`d3` is not null)
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	const,test.x.d3	1	100.00	Child of 'x' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`x`.`b3` = 0x3f))
select * from t3 x, t3 y where y.a3=x.d3 and y.b3=x.b3
and x.a3=0x2f and x.b3=0x3f;
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
explain extended
select * from t3_hash x, t3_hash y where y.a3=x.d3 and y.b3=x.b3
and x.a3=0x2f and x.b3=0x3f;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	const	PRIMARY	PRIMARY	8	const,const	1	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`d3` is not null)
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	const,test.x.d3	1	100.00	Child of 'x' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3_hash` `x` join `test`.`t3_hash` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`x`.`b3` = 0x3f))
select * from t3_hash x, t3_hash y where y.a3=x.d3 and y.b3=x.b3
and x.a3=0x2f and x.b3=0x3f;
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
explain extended
select * from t3_unq x, t3_unq y where y.a3=x.d3 and y.b3=x.b3
and x.a3=0x2f and x.b3=0x3f;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	const	b3	b3	8	const,const	1	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`d3` is not null)
1	SIMPLE	y	eq_ref	b3	b3	8	const,test.x.d3	1	100.00	Child of 'x' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`pk` AS `pk`,`test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`pk` AS `pk`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3_unq` `x` join `test`.`t3_unq` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`x`.`b3` = 0x3f))
select * from t3_unq x, t3_unq y where y.a3=x.d3 and y.b3=x.b3
and x.a3=0x2f and x.b3=0x3f;
pk	a3	b3	c3	d3	pk	a3	b3	c3	d3
1002	47	63	2	47	1002	47	63	2	47
drop table t3, t3_hash, t3_unq;
create table t3 (a3 int, b3 int, c3 int, d3 int,
primary key(a3), unique key(d3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
insert into t3 values (0x4f, 0,    null, null);
explain extended
select * from t3 as t1
left outer join t3 as t2 on t2.d3 = t1.d3
left outer join t3 as t3 on t3.a3 = t2.d3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	ref	d3	d3	5	test.t1.d3	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	4	test.t2.d3	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a3` AS `a3`,`test`.`t1`.`b3` AS `b3`,`test`.`t1`.`c3` AS `c3`,`test`.`t1`.`d3` AS `d3`,`test`.`t2`.`a3` AS `a3`,`test`.`t2`.`b3` AS `b3`,`test`.`t2`.`c3` AS `c3`,`test`.`t2`.`d3` AS `d3`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3` from `test`.`t3` `t1` left join `test`.`t3` `t2` on((`test`.`t2`.`d3` = `test`.`t1`.`d3`)) left join `test`.`t3` on((`test`.`t3`.`a3` = `test`.`t2`.`d3`)) where 1
select * from t3 as t1
left outer join t3 as t2 on t2.d3 = t1.d3
left outer join t3 as t3 on t3.a3 = t2.d3;
a3	b3	c3	d3	a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	31	47	1	31	31	47	1	31
47	63	2	47	47	63	2	47	47	63	2	47
63	31	3	63	63	31	3	63	63	31	3	63
79	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
explain extended
select * from t3 as t1
left outer join t3 as t2 on t2.d3 = t1.a3
left outer join t3 as t3 on t3.a3 = t2.d3
where t1.d3 = 47;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ref	d3	d3	5	const	1	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	ref	d3	d3	5	test.t1.a3	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	4	test.t2.d3	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a3` AS `a3`,`test`.`t1`.`b3` AS `b3`,`test`.`t1`.`c3` AS `c3`,`test`.`t1`.`d3` AS `d3`,`test`.`t2`.`a3` AS `a3`,`test`.`t2`.`b3` AS `b3`,`test`.`t2`.`c3` AS `c3`,`test`.`t2`.`d3` AS `d3`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3` from `test`.`t3` `t1` left join `test`.`t3` `t2` on((`test`.`t2`.`d3` = `test`.`t1`.`a3`)) left join `test`.`t3` on((`test`.`t3`.`a3` = `test`.`t2`.`d3`)) where (`test`.`t1`.`d3` = 47)
select * from t3 as t1
left outer join t3 as t2 on t2.d3 = t1.a3
left outer join t3 as t3 on t3.a3 = t2.d3
where t1.d3 = 47;
a3	b3	c3	d3	a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47	47	63	2	47
explain extended
select * from t3 as t1
left outer join t3 as t2 on t2.d3 = t1.a3
left outer join t3 as t3 on t3.a3 = t2.d3
where t1.d3 >= 47;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	d3	d3	5	NULL	3	100.00	Parent of 3 pushed join@1; Using where with pushed condition: (`test`.`t1`.`d3` >= 47)
1	SIMPLE	t2	ref	d3	d3	5	test.t1.a3	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	4	test.t2.d3	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a3` AS `a3`,`test`.`t1`.`b3` AS `b3`,`test`.`t1`.`c3` AS `c3`,`test`.`t1`.`d3` AS `d3`,`test`.`t2`.`a3` AS `a3`,`test`.`t2`.`b3` AS `b3`,`test`.`t2`.`c3` AS `c3`,`test`.`t2`.`d3` AS `d3`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3` from `test`.`t3` `t1` left join `test`.`t3` `t2` on((`test`.`t2`.`d3` = `test`.`t1`.`a3`)) left join `test`.`t3` on((`test`.`t3`.`a3` = `test`.`t2`.`d3`)) where (`test`.`t1`.`d3` >= 47)
select * from t3 as t1
left outer join t3 as t2 on t2.d3 = t1.a3
left outer join t3 as t3 on t3.a3 = t2.d3
where t1.d3 >= 47;
a3	b3	c3	d3	a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47	47	63	2	47
63	31	3	63	63	31	3	63	63	31	3	63
explain extended
select * from t3 as t1
left outer join t3 as t2 on t2.d3 = t1.a3
left outer join t3 as t3 on t3.a3 = t2.d3
where t1.d3 is null;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ref	d3	d3	5	const	1	100.00	Parent of 3 pushed join@1; Using where with pushed condition: isnull(`test`.`t1`.`d3`)
1	SIMPLE	t2	ref	d3	d3	5	test.t1.a3	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	4	test.t2.d3	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a3` AS `a3`,`test`.`t1`.`b3` AS `b3`,`test`.`t1`.`c3` AS `c3`,`test`.`t1`.`d3` AS `d3`,`test`.`t2`.`a3` AS `a3`,`test`.`t2`.`b3` AS `b3`,`test`.`t2`.`c3` AS `c3`,`test`.`t2`.`d3` AS `d3`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3` from `test`.`t3` `t1` left join `test`.`t3` `t2` on((`test`.`t2`.`d3` = `test`.`t1`.`a3`)) left join `test`.`t3` on((`test`.`t3`.`a3` = `test`.`t2`.`d3`)) where isnull(`test`.`t1`.`d3`)
select * from t3 as t1
left outer join t3 as t2 on t2.d3 = t1.a3
left outer join t3 as t3 on t3.a3 = t2.d3
where t1.d3 is null;
a3	b3	c3	d3	a3	b3	c3	d3	a3	b3	c3	d3
79	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
explain extended
select * from t3 as t1
left outer join t3 as t2 on t2.d3 = t1.a3
left outer join t3 as t3 on t3.a3 = t2.d3
where t1.d3 is not null;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	d3	d3	5	NULL	3	100.00	Parent of 3 pushed join@1; Using where with pushed condition: (`test`.`t1`.`d3` is not null)
1	SIMPLE	t2	ref	d3	d3	5	test.t1.a3	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	4	test.t2.d3	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a3` AS `a3`,`test`.`t1`.`b3` AS `b3`,`test`.`t1`.`c3` AS `c3`,`test`.`t1`.`d3` AS `d3`,`test`.`t2`.`a3` AS `a3`,`test`.`t2`.`b3` AS `b3`,`test`.`t2`.`c3` AS `c3`,`test`.`t2`.`d3` AS `d3`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3`,`test`.`t3`.`c3` AS `c3`,`test`.`t3`.`d3` AS `d3` from `test`.`t3` `t1` left join `test`.`t3` `t2` on((`test`.`t2`.`d3` = `test`.`t1`.`a3`)) left join `test`.`t3` on((`test`.`t3`.`a3` = `test`.`t2`.`d3`)) where (`test`.`t1`.`d3` is not null)
select * from t3 as t1
left outer join t3 as t2 on t2.d3 = t1.a3
left outer join t3 as t3 on t3.a3 = t2.d3
where t1.d3 is not null;
a3	b3	c3	d3	a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	31	47	1	31	31	47	1	31
47	63	2	47	47	63	2	47	47	63	2	47
63	31	3	63	63	31	3	63	63	31	3	63
drop table t3;
create table t3 (a3 int not null, b3 int not null, c3 int, d3 int,
primary key(a3), unique key(b3,d3), unique key(c3,b3), unique key(c3,d3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1,    0x1f);
insert into t3 values (0x2f, 0x3f, 2,    0x2f);
insert into t3 values (0x3f, 0x1f, 3,    0x3f);
insert into t3 values (0x40, 0,    null, null);
insert into t3 values (0x41, 0,    null, null);
insert into t3 values (0x42, 0,    4,    null);
insert into t3 values (0x43, 0,    null, 0x43);
explain extended
select straight_join * 
from t3 as x join t3 as y on x.b3 = y.b3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	b3	NULL	NULL	NULL	7	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	ref	b3	b3	4	test.x.b3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where (`test`.`y`.`b3` = `test`.`x`.`b3`)
select straight_join * 
from t3 as x join t3 as y on x.b3 = y.b3;
a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	31	47	1	31
47	63	2	47	47	63	2	47
63	31	3	63	63	31	3	63
64	0	NULL	NULL	64	0	NULL	NULL
64	0	NULL	NULL	65	0	NULL	NULL
64	0	NULL	NULL	66	0	4	NULL
64	0	NULL	NULL	67	0	NULL	67
65	0	NULL	NULL	64	0	NULL	NULL
65	0	NULL	NULL	65	0	NULL	NULL
65	0	NULL	NULL	66	0	4	NULL
65	0	NULL	NULL	67	0	NULL	67
66	0	4	NULL	64	0	NULL	NULL
66	0	4	NULL	65	0	NULL	NULL
66	0	4	NULL	66	0	4	NULL
66	0	4	NULL	67	0	NULL	67
67	0	NULL	67	64	0	NULL	NULL
67	0	NULL	67	65	0	NULL	NULL
67	0	NULL	67	66	0	4	NULL
67	0	NULL	67	67	0	NULL	67
explain extended
select straight_join * 
from t3 as x join t3 as y on x.b3 = y.b3
where y.d3 = 0x2f;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	b3	NULL	NULL	NULL	7	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	ref	b3	b3	9	test.x.b3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`d3` = 0x2f))
select straight_join * 
from t3 as x join t3 as y on x.b3 = y.b3
where y.d3 = 0x2f;
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
explain extended
select straight_join * 
from t3 as x join t3 as y on x.c3 = y.c3
where y.d3 = 0x2f;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	c3,c3_2	NULL	NULL	NULL	7	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`c3` is not null)
1	SIMPLE	y	ref	c3,c3_2	c3	5	test.x.c3	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`d3` = 0x2f)
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`c3` = `test`.`x`.`c3`) and (`test`.`y`.`d3` = 0x2f))
select straight_join * 
from t3 as x join t3 as y on x.c3 = y.c3
where y.d3 = 0x2f;
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
explain extended
select straight_join * 
from t3 as x join t3 as y on x.d3 = y.d3
where y.b3 = 0x2f;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	7	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`d3` is not null)
1	SIMPLE	y	ref	b3	b3	9	const,test.x.d3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`d3` = `test`.`x`.`d3`) and (`test`.`y`.`b3` = 0x2f))
select straight_join * 
from t3 as x join t3 as y on x.d3 = y.d3
where y.b3 = 0x2f;
a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	31	47	1	31
explain extended
select straight_join * 
from t3 as x join t3 as y on x.d3 = y.d3
where y.b3 = 0x20+0x2f;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	7	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`d3` is not null)
1	SIMPLE	y	ref	b3	b3	9	const,test.x.d3	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`d3` = `test`.`x`.`d3`) and (`test`.`y`.`b3` = <cache>((0x20 + 0x2f))))
select straight_join * 
from t3 as x join t3 as y on x.d3 = y.d3
where y.b3 = 0x20+0x2f;
a3	b3	c3	d3	a3	b3	c3	d3
explain extended
select straight_join * 
from t3 as x join t3 as y on x.b3 = y.b3
where y.d3 is not null;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	b3	NULL	NULL	NULL	7	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	ref	b3	b3	4	test.x.b3	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`d3` is not null)
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and (`test`.`y`.`d3` is not null))
select straight_join * 
from t3 as x join t3 as y on x.b3 = y.b3
where y.d3 is not null;
a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	31	47	1	31
47	63	2	47	47	63	2	47
63	31	3	63	63	31	3	63
64	0	NULL	NULL	67	0	NULL	67
65	0	NULL	NULL	67	0	NULL	67
66	0	4	NULL	67	0	NULL	67
67	0	NULL	67	67	0	NULL	67
explain extended
select straight_join * 
from t3 as x join t3 as y on x.b3 = y.b3
where y.d3 is null;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	b3	NULL	NULL	NULL	7	100.00	
1	SIMPLE	y	ref	b3	b3	9	test.x.b3,const	1	100.00	Using where with pushed condition: isnull(`test`.`y`.`d3`)
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = `test`.`x`.`b3`) and isnull(`test`.`y`.`d3`))
select straight_join * 
from t3 as x join t3 as y on x.b3 = y.b3
where y.d3 is null;
a3	b3	c3	d3	a3	b3	c3	d3
64	0	NULL	NULL	64	0	NULL	NULL
64	0	NULL	NULL	65	0	NULL	NULL
64	0	NULL	NULL	66	0	4	NULL
65	0	NULL	NULL	64	0	NULL	NULL
65	0	NULL	NULL	65	0	NULL	NULL
65	0	NULL	NULL	66	0	4	NULL
66	0	4	NULL	64	0	NULL	NULL
66	0	4	NULL	65	0	NULL	NULL
66	0	4	NULL	66	0	4	NULL
67	0	NULL	67	64	0	NULL	NULL
67	0	NULL	67	65	0	NULL	NULL
67	0	NULL	67	66	0	4	NULL
explain extended
select straight_join * 
from t3 as x join t3 as y on x.c3 = y.c3
where y.b3 = 0;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	c3,c3_2	NULL	NULL	NULL	7	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`c3` is not null)
1	SIMPLE	y	ref	b3,c3,c3_2	c3	9	test.x.c3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`c3` = `test`.`x`.`c3`) and (`test`.`y`.`b3` = 0))
select straight_join * 
from t3 as x join t3 as y on x.c3 = y.c3
where y.b3 = 0;
a3	b3	c3	d3	a3	b3	c3	d3
66	0	4	NULL	66	0	4	NULL
explain extended
select straight_join * 
from t3 as x join t3 as y on x.c3 = y.c3
where y.b3 is null;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where 0
select straight_join * 
from t3 as x join t3 as y on x.c3 = y.c3
where y.b3 is null;
a3	b3	c3	d3	a3	b3	c3	d3
explain extended
select straight_join * from
t3 as x1
join t3 as y1 on x1.b3 = y1.b3 and x1.d3 = y1.d3
join t3 as x2 on x2.b3 = y1.b3
join t3 as y2 on y2.b3 = x2.c3 and y2.d3 = x1.c3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	b3,c3,c3_2	NULL	NULL	NULL	7	100.00	Parent of 4 pushed join@1; Using where with pushed condition: ((`test`.`x1`.`d3` is not null) and (`test`.`x1`.`c3` is not null))
1	SIMPLE	y1	ref	b3	b3	9	test.x1.b3,test.x1.d3	1	100.00	Child of 'x1' in pushed join@1
1	SIMPLE	x2	ref	b3,c3,c3_2	b3	4	test.x1.b3	1	100.00	Child of 'x1' in pushed join@1; Using where with pushed condition: (`test`.`x2`.`c3` is not null)
1	SIMPLE	y2	ref	b3	b3	9	test.x2.c3,test.x1.c3	1	100.00	Child of 'x2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x1`.`a3` AS `a3`,`test`.`x1`.`b3` AS `b3`,`test`.`x1`.`c3` AS `c3`,`test`.`x1`.`d3` AS `d3`,`test`.`y1`.`a3` AS `a3`,`test`.`y1`.`b3` AS `b3`,`test`.`y1`.`c3` AS `c3`,`test`.`y1`.`d3` AS `d3`,`test`.`x2`.`a3` AS `a3`,`test`.`x2`.`b3` AS `b3`,`test`.`x2`.`c3` AS `c3`,`test`.`x2`.`d3` AS `d3`,`test`.`y2`.`a3` AS `a3`,`test`.`y2`.`b3` AS `b3`,`test`.`y2`.`c3` AS `c3`,`test`.`y2`.`d3` AS `d3` from `test`.`t3` `x1` join `test`.`t3` `y1` join `test`.`t3` `x2` join `test`.`t3` `y2` where ((`test`.`y1`.`d3` = `test`.`x1`.`d3`) and (`test`.`y1`.`b3` = `test`.`x1`.`b3`) and (`test`.`x2`.`b3` = `test`.`x1`.`b3`) and (`test`.`y2`.`d3` = `test`.`x1`.`c3`) and (`test`.`y2`.`b3` = `test`.`x2`.`c3`))
select straight_join * from
t3 as x1
join t3 as y1 on x1.b3 = y1.b3 and x1.d3 = y1.d3
join t3 as x2 on x2.b3 = y1.b3
join t3 as y2 on y2.b3 = x2.c3 and y2.d3 = x1.c3;
a3	b3	c3	d3	a3	b3	c3	d3	a3	b3	c3	d3	a3	b3	c3	d3
prepare stmt1 from
'select straight_join * 
  from t3 as x join t3 as y on x.b3 = y.b3
  where y.d3 = 0x2f';
execute stmt1;
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
execute stmt1;
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
drop prepare stmt1;
execute stmt1;
ERROR HY000: Unknown prepared statement handler (stmt1) given to EXECUTE
prepare stmt1 from
'select straight_join * 
  from t3 as x join t3 as y on x.b3 = y.b3
  where y.d3 = 0x2f';
prepare stmt1 from
'select straight_join * 
  from t3 as x join t3 as y on x.b3 = y.b3
  where y.d3 = 0x2f';
drop prepare stmt1;
prepare stmt1 from
'explain select straight_join * 
  from t3 as x join t3 as y on x.b3 = y.b3
  where y.d3 = 0x2f';
execute stmt1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x	ALL	b3	NULL	NULL	NULL	7	Parent of 2 pushed join@1
1	SIMPLE	y	ref	b3	b3	9	test.x.b3,const	1	Child of 'x' in pushed join@1
execute stmt1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x	ALL	b3	NULL	NULL	NULL	7	Parent of 2 pushed join@1
1	SIMPLE	y	ref	b3	b3	9	test.x.b3,const	1	Child of 'x' in pushed join@1
commit;
execute stmt1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x	ALL	b3	NULL	NULL	NULL	7	Parent of 2 pushed join@1
1	SIMPLE	y	ref	b3	b3	9	test.x.b3,const	1	Child of 'x' in pushed join@1
drop index b3 on t3;
execute stmt1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	7	
1	SIMPLE	y	ALL	NULL	NULL	NULL	NULL	7	Using where with pushed condition; Using join buffer (Block Nested Loop)
create unique index b3 on t3(b3,d3);
execute stmt1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x	ALL	b3	NULL	NULL	NULL	7	Parent of 2 pushed join@1
1	SIMPLE	y	ref	b3	b3	9	test.x.b3,const	1	Child of 'x' in pushed join@1
drop prepare stmt1;
prepare stmt1 from
'explain select straight_join * 
  from t3 as x join t3 as y on x.b3 = y.b3
  where y.d3 = ?';
set @a=47;
execute stmt1 using @a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x	ALL	b3	NULL	NULL	NULL	7	Parent of 2 pushed join@1
1	SIMPLE	y	ref	b3	b3	9	test.x.b3,const	1	Child of 'x' in pushed join@1
set @a=0;
execute stmt1 using @a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x	ALL	b3	NULL	NULL	NULL	7	Parent of 2 pushed join@1
1	SIMPLE	y	ref	b3	b3	9	test.x.b3,const	1	Child of 'x' in pushed join@1
set @a=null;
execute stmt1 using @a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x	ALL	b3	NULL	NULL	NULL	7	
1	SIMPLE	y	ref	b3	b3	9	test.x.b3,const	1	Using where
prepare stmt1 from
'select straight_join * 
  from t3 as x join t3 as y on x.b3 = y.b3
  where y.d3 = ?';
set @a=47;
execute stmt1 using @a;
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
set @a=0;
execute stmt1 using @a;
a3	b3	c3	d3	a3	b3	c3	d3
set @a=null;
execute stmt1 using @a;
a3	b3	c3	d3	a3	b3	c3	d3
prepare stmt1 from
'explain select straight_join * 
  from t3 as x join t3 as y on x.b3 = y.b3 and x.d3 = y.d3
  where x.a3 = ?';
set @a=47;
execute stmt1 using @a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x	const	PRIMARY,b3	PRIMARY	4	const	1	Parent of 2 pushed join@1; Using where with pushed condition
1	SIMPLE	y	ref	b3	b3	9	test.x.b3,test.x.d3	1	Child of 'x' in pushed join@1
set @a=0;
execute stmt1 using @a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x	const	PRIMARY,b3	PRIMARY	4	const	1	Parent of 2 pushed join@1; Using where with pushed condition
1	SIMPLE	y	ref	b3	b3	9	test.x.b3,test.x.d3	1	Child of 'x' in pushed join@1
set @a=null;
execute stmt1 using @a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
prepare stmt1 from
'select straight_join * 
  from t3 as x join t3 as y on x.b3 = y.b3 and x.d3 = y.d3
  where x.a3 = ?';
set @a=47;
execute stmt1 using @a;
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
set @a=0;
execute stmt1 using @a;
a3	b3	c3	d3	a3	b3	c3	d3
set @a=null;
execute stmt1 using @a;
a3	b3	c3	d3	a3	b3	c3	d3
drop table t3;
set @a=47;
execute stmt1 using @a;
ERROR 42S02: Table 'test.t3' doesn't exist
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);
set ndb_join_pushdown=false;
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;
a	b	c	a	b	c	a	b	c	a	b	c
1	NULL	2	2	1	NULL	2	1	NULL	1	NULL	2
1	NULL	2	5	1	NULL	5	1	NULL	1	NULL	2
2	1	NULL	2	1	NULL	2	1	NULL	1	NULL	2
2	1	NULL	3	2	2	3	2	2	2	1	NULL
2	1	NULL	5	1	NULL	5	1	NULL	1	NULL	2
2	1	NULL	6	2	2	6	2	2	2	1	NULL
3	2	2	3	2	2	3	2	2	2	1	NULL
3	2	2	6	2	2	6	2	2	2	1	NULL
5	1	NULL	2	1	NULL	2	1	NULL	1	NULL	2
5	1	NULL	5	1	NULL	5	1	NULL	1	NULL	2
6	2	2	3	2	2	3	2	2	2	1	NULL
6	2	2	6	2	2	6	2	2	2	1	NULL
set ndb_join_pushdown=true;
explain extended
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;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	ALL	PRIMARY,b	NULL	NULL	NULL	6	100.00	Parent of 3 pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY,b	PRIMARY	4	test.t2.a	1	100.00	Child of 't2' in pushed join@1; Using where with pushed condition: (`test`.`t3`.`b` is not null)
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	4	test.t3.b	1	100.00	Child of 't3' in pushed join@1
1	SIMPLE	t1	ALL	PRIMARY,b	NULL	NULL	NULL	6	100.00	Range checked for each record (index map: 0x3)
Warnings:
Note	9999	Table 't1' is not pushable: Access type was not chosen at 'prepare' time
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` join `test`.`t1` `t4` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and (`test`.`t4`.`a` = `test`.`t3`.`b`) and ((`test`.`t1`.`b` = `test`.`t2`.`b`) or (`test`.`t1`.`a` = `test`.`t2`.`b`)))
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;
a	b	c	a	b	c	a	b	c	a	b	c
1	NULL	2	2	1	NULL	2	1	NULL	1	NULL	2
1	NULL	2	5	1	NULL	5	1	NULL	1	NULL	2
2	1	NULL	2	1	NULL	2	1	NULL	1	NULL	2
2	1	NULL	3	2	2	3	2	2	2	1	NULL
2	1	NULL	5	1	NULL	5	1	NULL	1	NULL	2
2	1	NULL	6	2	2	6	2	2	2	1	NULL
3	2	2	3	2	2	3	2	2	2	1	NULL
3	2	2	6	2	2	6	2	2	2	1	NULL
5	1	NULL	2	1	NULL	2	1	NULL	1	NULL	2
5	1	NULL	5	1	NULL	5	1	NULL	1	NULL	2
6	2	2	3	2	2	3	2	2	2	1	NULL
6	2	2	6	2	2	6	2	2	2	1	NULL
explain extended
select *
from t1 where b in 
(select x.a from t1 as x join t1 as y on (y.a = x.b))
xor c > 5;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	6	100.00	Using where
2	DEPENDENT SUBQUERY	x	eq_ref	PRIMARY,b	PRIMARY	4	func	1	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`b` is not null); Full scan on NULL key
2	DEPENDENT SUBQUERY	y	eq_ref	PRIMARY	PRIMARY	4	test.x.b	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (<in_optimizer>(`test`.`t1`.`b`,<exists>(/* select#2 */ select 1 from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`a` = `test`.`x`.`b`) and trigcond_if(outer_field_is_not_null, (<cache>(`test`.`t1`.`b`) = `test`.`x`.`a`), true)))) xor (`test`.`t1`.`c` > 5))
select *
from t1 where b in 
(select x.a from t1 as x join t1 as y on (y.a = x.b))
xor c > 5;
a	b	c
3	2	2
6	2	2
explain extended
select t1.a, (select straight_join x.a from t1 as x join t1 as y on x.a=y.b where y.a = t1.b) from t1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	6	100.00	
2	DEPENDENT SUBQUERY	x	ALL	PRIMARY	NULL	NULL	NULL	6	100.00	
2	DEPENDENT SUBQUERY	y	eq_ref	PRIMARY,b	PRIMARY	4	test.t1.b	1	100.00	Using where
Warnings:
Note	1276	Field or reference 'test.t1.b' of SELECT #2 was resolved in SELECT #1
Note	9999	Can't push table 'y' as child of 'x', column 't1.b' is outside scope of pushable join
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,(/* select#2 */ select straight_join `test`.`x`.`a` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`b` = `test`.`x`.`a`) and (`test`.`y`.`a` = `test`.`t1`.`b`))) AS `(select straight_join x.a from t1 as x join t1 as y on x.a=y.b where y.a = t1.b)` from `test`.`t1`
select t1.a, (select straight_join x.a from t1 as x join t1 as y on x.a=y.b where y.a = t1.b) from t1;
a	(select straight_join x.a from t1 as x join t1 as y on x.a=y.b where y.a = t1.b)
1	NULL
2	NULL
3	1
4	NULL
5	NULL
6	1
drop table t1;
create table t1 (a int primary key, b int) engine = ndb;
create table t2 (a int primary key, b int) engine = myisam;
insert into t1 values(1,1), (2,2), (3,3), (4,4);
insert into t2 values(1,1), (2,2), (3,3), (4,4);
explain extended
select * from t1, t2, t1 as t3
where t2.a = t1.b
and t3.a = t2.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	100.00	
1	SIMPLE	t2	ALL	PRIMARY	NULL	NULL	NULL	4	75.00	Using where; Using join buffer (Block Nested Loop)
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	4	test.t2.b	1	100.00	
Warnings:
Note	9999	Table 't2' not in ndb engine, not pushable
Note	9999	Cannot push table 't3' as child of table 't1'. Doing so would prevent using join buffer for table 't2'.
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t1` `t3` where ((`test`.`t3`.`a` = `test`.`t2`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`b`))
select * from t1, t2, t1 as t3
where t2.a = t1.b
and t3.a = t2.b;
a	b	a	b	a	b
1	1	1	1	1	1
2	2	2	2	2	2
3	3	3	3	3	3
4	4	4	4	4	4
drop table t1, t2;
create table t1 (a int primary key, b int, c blob) engine = ndb;
create table t2 (a int primary key, b int) engine = ndb;
insert into t1 values (1,1, 'kalle');
insert into t1 values (2,1, 'kalle');
insert into t1 values (3,3, 'kalle');
insert into t1 values (4,1, 'kalle');
insert into t2 values (1,1);
insert into t2 values (2,1);
insert into t2 values (3,3);
insert into t2 values (4,1);
set ndb_join_pushdown=true;
explain extended
select t1.a, t1.b, t2.a, t2.b 
from t1, t2
where t2.a = t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`t1`.`b` is not null)
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.b	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`)
select t1.a, t1.b, t2.a, t2.b 
from t1, t2
where t2.a = t1.b;
a	b	a	b
1	1	1	1
2	1	1	1
3	3	3	3
4	1	1	1
explain extended
select t1.a, t1.b, t2.a, t2.b 
from t1, t2
where t2.a = t1.b
and t1.a = 2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	4	const	1	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`t1`.`b` is not null)
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.b	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` = 2) and (`test`.`t2`.`a` = `test`.`t1`.`b`))
select t1.a, t1.b, t2.a, t2.b 
from t1, t2
where t2.a = t1.b
and t1.a = 2;
a	b	a	b
2	1	1	1
explain extended
select t1.a, t1.b, t2.a, t2.b
from t1, t2
where t1.a = t2.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	4	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`t2`.`b` is not null)
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.t2.b	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`b`)
select t1.a, t1.b, t2.a, t2.b 
from t1, t2
where t2.a = t1.b;
a	b	a	b
1	1	1	1
2	1	1	1
3	3	3	3
4	1	1	1
explain extended
select t1.a, t1.b, t2.a, t2.b
from t1, t2
where t1.a = t2.b
and t2.a = 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	const	PRIMARY	PRIMARY	4	const	1	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`t2`.`b` is not null)
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.t2.b	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = 3) and (`test`.`t1`.`a` = `test`.`t2`.`b`))
select t1.a, t1.b, t2.a, t2.b 
from t1, t2
where t1.a = t2.b
and t2.a = 3;
a	b	a	b
3	3	3	3
explain extended
select *
from t1, t2
where t2.a = t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	100.00	Using where with pushed condition: (`test`.`t1`.`b` is not null)
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.b	1	100.00	
Warnings:
Note	9999	Table 't1' is not pushable: select list can't contain BLOB columns
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`)
select *
from t1, t2
where t2.a = t1.b;
a	b	c	a	b
1	1	kalle	1	1
2	1	kalle	1	1
3	3	kalle	3	3
4	1	kalle	1	1
explain extended
select *
from t1, t2
where t2.a = t1.b
and t1.a = 2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	4	const	1	100.00	
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	const	1	100.00	
Warnings:
Note	9999	Table 't1' was optimized away, or const'ified by optimizer
Note	1003	/* select#1 */ select '2' AS `a`,'1' AS `b`,'kalle' AS `c`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = '1'))
select *
from t1, t2
where t2.a = t1.b
and t1.a = 2;
a	b	c	a	b
2	1	kalle	1	1
explain extended
select *
from t1, t2
where t1.a = t2.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	4	100.00	Using where with pushed condition: (`test`.`t2`.`b` is not null)
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.t2.b	1	100.00	
Warnings:
Note	9999	Table 't1' is not pushable: select list can't contain BLOB columns
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`b`)
select *
from t1, t2
where t2.a = t1.b;
a	b	c	a	b
1	1	kalle	1	1
2	1	kalle	1	1
3	3	kalle	3	3
4	1	kalle	1	1
explain extended
select *
from t1, t2
where t1.a = t2.b
and t2.a = 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	const	PRIMARY	PRIMARY	4	const	1	100.00	Using where with pushed condition: (`test`.`t2`.`b` is not null)
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.t2.b	1	100.00	
Warnings:
Note	9999	Table 't1' is not pushable: select list can't contain BLOB columns
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = 3) and (`test`.`t1`.`a` = `test`.`t2`.`b`))
select *
from t1, t2
where t1.a = t2.b
and t2.a = 3;
a	b	c	a	b
3	3	kalle	3	3
drop table t1, t2;
create table t3 (a3 int, b3 tinyint, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3="63";
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	5	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = '63'))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3="63";
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
drop table t3;
create table t3 (a3 int, b3 tinyint unsigned, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	5	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = <cache>((60 + 3))) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
drop table t3;
create table t3 (a3 int, b3 smallint, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	6	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = <cache>((60 + 3))) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
drop table t3;
create table t3 (a3 int, b3 smallint unsigned, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	6	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = <cache>((60 + 3))) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
drop table t3;
create table t3 (a3 int, b3 mediumint, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	7	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = <cache>((60 + 3))) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
drop table t3;
create table t3 (a3 int, b3 mediumint unsigned, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	7	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = <cache>((60 + 3))) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
drop table t3;
create table t3 (a3 int, b3 int, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = <cache>((60 + 3))) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
drop table t3;
create table t3 (a3 int, b3 int unsigned, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = <cache>((60 + 3))) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
drop table t3;
create table t3 (a3 int, b3 bigint, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	12	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 63)
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 63) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
drop table t3;
create table t3 (a3 int, b3 bigint unsigned, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	12	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 63)
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 63) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
drop table t3;
create table t3 (a3 int, b3 boolean, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0, 1, 0x1f);
insert into t3 values (0x2f, 1, 2, 0x2f);
insert into t3 values (0x3f, 0, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	5	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 1) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=1;
a3	b3	c3	d3	a3	b3	c3	d3
47	1	2	47	47	1	2	47
drop table t3;
create table t3 (a3 int, b3 float, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 2.71, 1, 0x1f);
insert into t3 values (0x2f, 3.00, 2, 0x2f);
insert into t3 values (0x3f, 0.50, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.0;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 3.0)
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = 3.0))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.0;
a3	b3	c3	d3	a3	b3	c3	d3
47	3	2	47	47	3	2	47
drop table t3;
create table t3 (a3 int, b3 float unsigned, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 2.71, 1, 0x1f);
insert into t3 values (0x2f, 3.00, 2, 0x2f);
insert into t3 values (0x3f, 0.50, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.0;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	8	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 3.0)
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = 3.0))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.0;
a3	b3	c3	d3	a3	b3	c3	d3
47	3	2	47	47	3	2	47
drop table t3;
create table t3 (a3 int, b3 double, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 2.71, 1, 0x1f);
insert into t3 values (0x2f, 3.14, 2, 0x2f);
insert into t3 values (0x3f, 0.50, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	12	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = 3.14))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14;
a3	b3	c3	d3	a3	b3	c3	d3
47	3.14	2	47	47	3.14	2	47
drop table t3;
create table t3 (a3 int, b3 double unsigned, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 2.71, 1, 0x1f);
insert into t3 values (0x2f, 3.14, 2, 0x2f);
insert into t3 values (0x3f, 0.50, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	12	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = 3.14))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14;
a3	b3	c3	d3	a3	b3	c3	d3
47	3.14	2	47	47	3.14	2	47
drop table t3;
create table t3 (a3 int, b3 decimal, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=63;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	9	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = 63))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=63;
a3	b3	c3	d3	a3	b3	c3	d3
47	63	2	47	47	63	2	47
drop table t3;
create table t3 (a3 int, b3 decimal(12,4), c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 2.71, 1, 0x1f);
insert into t3 values (0x2f, 3.14, 2, 0x2f);
insert into t3 values (0x3f, 0.50, 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	10	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 3.14) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14;
a3	b3	c3	d3	a3	b3	c3	d3
47	3.1400	2	47	47	3.1400	2	47
drop table t3;
create table t3 (a3 int, b3 date, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, '1905-05-17', 1, 0x1f);
insert into t3 values (0x2f, '2000-02-28', 2, 0x2f);
insert into t3 values (0x3f, '2000-02-29', 3, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='2000-02-28';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	7	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = '2000-02-28') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='2000-02-28';
a3	b3	c3	d3	a3	b3	c3	d3
47	2000-02-28	2	47	47	2000-02-28	2	47
drop table t3;
create table t3 (a3 int, b3 datetime, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, '1905-05-17 12:30:00', 1, 0x1f);
insert into t3 values (0x2f, '2000-02-28 23:59:00', 2, 0x2f);
insert into t3 values (0x3f, '2000-02-29 12:59:59', 2, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='2000-02-28 23:59';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	12	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = '2000-02-28 23:59') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='2000-02-28 23:59';
a3	b3	c3	d3	a3	b3	c3	d3
47	2000-02-28 23:59:00	2	47	47	2000-02-28 23:59:00	2	47
drop table t3;
create table t3 (a3 int, b3 time, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, '12:30:00', 1, 0x1f);
insert into t3 values (0x2f, '23:59:00', 2, 0x2f);
insert into t3 values (0x3f, '12:59:59', 2, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='23:59';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	7	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 235900)
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f) and (`test`.`y`.`b3` = 235900))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='23:59';
a3	b3	c3	d3	a3	b3	c3	d3
47	23:59:00	2	47	47	23:59:00	2	47
drop table t3;
create table t3 (a3 int, b3 char(16), c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 'Ole', 1, 0x1f);
insert into t3 values (0x2f, 'Dole', 2, 0x2f);
insert into t3 values (0x3f, 'Doffen', 2, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	20	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 'Dole')
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 'Dole') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
a3	b3	c3	d3	a3	b3	c3	d3
47	Dole	2	47	47	Dole	2	47
drop table t3;
create table t3 (a3 int, b3 varchar(16), c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 'Ole', 1, 0x1f);
insert into t3 values (0x2f, 'Dole', 2, 0x2f);
insert into t3 values (0x3f, 'Doffen', 2, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	22	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 'Dole')
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 'Dole') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
a3	b3	c3	d3	a3	b3	c3	d3
47	Dole	2	47	47	Dole	2	47
drop table t3;
create table t3 (a3 int, b3 varchar(512), c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 'Ole', 1, 0x1f);
insert into t3 values (0x2f, 'Dole', 2, 0x2f);
insert into t3 values (0x3f, 'Doffen', 2, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	518	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`b3` = 'Dole')
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 'Dole') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
a3	b3	c3	d3	a3	b3	c3	d3
47	Dole	2	47	47	Dole	2	47
drop table t3;
create table t3 (a3 int, b3 binary(16), c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 'Ole', 1, 0x1f);
insert into t3 values (0x2f, 'Dole', 2, 0x2f);
insert into t3 values (0x3f, 'Doffen', 2, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	20	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 'Dole') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
a3	b3	c3	d3	a3	b3	c3	d3
drop table t3;
create table t3 (a3 int, b3 varbinary(16), c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 'Ole', 1, 0x1f);
insert into t3 values (0x2f, 'Dole', 2, 0x2f);
insert into t3 values (0x3f, 'Doffen', 2, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	4	const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	22	test.x.d3,const	1	100.00	Child of 'x' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = 'Dole') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
a3	b3	c3	d3	a3	b3	c3	d3
47	Dole	2	47	47	Dole	2	47
drop table t3;
create table t3 (a3 int, b3 tinyint, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values (0x1f, 0x2f, 1, 0x1f);
insert into t3 values (0x2f, 0x3f, 2, 0x2f);
insert into t3 values (0x3f, 0x1f, 3, 0x3f);
explain extended
select * from t3 x, t3 y where y.a3=x.b3 and y.b3="63";
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	3	100.00	
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	5	test.x.b3,const	1	100.00	Using where
Warnings:
Note	9999	Can't push table 'y' as child, column 'a3' does not have same datatype as ref'ed column 'x.b3'
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`a3` = `test`.`x`.`b3`) and (`test`.`y`.`b3` = '63'))
select * from t3 x, t3 y where y.a3=x.b3 and y.b3="63";
a3	b3	c3	d3	a3	b3	c3	d3
31	47	1	31	47	63	2	47
drop table t3;
create table t3 (a3 varchar(16), b3 int, c3 int not null, d3 int not null, 
primary key(a3,b3)) engine = ndb;
insert into t3 values ('Ole', 0x1f, 1, 0x1f);
insert into t3 values ('Dole', 0x2f, 2, 0x2f);
insert into t3 values ('Doffen', 0x3f, 2, 0x3f);
explain extended
select * from t3 x, t3 y where x.a3='Dole' and x.b3=0x2f and y.a3=x.a3 and y.b3=x.d3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	const	PRIMARY	PRIMARY	22	const,const	1	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`a3` = 'Dole')
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	22	const,test.x.d3	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`a3` = 'Dole')
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 'Dole') and (`test`.`y`.`a3` = 'Dole') and (`test`.`x`.`b3` = 0x2f))
select * from t3 x, t3 y where x.a3='Dole' and x.b3=0x2f and y.a3=x.a3 and y.b3=x.d3;
a3	b3	c3	d3	a3	b3	c3	d3
Dole	47	2	47	Dole	47	2	47
explain extended
select * from t3 x, t3 y where x.a3='Dole' and y.a3=x.a3 and y.b3=x.d3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY	PRIMARY	18	const	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`a3` = 'Dole')
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	22	const,test.x.d3	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`a3` = 'Dole')
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`b3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 'Dole') and (`test`.`y`.`a3` = 'Dole'))
select * from t3 x, t3 y where x.a3='Dole' and y.a3=x.a3 and y.b3=x.d3;
a3	b3	c3	d3	a3	b3	c3	d3
Dole	47	2	47	Dole	47	2	47
drop table t3;
create table t1 (k int primary key, b int) engine = ndb;
insert into t1 values (1,1), (2,1), (3,1), (4,1);
explain extended
select *
from t1
straight_join t1 as t2 on t2.k = t1.b+0
straight_join t1 as t3 on t3.k = t2.b
straight_join t1 as t4 on t4.k = t1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`t1`.`b` is not null)
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	func	1	100.00	Parent of 2 pushed join@2; Using where with pushed condition: (`test`.`t2`.`b` is not null)
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	4	test.t2.b	1	100.00	Child of 't2' in pushed join@2
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	4	test.t1.b	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	9999	Can't push table 't2' as child, column 'k' does neither 'ref' a column nor a constant
Note	9999	Can't push table 't3' as child of 't1', column 't2.b' is outside scope of pushable join
Note	1003	/* select#1 */ select `test`.`t1`.`k` AS `k`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`k` AS `k`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`k` AS `k`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`k` AS `k`,`test`.`t4`.`b` AS `b` from `test`.`t1` straight_join `test`.`t1` `t2` straight_join `test`.`t1` `t3` straight_join `test`.`t1` `t4` where ((`test`.`t3`.`k` = `test`.`t2`.`b`) and (`test`.`t4`.`k` = `test`.`t1`.`b`) and (`test`.`t2`.`k` = (`test`.`t1`.`b` + 0)))
select *
from t1
straight_join t1 as t2 on t2.k = t1.b+0
straight_join t1 as t3 on t3.k = t2.b
straight_join t1 as t4 on t4.k = t1.b;
k	b	k	b	k	b	k	b
1	1	1	1	1	1	1	1
2	1	1	1	1	1	1	1
3	1	1	1	1	1	1	1
4	1	1	1	1	1	1	1
explain extended
select *
from t1
straight_join t1 as t2 on t2.k = t1.b+0
straight_join t1 as t3 on t3.k = t2.b
straight_join t1 as t4 on t4.k = t1.b
where t2.k = 1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	100.00	Parent of 2 pushed join@1; Using where
1	SIMPLE	t2	const	PRIMARY	PRIMARY	4	const	1	100.00	Parent of 2 pushed join@2; Using where with pushed condition: (`test`.`t2`.`b` is not null)
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	4	test.t2.b	1	100.00	Child of 't2' in pushed join@2
1	SIMPLE	t4	eq_ref	PRIMARY	PRIMARY	4	test.t1.b	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	9999	Can't push table 't2' as child of 't1', their dependency is 'const'
Note	9999	Can't push table 't3' as child of 't1', column 't2.b' is outside scope of pushable join
Note	1003	/* select#1 */ select `test`.`t1`.`k` AS `k`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`k` AS `k`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`k` AS `k`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`k` AS `k`,`test`.`t4`.`b` AS `b` from `test`.`t1` straight_join `test`.`t1` `t2` straight_join `test`.`t1` `t3` straight_join `test`.`t1` `t4` where ((`test`.`t3`.`k` = `test`.`t2`.`b`) and (`test`.`t4`.`k` = `test`.`t1`.`b`) and (`test`.`t2`.`k` = 1) and (1 = (`test`.`t1`.`b` + 0)))
select *
from t1
straight_join t1 as t2 on t2.k = t1.b+0
straight_join t1 as t3 on t3.k = t2.b
straight_join t1 as t4 on t4.k = t1.b
where t2.k = 1;
k	b	k	b	k	b	k	b
1	1	1	1	1	1	1	1
2	1	1	1	1	1	1	1
3	1	1	1	1	1	1	1
4	1	1	1	1	1	1	1
drop table t1;
create table t1 (
a int not null auto_increment,
b char(255) not null,
c int not null,
d char(255) not null,
primary key (`a`,`b`)
) engine=ndbcluster;
explain extended
select count(*)
from t1 
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
join t1 as t3 on t3.a = t2.c and t3.b = t2.d;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3000	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	259	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	259	test.t2.c,test.t2.d	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`d`) and (`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t2`.`d`) and (`test`.`t3`.`a` = `test`.`t2`.`c`))
select count(*)
from t1 
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
join t1 as t3 on t3.a = t2.c and t3.b = t2.d;
count(*)
2996
explain extended
select count(*)
from t1
join t1 as t2 on t2.a = t1.c
join t1 as t3 on t3.a = t2.c and t3.b = t2.d;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3000	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.c	30	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	259	test.t2.c,test.t2.d	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t2`.`d`) and (`test`.`t3`.`a` = `test`.`t2`.`c`))
select count(*)
from t1
join t1 as t2 on t2.a = t1.c
join t1 as t3 on t3.a = t2.c and t3.b = t2.d;
count(*)
8990
explain extended
select count(*)
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
join t1 as t3 on t3.a = t2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3000	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	259	test.t1.c,test.t1.d	1	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	ref	PRIMARY	PRIMARY	4	test.t2.c	30	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`b` = `test`.`t1`.`d`) and (`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t3`.`a` = `test`.`t2`.`c`))
select count(*)
from t1
join t1 as t2 on t2.a = t1.c and t2.b = t1.d
join t1 as t3 on t3.a = t2.c;
count(*)
8988
alter table t1 partition by key(a);
explain extended
select count(*)
from t1
join t1 as t2 on t2.a = t1.c
join t1 as t3 on t3.a = t2.c and t3.b = t2.d;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3000	100.00	Parent of 3 pushed join@1
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.c	30	100.00	Child of 't1' in pushed join@1
1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	259	test.t2.c,test.t2.d	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t2`.`d`) and (`test`.`t3`.`a` = `test`.`t2`.`c`))
select count(*)
from t1
join t1 as t2 on t2.a = t1.c
join t1 as t3 on t3.a = t2.c and t3.b = t2.d;
count(*)
8990
drop table t1;
create logfile group lg1
add undofile 'undofile.dat'
initial_size 1m
undo_buffer_size = 1m
engine=ndb;
create tablespace ts1
add datafile 'datafile.dat'
use logfile group lg1
initial_size 6m
engine ndb;
create table t1 (a int not null, 
b int not null storage disk, 
c int not null storage memory, 
primary key(a)) 
tablespace ts1 storage disk engine = ndb;
insert into t1 values (10, 11, 11);
insert into t1 values (11, 12, 12);
insert into t1 values (12, 13, 13);
create table t2 (a int not null, 
b int not null, primary key(a)) engine = ndb;
insert into t2 values (10, 11);
insert into t2 values (11, 12);
insert into t2 values (12, 13);
explain extended select * from t1, t2 where t1.c = t2.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.c	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`c`)
select * from t1, t2 where t1.c = t2.a;
a	b	c	a	b
10	11	11	11	12
11	12	12	12	13
explain extended select * from t1, t2 where t1.a=11 and t1.c = t2.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	4	const	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.c	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t1`.`a` = 11))
select * from t1, t2 where t1.a=11 and t1.c = t2.a;
a	b	c	a	b
11	12	12	12	13
explain extended select * from t2, t1 where t2.b = t1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.t2.b	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t2` join `test`.`t1` where (`test`.`t1`.`a` = `test`.`t2`.`b`)
select * from t2, t1 where t2.b = t1.a;
a	b	a	b	c
10	11	11	12	12
11	12	12	13	13
explain extended select * from t2, t1 where t2.a=11 and t2.b = t1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t2	const	PRIMARY	PRIMARY	4	const	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	t1	eq_ref	PRIMARY	PRIMARY	4	test.t2.b	1	100.00	Child of 't2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t2` join `test`.`t1` where ((`test`.`t1`.`a` = `test`.`t2`.`b`) and (`test`.`t2`.`a` = 11))
select * from t2, t1 where t2.a=11 and t2.b = t1.a;
a	b	a	b	c
11	12	12	13	13
explain extended select t1.a, t1.c, t2.a, t2.b from t1, t2 where t1.b = t2.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.b	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`a` = `test`.`t1`.`b`)
select t1.a, t1.c, t2.a, t2.b from t1, t2 where t1.b = t2.a;
a	c	a	b
10	11	11	12
11	12	12	13
explain extended select t1.a, t1.c, t2.a, t2.b from t1, t2 where t1.a=11 and t1.b = t2.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	4	const	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.b	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = 11))
select t1.a, t1.c, t2.a, t2.b from t1, t2 where t1.a=11 and t1.b = t2.a;
a	c	a	b
11	12	12	13
drop table t1;
drop table t2;
alter tablespace ts1
drop datafile 'datafile.dat'
engine ndb;
drop tablespace ts1
engine ndb;
drop logfile group lg1
engine ndb;
create temporary table old_count 
select counter_name, sum(val) as val 
from ndbinfo.counters 
where block_name='DBSPJ' 
group by counter_name;
create table t1 (a int not null, 
b int not null,
c int not null,
primary key(a)) 
engine = ndb;
insert into t1 values (1, 2, 2);
insert into t1 values (2, 3, 3);
insert into t1 values (3, 4, 4);
select * from t1 t1, t1 t2 where t1.a = 2 and t2.a = t1.b;
a	b	c	a	b	c
2	3	3	3	4	4
select count(*) from t1 t1, t1 t2 where t2.a = t1.b;
count(*)
2
select count(*) from t1 t1, t1 t2 where t1.a >= 2 and t2.a = t1.b;
count(*)
1
create temporary table new_count 
select counter_name, sum(val) as val 
from ndbinfo.counters 
where block_name='DBSPJ' 
group by counter_name;
select new_count.counter_name, new_count.val - old_count.val 
from new_count, old_count 
where new_count.counter_name = old_count.counter_name
and new_count.counter_name <> 'LOCAL_READS_SENT'
       and new_count.counter_name <> 'REMOTE_READS_SENT';
counter_name	new_count.val - old_count.val
CONST_PRUNED_RANGE_SCANS_RECEIVED	0
LOCAL_RANGE_SCANS_SENT	2
LOCAL_TABLE_SCANS_SENT	2
PRUNED_RANGE_SCANS_RECEIVED	0
RANGE_SCANS_RECEIVED	2
READS_NOT_FOUND	2
READS_RECEIVED	1
REMOTE_RANGE_SCANS_SENT	0
SCAN_BATCHES_RETURNED	4
SCAN_ROWS_RETURNED	8
TABLE_SCANS_RECEIVED	2
select 'READS_SENT', sum(new_count.val - old_count.val) 
from new_count, old_count 
where new_count.counter_name = old_count.counter_name
and (new_count.counter_name = 'LOCAL_READS_SENT'
       or new_count.counter_name = 'REMOTE_READS_SENT');
READS_SENT	sum(new_count.val - old_count.val)
READS_SENT	7
drop table old_count;
drop table new_count;
drop table t1;
create table t1 (
a int primary key, 
b int,
c int) engine = ndb;
insert into t1 values (1, 2, 3);
insert into t1 values (2, 3, 4);
insert into t1 values (3, 4, 5);
explain extended select * from t1 x, t1 y where x.b=y.a and x.c=4;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`x`.`c` = 4) and (`test`.`x`.`b` is not null))
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	4	test.x.b	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`x`.`c` = 4) and (`test`.`y`.`a` = `test`.`x`.`b`))
select * from t1 x, t1 y where x.b=y.a and x.c=4;
a	b	c	a	b	c
2	3	4	3	4	5
lookups
1
explain extended select * from t1 x, t1 y, t1 z where x.b=y.a and y.c=4 and y.b=z.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	3	100.00	Parent of 3 pushed join@1; Using where with pushed condition: (`test`.`x`.`b` is not null)
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	4	test.x.b	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: ((`test`.`y`.`c` = 4) and (`test`.`y`.`b` is not null))
1	SIMPLE	z	eq_ref	PRIMARY	PRIMARY	4	test.y.b	1	100.00	Child of 'y' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c`,`test`.`z`.`a` AS `a`,`test`.`z`.`b` AS `b`,`test`.`z`.`c` AS `c` from `test`.`t1` `x` join `test`.`t1` `y` join `test`.`t1` `z` where ((`test`.`z`.`a` = `test`.`y`.`b`) and (`test`.`y`.`c` = 4) and (`test`.`y`.`a` = `test`.`x`.`b`))
select * from t1 x, t1 y, t1 z where x.b=y.a and y.c=4 and y.b=z.a;
a	b	c	a	b	c	a	b	c
1	2	3	2	3	4	3	4	5
lookups
5
drop table t1;
create table t1(
a int not null,
b int not null,
c int not null,
primary key(a,b))
engine = ndb partition by key (a);
insert into t1 values (10, 10, 11);
insert into t1 values (11, 11, 12);
insert into t1 values (12, 12, 13);
select * from t1 t1, t1 t2 
where t1.a = 10 and t1.b = 10 and 
t2.a = t1.c and t2.b = t1.c;
a	b	c	a	b	c
10	10	11	11	11	12
select * from t1 t1, t1 t2 
where t1.a = 11 and t1.b = 11 and 
t2.a = t1.c and t2.b = t1.c;
a	b	c	a	b	c
11	11	12	12	12	13
select * from t1 t1, t1 t2 
where t2.a = t1.c and t2.b = t1.c
order by t1.a;
a	b	c	a	b	c
10	10	11	11	11	12
11	11	12	12	12	13
select count(*) from t1 t1, t1 t2 
where t1.a = 11 and 
t2.a = t1.c and t2.b = t1.c;
count(*)
1
scan_count
2
pruned_scan_count
1
sorted_scan_count
1
pushed_queries_defined
3
pushed_queries_dropped
0
pushed_queries_executed
3
pushed_reads
4
drop table t1;
create table t1(
d int not null,
c int not null,
a int not null,
b int not null,
primary key using hash (a,b))
engine = ndb partition by key (a);
insert into t1(a,b,c,d) values (10, 10, 11, 11);
insert into t1(a,b,c,d) values (11, 11, 12, 12);
insert into t1(a,b,c,d) values (12, 12, 13, 13);
create index i1 on t1(c,a);
explain extended select count(*) from t1 t1, t1 t2 where t1.c = 12 and t1.a = 11 and t2.a = t1.d and t2.b = t1.d;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ref	PRIMARY,i1	i1	8	const,const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	8	test.t1.d,test.t1.d	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`d`) and (`test`.`t2`.`b` = `test`.`t1`.`d`) and (`test`.`t1`.`a` = 11) and (`test`.`t1`.`c` = 12))
select count(*) from t1 t1, t1 t2 where t1.c = 12 and t1.a = 11 and t2.a = t1.d and t2.b = t1.d;
count(*)
1
drop index i1 on t1;
pruned_scan_count
1
create index i2 on t1(a,b);
explain extended select count(*) from t1 t1, t1 t2 where t1.a = 11 and t1.b<13 and t2.a = t1.c and t2.b = t1.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	PRIMARY,i2	i2	8	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`t1`.`a` = 11) and (`test`.`t1`.`b` < 13))
1	SIMPLE	t2	eq_ref	PRIMARY,i2	PRIMARY	8	test.t1.c,test.t1.c	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t1`.`a` = 11) and (`test`.`t1`.`b` < 13))
select count(*) from t1 t1, t1 t2 where t1.a = 11 and t1.b<13 and t2.a = t1.c and t2.b = t1.c;
count(*)
1
pruned_scan_count
1
explain extended select count(*) from t1 t1, t1 t2 where t1.a >= 12 and t1.a<=12 and t2.a = t1.c and t2.b = t1.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	PRIMARY,i2	i2	4	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`t1`.`a` >= 12) and (`test`.`t1`.`a` <= 12))
1	SIMPLE	t2	eq_ref	PRIMARY,i2	PRIMARY	8	test.t1.c,test.t1.c	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t1`.`a` >= 12) and (`test`.`t1`.`a` <= 12))
select count(*) from t1 t1, t1 t2 where t1.a >= 12 and t1.a<=12 and t2.a = t1.c and t2.b = t1.c;
count(*)
0
pruned_scan_count
1
explain extended select count(*) from t1 t1, t1 t2 where t1.a >= 11 and t1.a<=12 and t2.a = t1.c and t2.b = t1.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	PRIMARY,i2	i2	4	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`t1`.`a` >= 11) and (`test`.`t1`.`a` <= 12))
1	SIMPLE	t2	eq_ref	PRIMARY,i2	PRIMARY	8	test.t1.c,test.t1.c	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t1`.`a` >= 11) and (`test`.`t1`.`a` <= 12))
select count(*) from t1 t1, t1 t2 where t1.a >= 11 and t1.a<=12 and t2.a = t1.c and t2.b = t1.c;
count(*)
1
pruned_scan_count
0
explain extended select count(*) from t1 t1, t1 t2 where (t1.a = 10 or t1.a=12) and t1.b<13 and t2.a = t1.c and t2.b = t1.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	PRIMARY,i2	i2	8	NULL	6	50.00	Parent of 2 pushed join@1; Using where with pushed condition: (((`test`.`t1`.`a` = 10) or (`test`.`t1`.`a` = 12)) and (`test`.`t1`.`b` < 13))
1	SIMPLE	t2	eq_ref	PRIMARY,i2	PRIMARY	8	test.t1.c,test.t1.c	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`c`) and ((`test`.`t1`.`a` = 10) or (`test`.`t1`.`a` = 12)) and (`test`.`t1`.`b` < 13))
select count(*) from t1 t1, t1 t2 where (t1.a = 10 or t1.a=12) and t1.b<13 and t2.a = t1.c and t2.b = t1.c;
count(*)
1
pruned_scan_count
2
explain extended select count(*) from t1 t1, t1 t2 where t1.a = 10 and (t1.b<11 or t1.b>11) and t2.a = t1.c and t2.b = t1.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	PRIMARY,i2	i2	8	NULL	6	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`t1`.`a` = 10) and ((`test`.`t1`.`b` < 11) or (`test`.`t1`.`b` > 11)))
1	SIMPLE	t2	eq_ref	PRIMARY,i2	PRIMARY	8	test.t1.c,test.t1.c	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`c`) and (`test`.`t1`.`a` = 10) and ((`test`.`t1`.`b` < 11) or (`test`.`t1`.`b` > 11)))
select count(*) from t1 t1, t1 t2 where t1.a = 10 and (t1.b<11 or t1.b>11) and t2.a = t1.c and t2.b = t1.c;
count(*)
1
pruned_scan_count
2
drop table t1;
create table t2(
d int not null,
e int not null,
f int not null,
a int not null,
b int not null,
c int not null,
primary key using hash (a,b,c))
engine = ndb partition by key (b,a);
insert into t2(a,b,c,d,e,f) values (1, 2, 3, 1, 2, 3);
insert into t2(a,b,c,d,e,f) values (1, 2, 4, 1, 2, 3);
insert into t2(a,b,c,d,e,f) values (2, 3, 4, 1, 2, 3);
insert into t2(a,b,c,d,e,f) values (3, 4, 5, 1, 2, 3);
insert into t2(a,b,c,d,e,f) values (4, 5, 6, 1, 2, 3);
insert into t2(a,b,c,d,e,f) values (5, 6, 7, 1, 2, 3);
insert into t2(a,b,c,d,e,f) values (6, 7, 8, 1, 2, 3);
insert into t2(a,b,c,d,e,f) values (7, 8, 9, 1, 2, 3);
create index i2_1 on t2(d, a, b, e);
explain extended select count(*) from t2 x, t2 y where x.d=1 and x.a=1 and x.b=2 and y.a=x.d and y.b=x.e and y.c=3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY,i2_1	i2_1	12	const,const,const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	12	const,test.x.e,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t2` `x` join `test`.`t2` `y` where ((`test`.`y`.`c` = 3) and (`test`.`y`.`b` = `test`.`x`.`e`) and (`test`.`x`.`b` = 2) and (`test`.`x`.`a` = 1) and (`test`.`x`.`d` = 1) and (`test`.`y`.`a` = 1))
select count(*) from t2 x, t2 y where x.d=1 and x.a=1 and x.b=2 and y.a=x.d and y.b=x.e and y.c=3;
count(*)
2
pruned_scan_count
1
drop index i2_1 on t2;
create index i2_3 on t2(a, d, b, e);
explain extended select count(*) from t2 x, t2 y where x.d=1 and x.a=1 and x.b=2 and y.a=x.d and y.b=x.e and y.c=3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ref	PRIMARY,i2_3	i2_3	12	const,const,const	3	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY,i2_3	PRIMARY	12	const,test.x.e,const	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t2` `x` join `test`.`t2` `y` where ((`test`.`y`.`c` = 3) and (`test`.`y`.`b` = `test`.`x`.`e`) and (`test`.`x`.`b` = 2) and (`test`.`x`.`a` = 1) and (`test`.`x`.`d` = 1) and (`test`.`y`.`a` = 1))
select count(*) from t2 x, t2 y where x.d=1 and x.a=1 and x.b=2 and y.a=x.d and y.b=x.e and y.c=3;
count(*)
2
pruned_scan_count
1
drop table t2;
create table t1 (a binary(10) primary key, b binary(10) not null) engine = ndb;
insert into t1 values ('\0123456789', '1234567890');
insert into t1 values ('1234567890', '\0123456789');
explain extended
select count(*)
from t1 join t1 as t2 on t2.a = t1.b
where t1.a = '\0123456789';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	10	const	1	100.00	Parent of 2 pushed join@1; Using where
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	10	test.t1.b	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = '\0123456789'))
select count(*)
from t1 join t1 as t2 on t2.a = t1.b
where t1.a = '\0123456789';
count(*)
1
drop table t1;
create table t1 (pk int primary key, a int unique key) engine = ndb;
insert into t1 values (1,10), (2,20), (3,30);
set ndb_join_pushdown = false;
explain extended
select * from t1 as x right join t1 as y
on x.pk = y.pk
and x.pk = y.a
and x.a = y.pk
where y.pk = 2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	y	const	PRIMARY	PRIMARY	4	const	1	100.00	
1	SIMPLE	x	const	PRIMARY,a	NULL	NULL	NULL	1	100.00	Impossible ON condition
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`pk` AS `pk`,`test`.`x`.`a` AS `a`,'2' AS `pk`,'20' AS `a` from `test`.`t1` `y` left join `test`.`t1` `x` on((multiple equal(2, `test`.`x`.`pk`, `test`.`x`.`a`))) where 1
select * from t1 as x right join t1 as y
on x.pk = y.pk
and x.pk = y.a
and x.a = y.pk
where y.pk = 2;
pk	a	pk	a
NULL	NULL	2	20
set ndb_join_pushdown = true;
explain extended
select * from t1 as x right join t1 as y
on x.pk = y.pk
and x.pk = y.a
and x.a = y.pk
where y.pk = 2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	y	const	PRIMARY	PRIMARY	4	const	1	100.00	
1	SIMPLE	x	const	PRIMARY,a	PRIMARY	4	const	1	100.00	Using where
Warnings:
Note	9999	Can't push table 'x' as child of 'y', their dependency is 'const'
Note	1003	/* select#1 */ select `test`.`x`.`pk` AS `pk`,`test`.`x`.`a` AS `a`,`test`.`y`.`pk` AS `pk`,`test`.`y`.`a` AS `a` from `test`.`t1` `y` left join `test`.`t1` `x` on(((`test`.`y`.`a` = 2) and (`test`.`x`.`pk` = 2) and (`test`.`x`.`a` = 2))) where (`test`.`y`.`pk` = 2)
select * from t1 as x right join t1 as y
on x.pk = y.pk
and x.pk = y.a
and x.a = y.pk
where y.pk = 2;
pk	a	pk	a
NULL	NULL	2	20
drop table t1;
create table t1 (pk int primary key, u int not null, a int, b int) engine=ndb;
create index ix1 on t1(b,a);
insert into t1 values (0,1,10,20);
insert into t1 values (1,2,20,30);
insert into t1 values (2,3,30,40);
explain extended select * from t1 as x join t1 as y join t1 as z on x.u=y.pk and y.a=z.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	3	100.00	Parent of 3 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	4	test.x.u	1	100.00	Child of 'x' in pushed join@1; Using where with pushed condition: (`test`.`y`.`a` is not null)
1	SIMPLE	z	ref	ix1	ix1	5	test.y.a	1	100.00	Child of 'y' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`pk` AS `pk`,`test`.`x`.`u` AS `u`,`test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`y`.`pk` AS `pk`,`test`.`y`.`u` AS `u`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`z`.`pk` AS `pk`,`test`.`z`.`u` AS `u`,`test`.`z`.`a` AS `a`,`test`.`z`.`b` AS `b` from `test`.`t1` `x` join `test`.`t1` `y` join `test`.`t1` `z` where ((`test`.`z`.`b` = `test`.`y`.`a`) and (`test`.`y`.`pk` = `test`.`x`.`u`))
select * from t1 as x join t1 as y join t1 as z on x.u=y.pk and y.a=z.b;
pk	u	a	b	pk	u	a	b	pk	u	a	b
0	1	10	20	1	2	20	30	0	1	10	20
1	2	20	30	2	3	30	40	1	2	20	30
drop table t1;
create table t1 (pk int primary key, u int not null) engine=ndb;
insert into t1 values (0,-1), (1,-1), (2,-1), (3,-1), (4,-1), (5,-1), (6,-1), 
(7,-1), (8,-1), (9,-1), (10,-1), (11,-1), (12,-1), (13,-1), (14,-1), (15,-1), 
(16,-1), (17,-1), (18,-1), (19,-1), (20,-1), (21,-1), (22,-1), (23,-1), 
(24,-1), (25,-1), (26,-1), (27,-1), (28,-1), (29,-1), (30,-1), (31,-1), 
(32,-1), (33,-1), (34,-1), (35,-1), (36,-1), (37,-1), (38,-1), (39,-1), 
(40,-1), (41,-1), (42,-1), (43,-1), (44,-1), (45,-1), (46,-1), (47,-1), 
(48,-1), (49,-1), (50,-1), (51,-1), (52,-1), (53,-1), (54,-1), (55,-1), 
(56,-1), (57,-1), (58,-1), (59,-1), (60,-1), (61,-1), (62,-1), (63,-1), 
(64,-1), (65,-1), (66,-1), (67,-1), (68,-1), (69,-1), (70,-1), (71,-1), 
(72,-1), (73,-1), (74,-1), (75,-1), (76,-1), (77,-1), (78,-1), (79,-1), 
(80,-1), (81,-1), (82,-1), (83,-1), (84,-1), (85,-1), (86,-1), (87,-1), 
(88,-1), (89,-1), (90,-1), (91,-1), (92,-1), (93,-1), (94,-1), (95,-1), 
(96,-1), (97,-1), (98,-1), (99,-1), (100,-1), (101,-1), (102,-1), (103,-1), 
(104,-1), (105,-1), (106,-1), (107,-1), (108,-1), (109,-1), (110,-1), 
(111,-1), (112,-1), (113,-1), (114,-1), (115,-1), (116,-1), (117,-1), 
(118,-1), (119,-1), (120,-1), (121,-1), (122,-1), (123,-1), (124,-1), 
(125,-1), (126,-1), (127,-1), (128,-1), (129,-1), (130,-1), (131,-1), 
(132,-1), (133,-1), (134,-1), (135,-1), (136,-1), (137,-1), (138,-1), (139,-1);
explain extended select * from t1 as x join t1 as y on x.u=y.pk order by(x.pk);
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	index	NULL	PRIMARY	4	NULL	140	100.00	Parent of 2 pushed join@1
1	SIMPLE	y	eq_ref	PRIMARY	PRIMARY	4	test.x.u	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x`.`pk` AS `pk`,`test`.`x`.`u` AS `u`,`test`.`y`.`pk` AS `pk`,`test`.`y`.`u` AS `u` from `test`.`t1` `x` join `test`.`t1` `y` where (`test`.`y`.`pk` = `test`.`x`.`u`) order by `test`.`x`.`pk`
select * from t1 as x join t1 as y on x.u=y.pk order by(x.pk);
pk	u	pk	u
drop table t1;
create table t1 (pk int primary key, u int not null, a int, b int) engine=ndb;
create index ix1 on t1(b,a);
create unique index ix2 on t1(u);
insert into t1 values (0,0,10,10);
insert into t1 values (1,1,10,10);
insert into t1 values (2,2,10,10);
insert into t1 values (3,3,10,10);
insert into t1 values (4,4,10,10);
insert into t1 values (5,5,10,10);
insert into t1 values (6,6,10,10);
insert into t1 values (7,7,10,10);
insert into t1 values (8,8,10,10);
insert into t1 values (9,9,10,10);
insert into t1 values (10,10,10,10);
insert into t1 values (11,11,10,10);
explain extended select count(*) from t1 as x1 join t1 as x2 join t1 as x3 
on x1.a=x2.u and x2.a = x3.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	12	100.00	Parent of 3 pushed join@1; Using where with pushed condition: (`test`.`x1`.`a` is not null)
1	SIMPLE	x2	eq_ref	ix2	ix2	4	test.x1.a	1	100.00	Child of 'x1' in pushed join@1; Using where with pushed condition: (`test`.`x2`.`a` is not null)
1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	2	100.00	Child of 'x2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x3`.`b` = `test`.`x2`.`a`) and (`test`.`x2`.`u` = `test`.`x1`.`a`))
select count(*) from t1 as x1 join t1 as x2 join t1 as x3 
on x1.a=x2.u and x2.a = x3.b;
count(*)
144
explain extended select count(*) from t1 as x1, t1 as x2, t1 as x3 
where x1.u=x2.pk and x1.a=x3.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	ix2	NULL	NULL	NULL	12	100.00	Parent of 3 pushed join@1; Using where with pushed condition: (`test`.`x1`.`a` is not null)
1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	4	test.x1.u	1	100.00	Child of 'x1' in pushed join@1
1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of 'x1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x3`.`b` = `test`.`x1`.`a`) and (`test`.`x2`.`pk` = `test`.`x1`.`u`))
select count(*) from t1 as x1, t1 as x2, t1 as x3 
where x1.u=x2.pk and x1.a=x3.b;
count(*)
144
insert into t1 values (12,12,20,10);
explain extended select count(*) from t1 as x1 left join t1 as x2 on x1.a=x2.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	
1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	
Warnings:
Note	9999	Can't push table 'x2' as child of 'x1', outer join of scan-child not implemented
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` left join `test`.`t1` `x2` on((`test`.`x1`.`a` = `test`.`x2`.`b`)) where 1
select count(*) from t1 as x1 left join t1 as x2 on x1.a=x2.b;
count(*)
157
set ndb_join_pushdown=off;
select count(*) from t1 as x1 left join t1 as x2 on x1.a=x2.b;
count(*)
157
set ndb_join_pushdown=on;
explain extended select count(*) from t1 as x1 
left join t1 as x2 on x1.u=x2.pk 
left join t1 as x3 on x2.a=x3.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1
1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	4	test.x1.u	1	100.00	Child of 'x1' in pushed join@1
1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	2	100.00	
Warnings:
Note	9999	Can't push table 'x3' as child of 'x1', outer join of scan-child not implemented
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` left join `test`.`t1` `x2` on((`test`.`x1`.`u` = `test`.`x2`.`pk`)) left join `test`.`t1` `x3` on((`test`.`x2`.`a` = `test`.`x3`.`b`)) where 1
select count(*) from t1 as x1 
left join t1 as x2 on x1.u=x2.pk 
left join t1 as x3 on x2.a=x3.b;
count(*)
157
set ndb_join_pushdown=off;
select count(*) from t1 as x1 
left join t1 as x2 on x1.u=x2.pk 
left join t1 as x3 on x2.a=x3.b;
count(*)
157
set ndb_join_pushdown=on;
explain extended select count(*) from t1 as x1
left join t1 as x2 on x1.u=x2.pk
left join t1 as x3 on x2.a=x3.b
left join t1 as x4 on x3.u=x4.pk
left join t1 as x5 on x4.a=x5.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1
1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	4	test.x1.u	1	100.00	Child of 'x1' in pushed join@1
1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	2	100.00	Parent of 2 pushed join@2
1	SIMPLE	x4	eq_ref	PRIMARY	PRIMARY	4	test.x3.u	1	100.00	Child of 'x3' in pushed join@2
1	SIMPLE	x5	ref	ix1	ix1	5	test.x4.a	2	100.00	
Warnings:
Note	9999	Can't push table 'x3' as child of 'x1', outer join of scan-child not implemented
Note	9999	Can't push table 'x4' as child of 'x1', column 'x3.u' is outside scope of pushable join
Note	9999	Can't push table 'x5' as child of 'x1', column 'x4.a' is outside scope of pushable join
Note	9999	Can't push table 'x5' as child of 'x3', outer join of scan-child not implemented
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` left join `test`.`t1` `x2` on((`test`.`x1`.`u` = `test`.`x2`.`pk`)) left join `test`.`t1` `x3` on((`test`.`x2`.`a` = `test`.`x3`.`b`)) left join `test`.`t1` `x4` on((`test`.`x3`.`u` = `test`.`x4`.`pk`)) left join `test`.`t1` `x5` on((`test`.`x4`.`a` = `test`.`x5`.`b`)) where 1
select count(*) from t1 as x1
left join t1 as x2 on x1.u=x2.pk
left join t1 as x3 on x2.a=x3.b
left join t1 as x4 on x3.u=x4.pk
left join t1 as x5 on x4.a=x5.b;
count(*)
1885
set ndb_join_pushdown=off;
select count(*) from t1 as x1
left join t1 as x2 on x1.u=x2.pk
left join t1 as x3 on x2.a=x3.b
left join t1 as x4 on x3.u=x4.pk
left join t1 as x5 on x4.a=x5.b;
count(*)
1885
set ndb_join_pushdown=on;
explain extended select count(*) from t1 as x1
join t1 as x2 on x1.a=x2.b
where x1.pk = 1 or x1.u=1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	index_merge	PRIMARY,ix2	ix2,PRIMARY	4,4	NULL	2	100.00	Using sort_union(ix2,PRIMARY); Using where with pushed condition: (((`test`.`x1`.`pk` = 1) or (`test`.`x1`.`u` = 1)) and (`test`.`x1`.`a` is not null))
1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	
Warnings:
Note	9999	Push of table 'x2' as scan-child with lookup-root 'x1' not implemented
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` where ((`test`.`x2`.`b` = `test`.`x1`.`a`) and ((`test`.`x1`.`pk` = 1) or (`test`.`x1`.`u` = 1)))
select count(*) from t1 as x1
join t1 as x2 on x1.a=x2.b
where x1.pk = 1 or x1.u=1;
count(*)
13
set ndb_join_pushdown=on;
explain extended
select straight_join * from t1 as table1
left join 
(t1 as table2  join t1 as table3 on table2.pk = table3.b)
on table1.pk = table2.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	table1	ALL	NULL	NULL	NULL	NULL	13	100.00	
1	SIMPLE	table2	ref	PRIMARY,ix1	ix1	5	test.table1.pk	2	100.00	Parent of 2 pushed join@1
1	SIMPLE	table3	ref	ix1	ix1	5	test.table2.pk	2	100.00	Child of 'table2' in pushed join@1
Warnings:
Note	9999	Can't push table 'table2' as child of 'table1', outer join of scan-child not implemented
Note	9999	Can't push table 'table3' as child of 'table1', column 'table2.pk' is outside scope of pushable join
Note	1003	/* select#1 */ select straight_join `test`.`table1`.`pk` AS `pk`,`test`.`table1`.`u` AS `u`,`test`.`table1`.`a` AS `a`,`test`.`table1`.`b` AS `b`,`test`.`table2`.`pk` AS `pk`,`test`.`table2`.`u` AS `u`,`test`.`table2`.`a` AS `a`,`test`.`table2`.`b` AS `b`,`test`.`table3`.`pk` AS `pk`,`test`.`table3`.`u` AS `u`,`test`.`table3`.`a` AS `a`,`test`.`table3`.`b` AS `b` from `test`.`t1` `table1` left join (`test`.`t1` `table2` join `test`.`t1` `table3`) on(((`test`.`table1`.`pk` = `test`.`table2`.`b`) and (`test`.`table2`.`pk` = `test`.`table3`.`b`))) where 1
select straight_join * from t1 as table1
left join 
(t1 as table2  join t1 as table3 on table2.pk = table3.b)
on table1.pk = table2.b;
pk	u	a	b	pk	u	a	b	pk	u	a	b
0	0	10	10	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
1	1	10	10	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
10	10	10	10	10	10	10	10	0	0	10	10
10	10	10	10	10	10	10	10	1	1	10	10
10	10	10	10	10	10	10	10	10	10	10	10
10	10	10	10	10	10	10	10	11	11	10	10
10	10	10	10	10	10	10	10	12	12	20	10
10	10	10	10	10	10	10	10	2	2	10	10
10	10	10	10	10	10	10	10	3	3	10	10
10	10	10	10	10	10	10	10	4	4	10	10
10	10	10	10	10	10	10	10	5	5	10	10
10	10	10	10	10	10	10	10	6	6	10	10
10	10	10	10	10	10	10	10	7	7	10	10
10	10	10	10	10	10	10	10	8	8	10	10
10	10	10	10	10	10	10	10	9	9	10	10
11	11	10	10	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
12	12	20	10	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
2	2	10	10	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
3	3	10	10	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
4	4	10	10	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
5	5	10	10	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
6	6	10	10	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
7	7	10	10	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
8	8	10	10	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
9	9	10	10	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
explain extended select straight_join * from t1 as x1 
inner join t1 as x2 on x2.b = x1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x1`.`a` is not null)
1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of 'x1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`u` AS `u`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x2`.`pk` AS `pk`,`test`.`x2`.`u` AS `u`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b` from `test`.`t1` `x1` join `test`.`t1` `x2` where (`test`.`x2`.`b` = `test`.`x1`.`a`)
explain extended select straight_join * from t1 as x1 
left join t1 as x2 on x2.b = x1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	
1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	
Warnings:
Note	9999	Can't push table 'x2' as child of 'x1', outer join of scan-child not implemented
Note	1003	/* select#1 */ select straight_join `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`u` AS `u`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x2`.`pk` AS `pk`,`test`.`x2`.`u` AS `u`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b` from `test`.`t1` `x1` left join `test`.`t1` `x2` on((`test`.`x2`.`b` = `test`.`x1`.`a`)) where 1
explain extended select straight_join * from t1 as x1 
right join t1 as x2 on x2.b = x1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x2	ALL	NULL	NULL	NULL	NULL	13	100.00	
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Using where; Using join buffer (Block Nested Loop)
Warnings:
Note	9999	Can't push table 'x1' as child, 'type' must be a 'ref' access
Note	1003	/* select#1 */ select straight_join `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`u` AS `u`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x2`.`pk` AS `pk`,`test`.`x2`.`u` AS `u`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b` from `test`.`t1` `x2` left join `test`.`t1` `x1` on((`test`.`x2`.`b` = `test`.`x1`.`a`)) where 1
explain extended select straight_join * from 
t1 as x1 inner join
(t1 as x2 inner join t1 as x3 on x3.b = x2.a)
on x2.pk = x1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 3 pushed join@1; Using where with pushed condition: (`test`.`x1`.`a` is not null)
1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	4	test.x1.a	1	100.00	Child of 'x1' in pushed join@1; Using where with pushed condition: (`test`.`x2`.`a` is not null)
1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	2	100.00	Child of 'x2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`u` AS `u`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x2`.`pk` AS `pk`,`test`.`x2`.`u` AS `u`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b`,`test`.`x3`.`pk` AS `pk`,`test`.`x3`.`u` AS `u`,`test`.`x3`.`a` AS `a`,`test`.`x3`.`b` AS `b` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x3`.`b` = `test`.`x2`.`a`) and (`test`.`x2`.`pk` = `test`.`x1`.`a`))
explain extended select straight_join * from 
t1 as x1 left join
(t1 as x2 inner join t1 as x3 on x3.b = x2.a)
on x2.pk = x1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1
1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	4	test.x1.a	1	100.00	Child of 'x1' in pushed join@1
1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	2	100.00	
Warnings:
Note	9999	Can't push table 'x3' as child of 'x1', outer join of scan-child not implemented
Note	1003	/* select#1 */ select straight_join `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`u` AS `u`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x2`.`pk` AS `pk`,`test`.`x2`.`u` AS `u`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b`,`test`.`x3`.`pk` AS `pk`,`test`.`x3`.`u` AS `u`,`test`.`x3`.`a` AS `a`,`test`.`x3`.`b` AS `b` from `test`.`t1` `x1` left join (`test`.`t1` `x2` join `test`.`t1` `x3`) on(((`test`.`x2`.`pk` = `test`.`x1`.`a`) and (`test`.`x3`.`b` = `test`.`x2`.`a`))) where 1
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';
explain extended select straight_join count(*) from t1 as x1 
join t1 as x2 on x2.b = x1.a
join t1 as x3 on x3.b = x1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	ix1	NULL	NULL	NULL	13	100.00	Parent of 3 pushed join@1; Using where with pushed condition: ((`test`.`x1`.`a` is not null) and (`test`.`x1`.`b` is not null))
1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of 'x1' in pushed join@1
1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.b	2	100.00	Child of 'x1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x2`.`b` = `test`.`x1`.`a`) and (`test`.`x3`.`b` = `test`.`x1`.`b`))
set ndb_join_pushdown=off;
select straight_join count(*) from t1 as x1 
join t1 as x2 on x2.b = x1.a
join t1 as x3 on x3.b = x1.b;
count(*)
2028
set ndb_join_pushdown=on;
select straight_join count(*) from t1 as x1 
join t1 as x2 on x2.b = x1.a
join t1 as x3 on x3.b = x1.b;
count(*)
2028
explain extended select straight_join count(*) from t1 as x1 
join t1 as x2 on x2.b = x1.a
join t1 as x3 on x3.b = x1.a
join t1 as x4 on x4.b = x1.a
join t1 as x5 on x5.b = x1.a
join t1 as x6 on x6.b = x1.a
join t1 as x7 on x7.b = x1.a
where x3.a < x2.pk and x4.a < x3.pk;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 7 pushed join@1; Using where with pushed condition: ((`test`.`x1`.`a` is not null) and (`test`.`x1`.`a` is not null))
1	SIMPLE	x2	ref	PRIMARY,ix1	ix1	5	test.x1.a	2	100.00	Child of 'x1' in pushed join@1; Using where with pushed condition: ((((`test`.`x2`.`b` is not null) and (`test`.`x2`.`b` is not null)) and (`test`.`x2`.`b` is not null)) and (`test`.`x2`.`b` is not null))
1	SIMPLE	x3	ref	PRIMARY,ix1	ix1	5	test.x2.b	2	100.00	Child of 'x1' in pushed join@1; Using where
1	SIMPLE	x4	ref	ix1	ix1	5	test.x2.b	2	100.00	Child of 'x1' in pushed join@1; Using where
1	SIMPLE	x5	ref	ix1	ix1	5	test.x2.b	2	100.00	Child of 'x1' in pushed join@1; Using where
1	SIMPLE	x6	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of 'x1' in pushed join@1
1	SIMPLE	x7	ref	ix1	ix1	5	test.x2.b	2	100.00	Child of 'x1' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` join `test`.`t1` `x4` join `test`.`t1` `x5` join `test`.`t1` `x6` join `test`.`t1` `x7` where ((`test`.`x2`.`b` = `test`.`x1`.`a`) and (`test`.`x3`.`b` = `test`.`x1`.`a`) and (`test`.`x4`.`b` = `test`.`x1`.`a`) and (`test`.`x5`.`b` = `test`.`x1`.`a`) and (`test`.`x6`.`b` = `test`.`x1`.`a`) and (`test`.`x7`.`b` = `test`.`x1`.`a`) and (`test`.`x3`.`a` < `test`.`x2`.`pk`) and (`test`.`x4`.`a` < `test`.`x3`.`pk`))
select straight_join count(*) from t1 as x1 
join t1 as x2 on x2.b = x1.a
join t1 as x3 on x3.b = x1.a
join t1 as x4 on x4.b = x1.a
join t1 as x5 on x5.b = x1.a
join t1 as x6 on x6.b = x1.a
join t1 as x7 on x7.b = x1.a
where x3.a < x2.pk and x4.a < x3.pk;
count(*)
632736
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';
explain extended select straight_join count(*) from t1 as x1 
left join t1 as x2 on x2.b = x1.a
join t1 as x3 on x3.b = x1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	ix1	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x1`.`b` is not null)
1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	
1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.b	2	100.00	Child of 'x1' in pushed join@1
Warnings:
Note	9999	Can't push table 'x2' as child of 'x1', outer join of scan-child not implemented
Note	1003	/* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x1` left join `test`.`t1` `x2` on((`test`.`x2`.`b` = `test`.`x1`.`a`)) join `test`.`t1` `x3` where (`test`.`x3`.`b` = `test`.`x1`.`b`)
set ndb_join_pushdown=off;
select straight_join count(*) from t1 as x1 
left join t1 as x2 on x2.b = x1.a
join t1 as x3 on x3.b = x1.b;
count(*)
2041
set ndb_join_pushdown=on;
select straight_join count(*) from t1 as x1 
left join t1 as x2 on x2.b = x1.a
join t1 as x3 on x3.b = x1.b;
count(*)
2041
explain extended select straight_join count(*) from t1 as x1 
join t1 as x2 on x2.b = x1.a
left join t1 as x3 on x3.b = x1.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x1`.`a` is not null)
1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of 'x1' in pushed join@1
1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.b	2	100.00	
Warnings:
Note	9999	Can't push table 'x3' as child of 'x1', outer join of scan-child not implemented
Note	1003	/* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` left join `test`.`t1` `x3` on((`test`.`x3`.`b` = `test`.`x1`.`b`)) where (`test`.`x2`.`b` = `test`.`x1`.`a`)
set ndb_join_pushdown=off;
select straight_join count(*) from t1 as x1 
join t1 as x2 on x2.b = x1.a
left join t1 as x3 on x3.b = x1.b;
count(*)
2028
set ndb_join_pushdown=on;
select straight_join count(*) from t1 as x1 
join t1 as x2 on x2.b = x1.a
left join t1 as x3 on x3.b = x1.b;
count(*)
2028
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';
explain extended
select straight_join count(*) from t1 as x1
join t1 as x2 on x2.b = x1.a
join t1 as x3 on x3.pk = x1.a join t1 as x4 on x4.b = x3.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 4 pushed join@1; Using where with pushed condition: ((`test`.`x1`.`a` is not null) and (`test`.`x1`.`a` is not null))
1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of 'x1' in pushed join@1
1	SIMPLE	x3	eq_ref	PRIMARY	PRIMARY	4	test.x1.a	1	100.00	Child of 'x1' in pushed join@1; Using where with pushed condition: (`test`.`x3`.`a` is not null)
1	SIMPLE	x4	ref	ix1	ix1	5	test.x3.a	2	100.00	Child of 'x3' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` join `test`.`t1` `x4` where ((`test`.`x2`.`b` = `test`.`x1`.`a`) and (`test`.`x3`.`pk` = `test`.`x1`.`a`) and (`test`.`x4`.`b` = `test`.`x3`.`a`))
set ndb_join_pushdown=off;
select straight_join count(*) from t1 as x1
join t1 as x2 on x2.b = x1.a
join t1 as x3 on x3.pk = x1.a join t1 as x4 on x4.b = x3.a;
count(*)
2028
set ndb_join_pushdown=on;
select straight_join count(*) from t1 as x1
join t1 as x2 on x2.b = x1.a
join t1 as x3 on x3.pk = x1.a join t1 as x4 on x4.b = x3.a;
count(*)
2028
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';
explain extended select straight_join count(*) from t1 as x1 
left join t1 as x3 on x3.b = x1.a
join t1 as x2 on x2.pk = x1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x1`.`a` is not null)
1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.a	2	100.00	
1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	4	test.x1.a	1	100.00	Child of 'x1' in pushed join@1
Warnings:
Note	9999	Can't push table 'x3' as child of 'x1', outer join of scan-child not implemented
Note	1003	/* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x1` left join `test`.`t1` `x3` on(((`test`.`x3`.`b` = `test`.`x1`.`a`) and (`test`.`x2`.`pk` = `test`.`x1`.`a`))) join `test`.`t1` `x2` where (`test`.`x2`.`pk` = `test`.`x1`.`a`)
select straight_join count(*) from t1 as x1 
left join t1 as x3 on x3.b = x1.a
join t1 as x2 on x2.pk = x1.a;
count(*)
156
update t1 set b=b+10;
select straight_join count(*) from t1 as x1 
left join t1 as x3 on x3.b = x1.a
join t1 as x2 on x2.pk = x1.a;
count(*)
12
update t1 set b=b-10;
update t1 set u=u+100;
set ndb_join_pushdown=on;
explain extended select straight_join count(*) from 
(t1 as x join t1 as y on y.b = x.a)
left outer join t1 as z on z.u = x.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 3 pushed join@1; Using where with pushed condition: (`test`.`x`.`a` is not null)
1	SIMPLE	y	ref	ix1	ix1	5	test.x.a	2	100.00	Child of 'x' in pushed join@1
1	SIMPLE	z	eq_ref	ix2	ix2	4	test.y.b	1	100.00	Child of 'x' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x` join `test`.`t1` `y` left join `test`.`t1` `z` on(((`test`.`y`.`b` = `test`.`x`.`a`) and (`test`.`z`.`u` = `test`.`x`.`a`))) where (`test`.`y`.`b` = `test`.`x`.`a`)
select straight_join count(*) from 
(t1 as x join t1 as y on y.b = x.a)
left outer join t1 as z on z.u = x.a;
count(*)
156
update t1 set u=u-100;
drop index ix2 on t1;
create unique index ix2 on t1(a,u);
set ndb_join_pushdown=on;
explain extended
select straight_join * from
t1 as table1 join 
(t1 as table2 join t1 as table3 on table3.a = table2.a)
on table3.u = table1.u
where table2.pk = 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	table1	ALL	NULL	NULL	NULL	NULL	13	100.00	
1	SIMPLE	table2	const	PRIMARY,ix2	PRIMARY	4	const	1	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`table2`.`a` is not null)
1	SIMPLE	table3	ref	ix2	ix2	9	test.table2.a,test.table1.u	1	100.00	Child of 'table2' in pushed join@1
Warnings:
Note	9999	Can't push table 'table2' as child of 'table1', their dependency is 'const'
Note	9999	Can't push table 'table3' as child of 'table1', column 'table2.a' is outside scope of pushable join
Note	1003	/* select#1 */ select straight_join `test`.`table1`.`pk` AS `pk`,`test`.`table1`.`u` AS `u`,`test`.`table1`.`a` AS `a`,`test`.`table1`.`b` AS `b`,`test`.`table2`.`pk` AS `pk`,`test`.`table2`.`u` AS `u`,`test`.`table2`.`a` AS `a`,`test`.`table2`.`b` AS `b`,`test`.`table3`.`pk` AS `pk`,`test`.`table3`.`u` AS `u`,`test`.`table3`.`a` AS `a`,`test`.`table3`.`b` AS `b` from `test`.`t1` `table1` join `test`.`t1` `table2` join `test`.`t1` `table3` where ((`test`.`table3`.`a` = `test`.`table2`.`a`) and (`test`.`table3`.`u` = `test`.`table1`.`u`) and (`test`.`table2`.`pk` = 3))
select straight_join * from
t1 as table1 join 
(t1 as table2 join t1 as table3 on table3.a = table2.a)
on table3.u = table1.u
where table2.pk = 3;
pk	u	a	b	pk	u	a	b	pk	u	a	b
0	0	10	10	3	3	10	10	0	0	10	10
1	1	10	10	3	3	10	10	1	1	10	10
10	10	10	10	3	3	10	10	10	10	10	10
11	11	10	10	3	3	10	10	11	11	10	10
2	2	10	10	3	3	10	10	2	2	10	10
3	3	10	10	3	3	10	10	3	3	10	10
4	4	10	10	3	3	10	10	4	4	10	10
5	5	10	10	3	3	10	10	5	5	10	10
6	6	10	10	3	3	10	10	6	6	10	10
7	7	10	10	3	3	10	10	7	7	10	10
8	8	10	10	3	3	10	10	8	8	10	10
9	9	10	10	3	3	10	10	9	9	10	10
drop table t1;
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), (1,2,1,1), (1,3,1,1), (1,4,1,2);
CREATE TABLE t2 (
a int NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=ndbcluster;
CREATE TABLE t3 (
a int NOT NULL,
b int NOT NULL,
PRIMARY KEY (`a`,`b`)
) ENGINE=ndbcluster;
insert into t2 values (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
insert into t3 select 1, x1.a * 10+x2.a from t2 as x1 cross join t2 as x2;
explain select straight_join count(*) from t1 as x0  
join t3 as x1 on x0.c=x1.a  
join t1 as x2 on x0.c=x2.a 
join t3 as x3 on x2.c=x3.a  
join t1 as x4 on x0.d=x4.a and x3.b=x4.b;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x0	ALL	NULL	NULL	NULL	NULL	4	Parent of 5 pushed join@1
1	SIMPLE	x1	ref	PRIMARY	PRIMARY	4	test.x0.c	1	Child of 'x0' in pushed join@1
1	SIMPLE	x2	ref	PRIMARY	PRIMARY	4	test.x0.c	1	Child of 'x0' in pushed join@1
1	SIMPLE	x3	ref	PRIMARY	PRIMARY	4	test.x2.c	1	Child of 'x2' in pushed join@1
1	SIMPLE	x4	eq_ref	PRIMARY	PRIMARY	8	test.x0.d,test.x3.b	1	Child of 'x3' in pushed join@1
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';
select straight_join count(*) from t1 as x0  
join t3 as x1 on x0.c=x1.a  
join t1 as x2 on x0.c=x2.a 
join t3 as x3 on x2.c=x3.a  
join t1 as x4 on x0.d=x4.a and x3.b=x4.b;
count(*)
4800
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';
drop table t1;
drop table t2;
drop table t3;
create table t1(
d int not null,
e int     null,
f int     null,
a int not null,
b int not null,
c int not null,
primary key (a,b,c))
engine = ndb partition by key (b);
insert into t1(a,b,c,d,e,f) values
(1, 2, 3, 1, 2, 3),
(1, 2, 4, 1, 2, 3),
(2, 3, 4, 1, 2, 3),
(3, 4, 5, 1, 2, 3),
(4, 5, 6, 1, 2, 3),
(5, 6, 7, 1, 2, 3),
(6, 7, 8, 1, 2, 3),
(7, 8, 9, 1, 2, 3);
set ndb_join_pushdown=on;
explain extended
select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	8	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`e` is not null)
1	SIMPLE	y	ref	PRIMARY	PRIMARY	8	test.x.d,test.x.e	1	100.00	Child of 'x' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x`.`d` AS `d`,`test`.`x`.`e` AS `e`,`test`.`x`.`f` AS `f`,`test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`y`.`d` AS `d`,`test`.`y`.`e` AS `e`,`test`.`y`.`f` AS `f`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`b` = `test`.`x`.`e`) and (`test`.`y`.`a` = `test`.`x`.`d`))
select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
d	e	f	a	b	c	d	e	f	a	b	c
1	2	3	1	2	3	1	2	3	1	2	3
1	2	3	1	2	3	1	2	3	1	2	4
1	2	3	1	2	4	1	2	3	1	2	3
1	2	3	1	2	4	1	2	3	1	2	4
1	2	3	2	3	4	1	2	3	1	2	3
1	2	3	2	3	4	1	2	3	1	2	4
1	2	3	3	4	5	1	2	3	1	2	3
1	2	3	3	4	5	1	2	3	1	2	4
1	2	3	4	5	6	1	2	3	1	2	3
1	2	3	4	5	6	1	2	3	1	2	4
1	2	3	5	6	7	1	2	3	1	2	3
1	2	3	5	6	7	1	2	3	1	2	4
1	2	3	6	7	8	1	2	3	1	2	3
1	2	3	6	7	8	1	2	3	1	2	4
1	2	3	7	8	9	1	2	3	1	2	3
1	2	3	7	8	9	1	2	3	1	2	4
alter table t1 partition by key (a);
select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
d	e	f	a	b	c	d	e	f	a	b	c
1	2	3	1	2	3	1	2	3	1	2	3
1	2	3	1	2	3	1	2	3	1	2	4
1	2	3	1	2	4	1	2	3	1	2	3
1	2	3	1	2	4	1	2	3	1	2	4
1	2	3	2	3	4	1	2	3	1	2	3
1	2	3	2	3	4	1	2	3	1	2	4
1	2	3	3	4	5	1	2	3	1	2	3
1	2	3	3	4	5	1	2	3	1	2	4
1	2	3	4	5	6	1	2	3	1	2	3
1	2	3	4	5	6	1	2	3	1	2	4
1	2	3	5	6	7	1	2	3	1	2	3
1	2	3	5	6	7	1	2	3	1	2	4
1	2	3	6	7	8	1	2	3	1	2	3
1	2	3	6	7	8	1	2	3	1	2	4
1	2	3	7	8	9	1	2	3	1	2	3
1	2	3	7	8	9	1	2	3	1	2	4
alter table t1 partition by key (a,b);
select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
d	e	f	a	b	c	d	e	f	a	b	c
1	2	3	1	2	3	1	2	3	1	2	3
1	2	3	1	2	3	1	2	3	1	2	4
1	2	3	1	2	4	1	2	3	1	2	3
1	2	3	1	2	4	1	2	3	1	2	4
1	2	3	2	3	4	1	2	3	1	2	3
1	2	3	2	3	4	1	2	3	1	2	4
1	2	3	3	4	5	1	2	3	1	2	3
1	2	3	3	4	5	1	2	3	1	2	4
1	2	3	4	5	6	1	2	3	1	2	3
1	2	3	4	5	6	1	2	3	1	2	4
1	2	3	5	6	7	1	2	3	1	2	3
1	2	3	5	6	7	1	2	3	1	2	4
1	2	3	6	7	8	1	2	3	1	2	3
1	2	3	6	7	8	1	2	3	1	2	4
1	2	3	7	8	9	1	2	3	1	2	3
1	2	3	7	8	9	1	2	3	1	2	4
alter table t1 partition by key (b,a);
select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
d	e	f	a	b	c	d	e	f	a	b	c
1	2	3	1	2	3	1	2	3	1	2	3
1	2	3	1	2	3	1	2	3	1	2	4
1	2	3	1	2	4	1	2	3	1	2	3
1	2	3	1	2	4	1	2	3	1	2	4
1	2	3	2	3	4	1	2	3	1	2	3
1	2	3	2	3	4	1	2	3	1	2	4
1	2	3	3	4	5	1	2	3	1	2	3
1	2	3	3	4	5	1	2	3	1	2	4
1	2	3	4	5	6	1	2	3	1	2	3
1	2	3	4	5	6	1	2	3	1	2	4
1	2	3	5	6	7	1	2	3	1	2	3
1	2	3	5	6	7	1	2	3	1	2	4
1	2	3	6	7	8	1	2	3	1	2	3
1	2	3	6	7	8	1	2	3	1	2	4
1	2	3	7	8	9	1	2	3	1	2	3
1	2	3	7	8	9	1	2	3	1	2	4
alter table t1 partition by key (b);
select straight_join * from t1 x, t1 y where y.a=x.d and y.b=2;
d	e	f	a	b	c	d	e	f	a	b	c
1	2	3	1	2	3	1	2	3	1	2	3
1	2	3	1	2	3	1	2	3	1	2	4
1	2	3	1	2	4	1	2	3	1	2	3
1	2	3	1	2	4	1	2	3	1	2	4
1	2	3	2	3	4	1	2	3	1	2	3
1	2	3	2	3	4	1	2	3	1	2	4
1	2	3	3	4	5	1	2	3	1	2	3
1	2	3	3	4	5	1	2	3	1	2	4
1	2	3	4	5	6	1	2	3	1	2	3
1	2	3	4	5	6	1	2	3	1	2	4
1	2	3	5	6	7	1	2	3	1	2	3
1	2	3	5	6	7	1	2	3	1	2	4
1	2	3	6	7	8	1	2	3	1	2	3
1	2	3	6	7	8	1	2	3	1	2	4
1	2	3	7	8	9	1	2	3	1	2	3
1	2	3	7	8	9	1	2	3	1	2	4
alter table t1 partition by key (a);
select straight_join * from t1 x, t1 y where y.a=1 and y.b=x.e;
d	e	f	a	b	c	d	e	f	a	b	c
1	2	3	1	2	3	1	2	3	1	2	3
1	2	3	1	2	3	1	2	3	1	2	4
1	2	3	1	2	4	1	2	3	1	2	3
1	2	3	1	2	4	1	2	3	1	2	4
1	2	3	2	3	4	1	2	3	1	2	3
1	2	3	2	3	4	1	2	3	1	2	4
1	2	3	3	4	5	1	2	3	1	2	3
1	2	3	3	4	5	1	2	3	1	2	4
1	2	3	4	5	6	1	2	3	1	2	3
1	2	3	4	5	6	1	2	3	1	2	4
1	2	3	5	6	7	1	2	3	1	2	3
1	2	3	5	6	7	1	2	3	1	2	4
1	2	3	6	7	8	1	2	3	1	2	3
1	2	3	6	7	8	1	2	3	1	2	4
1	2	3	7	8	9	1	2	3	1	2	3
1	2	3	7	8	9	1	2	3	1	2	4
select straight_join * from t1 x, t1 y where y.a=0 and y.b=x.e;
d	e	f	a	b	c	d	e	f	a	b	c
alter table t1 partition by key (a,b);
select straight_join * from t1 x, t1 y where y.a=1 and y.b=x.e;
d	e	f	a	b	c	d	e	f	a	b	c
1	2	3	1	2	3	1	2	3	1	2	3
1	2	3	1	2	3	1	2	3	1	2	4
1	2	3	1	2	4	1	2	3	1	2	3
1	2	3	1	2	4	1	2	3	1	2	4
1	2	3	2	3	4	1	2	3	1	2	3
1	2	3	2	3	4	1	2	3	1	2	4
1	2	3	3	4	5	1	2	3	1	2	3
1	2	3	3	4	5	1	2	3	1	2	4
1	2	3	4	5	6	1	2	3	1	2	3
1	2	3	4	5	6	1	2	3	1	2	4
1	2	3	5	6	7	1	2	3	1	2	3
1	2	3	5	6	7	1	2	3	1	2	4
1	2	3	6	7	8	1	2	3	1	2	3
1	2	3	6	7	8	1	2	3	1	2	4
1	2	3	7	8	9	1	2	3	1	2	3
1	2	3	7	8	9	1	2	3	1	2	4
select straight_join * from t1 x, t1 y where y.a=x.d and y.b=2;
d	e	f	a	b	c	d	e	f	a	b	c
1	2	3	1	2	3	1	2	3	1	2	3
1	2	3	1	2	3	1	2	3	1	2	4
1	2	3	1	2	4	1	2	3	1	2	3
1	2	3	1	2	4	1	2	3	1	2	4
1	2	3	2	3	4	1	2	3	1	2	3
1	2	3	2	3	4	1	2	3	1	2	4
1	2	3	3	4	5	1	2	3	1	2	3
1	2	3	3	4	5	1	2	3	1	2	4
1	2	3	4	5	6	1	2	3	1	2	3
1	2	3	4	5	6	1	2	3	1	2	4
1	2	3	5	6	7	1	2	3	1	2	3
1	2	3	5	6	7	1	2	3	1	2	4
1	2	3	6	7	8	1	2	3	1	2	3
1	2	3	6	7	8	1	2	3	1	2	4
1	2	3	7	8	9	1	2	3	1	2	3
1	2	3	7	8	9	1	2	3	1	2	4
alter table t1 drop primary key, add primary key using hash (d,b,a,c);
alter table t1 partition by key (b);
create index ix1 on t1(b,d,a);
explain extended
select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x	ALL	PRIMARY	NULL	NULL	NULL	8	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`e` is not null)
1	SIMPLE	y	ref	ix1	ix1	4	test.x.e	1	100.00	Child of 'x' in pushed join@1; Using where
Warnings:
Note	1003	/* select#1 */ select straight_join `test`.`x`.`d` AS `d`,`test`.`x`.`e` AS `e`,`test`.`x`.`f` AS `f`,`test`.`x`.`a` AS `a`,`test`.`x`.`b` AS `b`,`test`.`x`.`c` AS `c`,`test`.`y`.`d` AS `d`,`test`.`y`.`e` AS `e`,`test`.`y`.`f` AS `f`,`test`.`y`.`a` AS `a`,`test`.`y`.`b` AS `b`,`test`.`y`.`c` AS `c` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`b` = `test`.`x`.`e`) and (`test`.`y`.`a` = `test`.`x`.`d`))
insert into t1(a,b,c,d,e,f) values
(8, 9, 0, 1,  null, 3),
(9, 9, 0, 1,  2,    null);
alter table t1 partition by key (b);
select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
d	e	f	a	b	c	d	e	f	a	b	c
1	2	3	1	2	3	1	2	3	1	2	3
1	2	3	1	2	3	1	2	3	1	2	4
1	2	3	1	2	4	1	2	3	1	2	3
1	2	3	1	2	4	1	2	3	1	2	4
1	2	3	2	3	4	1	2	3	1	2	3
1	2	3	2	3	4	1	2	3	1	2	4
1	2	3	3	4	5	1	2	3	1	2	3
1	2	3	3	4	5	1	2	3	1	2	4
1	2	3	4	5	6	1	2	3	1	2	3
1	2	3	4	5	6	1	2	3	1	2	4
1	2	3	5	6	7	1	2	3	1	2	3
1	2	3	5	6	7	1	2	3	1	2	4
1	2	3	6	7	8	1	2	3	1	2	3
1	2	3	6	7	8	1	2	3	1	2	4
1	2	3	7	8	9	1	2	3	1	2	3
1	2	3	7	8	9	1	2	3	1	2	4
1	2	NULL	9	9	0	1	2	3	1	2	3
1	2	NULL	9	9	0	1	2	3	1	2	4
pruned
14
const_pruned
6
drop table t1;
create table t1 (pk int primary key, a int, b int) engine=ndb;
create index ix1 on t1(b,a);
insert into t1 values (0,10,10);
insert into t1 values (1,10,20);
insert into t1 values (2,20,20);
insert into t1 values (3,10,10);
insert into t1 values (4,10,20);
insert into t1 values (5,10,20);
insert into t1 values (6,10,10);
insert into t1 values (7,10,10);
insert into t1 values (8,10,20);
insert into t1 values (9,10,10);
explain extended select x1.pk,x1.a,x1.b from t1 as x1 
join t1 as x2 on x1.a=x2.b 
join t1 as x3 on x2.a=x3.b 
order by x1.pk limit 70;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	index	NULL	PRIMARY	4	NULL	10	100.00	Parent of 3 pushed join@1; Using where with pushed condition: (`test`.`x1`.`a` is not null); Using temporary; Using filesort
1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of 'x1' in pushed join@1; Using where with pushed condition: (`test`.`x2`.`a` is not null)
1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	2	100.00	Child of 'x2' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x2`.`b` = `test`.`x1`.`a`) and (`test`.`x3`.`b` = `test`.`x2`.`a`)) order by `test`.`x1`.`pk` limit 70
select x1.pk,x1.a,x1.b from t1 as x1 
join t1 as x2 on x1.a=x2.b 
join t1 as x3 on x2.a=x3.b 
order by x1.pk limit 70;
pk	a	b
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
0	10	10
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
1	10	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
2	20	20
explain extended select * from t1 as x1, t1 as x2 where x1.a=x2.b and x1.b = 3;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ref	ix1	ix1	5	const	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x1`.`a` is not null)
1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of 'x1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x2`.`pk` AS `pk`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b` from `test`.`t1` `x1` join `test`.`t1` `x2` where ((`test`.`x1`.`b` = 3) and (`test`.`x2`.`b` = `test`.`x1`.`a`))
select * from t1 as x1, t1 as x2 where x1.a=x2.b and x1.b = 3;
pk	a	b	pk	a	b
drop table t1;
create table t (pk int primary key, a int) engine=ndb;
insert into t values 
(1,1), (2,1),
(4,3), (6,3),
(7,4), (8,4);
explain extended
select distinct straight_join table1.pk FROM 
t as table1  join
(t as table2  join  
(t as table3  join t as table4 on table3.pk = table4.a)
on table2.pk =  table3.pk )
on table1.a =  table4.pk
where  table2.pk != 6;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	table1	ALL	NULL	NULL	NULL	NULL	6	100.00	Using where with pushed condition: (`test`.`table1`.`a` is not null); Using temporary
1	SIMPLE	table2	range	PRIMARY	PRIMARY	4	NULL	6	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`table2`.`pk` <> 6); Distinct; Using join buffer (Block Nested Loop)
1	SIMPLE	table3	eq_ref	PRIMARY	PRIMARY	4	test.table2.pk	1	100.00	Child of 'table2' in pushed join@1; Distinct
1	SIMPLE	table4	eq_ref	PRIMARY	PRIMARY	4	test.table1.a	1	100.00	Using where; Distinct
Warnings:
Note	9999	Can't push table 'table2' as child, 'type' must be a 'ref' access
Note	9999	Cannot push table 'table3' as child of table 'table1'. Doing so would prevent using join buffer for table 'table2'.
Note	9999	Cannot push table 'table4' as child of table 'table1'. Doing so would prevent using join buffer for table 'table2'.
Note	9999	Cannot push table 'table4' as child of 'table2', since it referes to column 'table1.a' which will be stored in a join buffer.
Note	1003	/* select#1 */ select straight_join distinct `test`.`table1`.`pk` AS `pk` from `test`.`t` `table1` join `test`.`t` `table2` join `test`.`t` `table3` join `test`.`t` `table4` where ((`test`.`table3`.`pk` = `test`.`table2`.`pk`) and (`test`.`table4`.`a` = `test`.`table2`.`pk`) and (`test`.`table4`.`pk` = `test`.`table1`.`a`) and (`test`.`table2`.`pk` <> 6))
select distinct straight_join table1.pk FROM 
t as table1  join
(t as table2  join  
(t as table3  join t as table4 on table3.pk = table4.a)
on table2.pk =  table3.pk )
on table1.a =  table4.pk
where  table2.pk != 6;
pk
1
2
drop table t;
create table t (b int, a int, primary key (a,b)) engine=ndb;
insert into t values(0,0);
explain extended
select * from t as t1 join t as t2 on t2.a=t1.a where t1.a < 8 or t1.a >= 8;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	PRIMARY	PRIMARY	0	NULL	2	100.00	Parent of 2 pushed join@1; Using where with pushed condition: ((`test`.`t1`.`a` < 8) or (`test`.`t1`.`a` >= 8))
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.a	1	100.00	Child of 't1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t` `t1` join `test`.`t` `t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and ((`test`.`t1`.`a` < 8) or (`test`.`t1`.`a` >= 8)))
select * from t as t1 join t as t2 on t2.a=t1.a where t1.a < 8 or t1.a >= 8;
b	a	b	a
0	0	0	0
drop table t;
create table t (pk1 int, pk2 int, primary key(pk1,pk2)) engine = ndb;
insert into t values (1,3), (3,6), (6,9), (9,1);
explain extended
select * from t as t1 join t as t2
on t1.pk2 = t2.pk1 
where t1.pk1 != 6
order by t1.pk1 DESC;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	6	66.67	Using where with pushed condition: (`test`.`t1`.`pk1` <> 6)
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.pk2	1	100.00	
Warnings:
Note	9999	Push of table 't2' as scan-child with ordered indexscan-root 't1' not implemented
Note	1003	/* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`pk2` AS `pk2`,`test`.`t2`.`pk1` AS `pk1`,`test`.`t2`.`pk2` AS `pk2` from `test`.`t` `t1` join `test`.`t` `t2` where ((`test`.`t2`.`pk1` = `test`.`t1`.`pk2`) and (`test`.`t1`.`pk1` <> 6)) order by `test`.`t1`.`pk1` desc
select * from t as t1 join t as t2
on t1.pk2 = t2.pk1 
where t1.pk1 != 6
order by t1.pk1 DESC;
pk1	pk2	pk1	pk2
9	1	1	3
3	6	6	9
1	3	3	6
drop table t;
create table t (k int, uq int, unique key ix1 (uq)) engine = ndb;
insert into t values (1,3), (3,NULL), (6,9), (9,1);
explain extended
select straight_join * from t as a join t as b 
on a.uq=b.uq or b.uq is null;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	a	ALL	ix1	NULL	NULL	NULL	4	100.00	
1	SIMPLE	b	ref_or_null	ix1	ix1	5	test.a.uq	2	100.00	Using where
Warnings:
Note	9999	Table 'b' is not pushable: This table access method can not be pushed.
Note	1003	/* select#1 */ select straight_join `test`.`a`.`k` AS `k`,`test`.`a`.`uq` AS `uq`,`test`.`b`.`k` AS `k`,`test`.`b`.`uq` AS `uq` from `test`.`t` `a` join `test`.`t` `b` where ((`test`.`b`.`uq` = `test`.`a`.`uq`) or isnull(`test`.`b`.`uq`))
select straight_join * from t as a join t as b 
on a.uq=b.uq or b.uq is null;
k	uq	k	uq
1	3	1	3
1	3	3	NULL
3	NULL	3	NULL
6	9	3	NULL
6	9	6	9
9	1	3	NULL
9	1	9	1
drop table t;
create table t (k int primary key, uq int) engine = ndb;
insert into t values (1,3), (3,NULL), (6,9), (9,1);
explain extended
select * from t as a left join t as b 
on a.k is null and a.uq=b.uq;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	a	ALL	NULL	NULL	NULL	NULL	4	100.00	
1	SIMPLE	b	ALL	NULL	NULL	NULL	NULL	4	100.00	Using where; Using join buffer (Block Nested Loop)
Warnings:
Note	9999	Can't push table 'b' as child, 'type' must be a 'ref' access
Note	1003	/* select#1 */ select `test`.`a`.`k` AS `k`,`test`.`a`.`uq` AS `uq`,`test`.`b`.`k` AS `k`,`test`.`b`.`uq` AS `uq` from `test`.`t` `a` left join `test`.`t` `b` on((<cache>(isnull(`test`.`a`.`k`)) and (`test`.`a`.`uq` = `test`.`b`.`uq`))) where 1
select * from t as a left join t as b 
on a.k is null and a.uq=b.uq;
k	uq	k	uq
1	3	NULL	NULL
3	NULL	NULL	NULL
6	9	NULL	NULL
9	1	NULL	NULL
drop table t;
create table tc(
a varchar(10) not null,
b varchar(10),
c varchar(10),
primary key (a),
unique key uk1 (b, c) 
)engine=ndbcluster;
insert into tc values ('aa','bb', 'x'), ('bb','cc', 'x'), ('cc', 'dd', 'x');
explain extended select * from tc as x1 
right outer join tc as x2 on x1.b=x2.a   
left outer join tc as x3 on x2.b = x3.b and x1.c=x3.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x2	ALL	NULL	NULL	NULL	NULL	3	100.00	
1	SIMPLE	x1	ref	uk1	uk1	13	test.x2.a	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	x3	ref	uk1	uk1	26	test.x2.b,test.x1.c	1	100.00	Child of 'x1' in pushed join@1
Warnings:
Note	9999	Can't push table 'x1' as child of 'x2', outer join of scan-child not implemented
Note	9999	Can't push table 'x3' as child of 'x2', column 'x1.c' is outside scope of pushable join
Note	1003	/* select#1 */ select `test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x1`.`c` AS `c`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b`,`test`.`x2`.`c` AS `c`,`test`.`x3`.`a` AS `a`,`test`.`x3`.`b` AS `b`,`test`.`x3`.`c` AS `c` from `test`.`tc` `x2` left join `test`.`tc` `x1` on((`test`.`x1`.`b` = `test`.`x2`.`a`)) left join `test`.`tc` `x3` on(((`test`.`x2`.`b` = `test`.`x3`.`b`) and (`test`.`x1`.`c` = `test`.`x3`.`c`))) where 1
select * from tc as x1 
right outer join tc as x2 on x1.b=x2.a   
left outer join tc as x3 on x2.b = x3.b and x1.c=x3.c;
a	b	c	a	b	c	a	b	c
NULL	NULL	NULL	aa	bb	x	NULL	NULL	NULL
aa	bb	x	bb	cc	x	bb	cc	x
bb	cc	x	cc	dd	x	cc	dd	x
explain extended select * from tc as x1, tc as x2 where x1.b=x2.a for update;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	uk1	NULL	NULL	NULL	3	100.00	Using where with pushed condition: (`test`.`x1`.`b` is not null)
1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	12	test.x1.b	1	100.00	
Warnings:
Note	9999	Table 'x1' is not pushable: lock modes other than 'read committed' not implemented
Note	9999	Table 'x2' is not pushable: lock modes other than 'read committed' not implemented
Note	1003	/* select#1 */ select `test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x1`.`c` AS `c`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b`,`test`.`x2`.`c` AS `c` from `test`.`tc` `x1` join `test`.`tc` `x2` where (`test`.`x2`.`a` = `test`.`x1`.`b`)
explain extended select * from tc as x1, tc as x2 where x1.b=x2.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	uk1	NULL	NULL	NULL	3	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x1`.`b` is not null)
1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	12	test.x1.b	1	100.00	Child of 'x1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x1`.`c` AS `c`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b`,`test`.`x2`.`c` AS `c` from `test`.`tc` `x1` join `test`.`tc` `x2` where (`test`.`x2`.`a` = `test`.`x1`.`b`)
drop table tc;
create table t1 (
a varchar(16) not null,
b int not null,
c varchar(16) not null,
d int not null,
primary key (a,b)
) engine ndb partition by key (a);
insert into t1  values ('aaa', 1, 'aaa', 1);
explain extended
select * from t1 as q1, t1 as q2 where q1.a = 'aaa' and q1.c=q2.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	q1	ref	PRIMARY	PRIMARY	18	const	2	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`q1`.`a` = 'aaa')
1	SIMPLE	q2	ref	PRIMARY	PRIMARY	18	test.q1.c	1	100.00	Child of 'q1' in pushed join@1
Warnings:
Note	1003	/* select#1 */ select `test`.`q1`.`a` AS `a`,`test`.`q1`.`b` AS `b`,`test`.`q1`.`c` AS `c`,`test`.`q1`.`d` AS `d`,`test`.`q2`.`a` AS `a`,`test`.`q2`.`b` AS `b`,`test`.`q2`.`c` AS `c`,`test`.`q2`.`d` AS `d` from `test`.`t1` `q1` join `test`.`t1` `q2` where ((`test`.`q2`.`a` = `test`.`q1`.`c`) and (`test`.`q1`.`a` = 'aaa'))
select * from t1 as q1, t1 as q2 where q1.a = 'aaa' and q1.c=q2.a;
a	b	c	d	a	b	c	d
aaa	1	aaa	1	aaa	1	aaa	1
drop table t1;
CREATE TABLE t1 (
a int NOT NULL,
b int NOT NULL,
c int NOT NULL,
d int,
PRIMARY KEY (`a`,`b`),
unique key(c)
) ENGINE=ndbcluster;
insert into t1 values
(1,1,1,1), 
(1,2,2,1), 
(1,3,3,1), 
(1,4,4,1), 
(1,5,5,2), 
(1,6,6,2), 
(1,7,7,2), 
(1,8,8,2);
explain extended select count(*) from t1 as x1 
join (t1 as x2 
left join (t1 as x3 
cross join t1 as x4) 
on x2.d=x3.a) 
on x2.c is null or x1.a=x4.d;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x2	ALL	NULL	NULL	NULL	NULL	8	100.00	
1	SIMPLE	x3	ref	PRIMARY	PRIMARY	4	test.x2.d	1	100.00	
1	SIMPLE	x4	ALL	NULL	NULL	NULL	NULL	8	100.00	Parent of 2 pushed join@1; Using where
1	SIMPLE	x1	ref	PRIMARY	PRIMARY	4	test.x4.d	1	100.00	Child of 'x4' in pushed join@1
Warnings:
Note	9999	Can't push table 'x3' as child of 'x2', outer join of scan-child not implemented
Note	9999	Can't push table 'x4' as child, 'type' must be a 'ref' access
Note	9999	Can't push table 'x1' as child of 'x2', column 'x4.d' is outside scope of pushable join
Note	9999	Can't push table 'x1' as child of 'x3', column 'x4.d' is outside scope of pushable join
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` left join (`test`.`t1` `x3` join `test`.`t1` `x4`) on((`test`.`x3`.`a` = `test`.`x2`.`d`)) where (`test`.`x1`.`a` = `test`.`x4`.`d`)
select count(*) from t1 as x1 
join (t1 as x2 
left join (t1 as x3 
cross join t1 as x4) 
on x2.d=x3.a) 
on x2.c is null or x1.a=x4.d;
count(*)
1024
explain extended select count(*) from t1 as x1 
left join (t1 as x2 
cross join t1 as x3) 
on x1.d=x2.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	8	100.00	
1	SIMPLE	x2	ref	PRIMARY	PRIMARY	4	test.x1.d	1	100.00	
1	SIMPLE	x3	ALL	NULL	NULL	NULL	NULL	8	100.00	
Warnings:
Note	9999	Can't push table 'x2' as child of 'x1', outer join of scan-child not implemented
Note	9999	Can't push table 'x3' as child, 'type' must be a 'ref' access
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` left join (`test`.`t1` `x2` join `test`.`t1` `x3`) on((`test`.`x1`.`d` = `test`.`x2`.`a`)) where 1
select count(*) from t1 as x1 
left join (t1 as x2 
cross join t1 as x3) 
on x1.d=x2.a;
count(*)
260
explain extended select count(*) from t1 as x0 
left join (t1 as x1 
join (t1 as x2 
left join (t1 as x3 
join t1 as x4 on x3.d=x4.a) 
on x2.d=x3.a) 
on x2.c is null or x1.a=x4.d) 
on x0.d=x1.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	x0	ALL	NULL	NULL	NULL	NULL	8	100.00	
1	SIMPLE	x1	ref	PRIMARY	PRIMARY	4	test.x0.d	1	100.00	
1	SIMPLE	x2	ALL	c	NULL	NULL	NULL	8	100.00	
1	SIMPLE	x3	ref	PRIMARY	PRIMARY	4	test.x2.d	1	100.00	Parent of 2 pushed join@1
1	SIMPLE	x4	ref	PRIMARY	PRIMARY	4	test.x3.d	1	100.00	Child of 'x3' in pushed join@1; Using where
Warnings:
Note	9999	Can't push table 'x1' as child of 'x0', outer join of scan-child not implemented
Note	9999	Can't push table 'x2' as child, 'type' must be a 'ref' access
Note	9999	Can't push table 'x3' as child of 'x0', column 'x2.d' is outside scope of pushable join
Note	9999	Can't push table 'x4' as child of 'x0', column 'x3.d' is outside scope of pushable join
Note	9999	Can't push table 'x3' as child of 'x1', column 'x2.d' is outside scope of pushable join
Note	9999	Can't push table 'x4' as child of 'x1', column 'x3.d' is outside scope of pushable join
Note	9999	Can't push table 'x3' as child of 'x2', outer join of scan-child not implemented
Note	9999	Can't push table 'x4' as child of 'x2', column 'x3.d' is outside scope of pushable join
Note	1003	/* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x0` left join (`test`.`t1` `x1` join `test`.`t1` `x2` left join (`test`.`t1` `x3` join `test`.`t1` `x4`) on(((`test`.`x2`.`d` = `test`.`x3`.`a`) and (`test`.`x3`.`d` = `test`.`x4`.`a`)))) on(((`test`.`x0`.`d` = `test`.`x1`.`a`) and (isnull(`test`.`x2`.`c`) or (`test`.`x1`.`a` = `test`.`x4`.`d`)))) where 1
select count(*) from t1 as x0 
left join (t1 as x1 
join (t1 as x2 
left join (t1 as x3 
join t1 as x4 on x3.d=x4.a) 
on x2.d=x3.a) 
on x2.c is null or x1.a=x4.d) 
on x0.d=x1.a;
count(*)
2052
drop table t1;
create table t1 (pk char(10) primary key, u int not null) engine=ndb;
create table t2 (pk int primary key, u int not null) engine=ndb;
insert into t1 values ('wh',1);
insert into t1 values ('ik',2);
insert into t1 values ('cu',3);
insert into t1 values ('pw',4);
insert into t1 values ('cq',4);
insert into t2 values (1,2), (2,3), (3,4), (4,5);
explain select * from t1 join t2 on t1.u = t2.pk order by t1.pk;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	index	NULL	PRIMARY	10	NULL	5	Parent of 2 pushed join@1
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.u	1	Child of 't1' in pushed join@1
select * from t1 join t2 on t1.u = t2.pk order by t1.pk;
pk	u	pk	u
cq	4	4	5
cu	3	3	4
ik	2	2	3
pw	4	4	5
wh	1	1	2
drop table t1;
drop table t2;
create table t1 (
a char(10) primary key,
b char(10) not null,
c char(10) not null,
l00 char(255) not null,
l01 char(255) not null,
l02 char(255) not null,
l03 char(255) not null,
l04 char(255) not null,
l05 char(255) not null,
l06 char(255) not null,
l07 char(255) not null,
l08 char(255) not null,
l09 char(255) not null,
l10 char(255) not null,
l11 char(255) not null,
l12 char(255) not null,
l13 char(255) not null,
l14 char(255) not null,
l15 char(255) not null,
l16 char(255) not null,
l17 char(255) not null,
l18 char(255) not null,
l19 char(255) not null,
l20 char(255) not null,
l21 char(255) not null,
l22 char(255) not null,
l23 char(255) not null,
l24 char(255) not null,
l25 char(255) not null,
l26 char(255) not null,
l27 char(255) not null,
l28 char(255) not null,
l29 char(255) not null,
l30 char(255) not null,
l31 char(255) not null,
index(c, b)
) engine=ndb partition by key(a) partitions 8;
insert into t1 values ('a','a','a','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x');
insert into t1 values ('b','b','b','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x');
insert into t1 values ('c','c','c','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x','x');
explain select count(*) from t1 as x1 join t1 as x2 on x1.b = x2.c;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	3	Parent of 2 pushed join@1
1	SIMPLE	x2	ref	c	c	10	test.x1.b	1	Child of 'x1' in pushed join@1
select count(*) from t1 as x1 join t1 as x2 on x1.b = x2.c;
count(*)
3
drop table t1;
create temporary table spj_counts_at_end
select counter_name, sum(val) as val 
from ndbinfo.counters 
where block_name='DBSPJ' 
group by counter_name;
select spj_counts_at_end.counter_name, spj_counts_at_end.val - spj_counts_at_startup.val 
from spj_counts_at_end, spj_counts_at_startup 
where spj_counts_at_end.counter_name = spj_counts_at_startup.counter_name
and spj_counts_at_end.counter_name <> 'LOCAL_READS_SENT'
       and spj_counts_at_end.counter_name <> 'REMOTE_READS_SENT'
       and spj_counts_at_end.counter_name <> 'LOCAL_RANGE_SCANS_SENT'
       and spj_counts_at_end.counter_name <> 'REMOTE_RANGE_SCANS_SENT'
       and spj_counts_at_end.counter_name <> 'SCAN_BATCHES_RETURNED';
counter_name	spj_counts_at_end.val - spj_counts_at_startup.val
CONST_PRUNED_RANGE_SCANS_RECEIVED	6
LOCAL_TABLE_SCANS_SENT	244
PRUNED_RANGE_SCANS_RECEIVED	25
RANGE_SCANS_RECEIVED	725
READS_NOT_FOUND	6619
READS_RECEIVED	52
SCAN_ROWS_RETURNED	76344
TABLE_SCANS_RECEIVED	244
select sum(spj_counts_at_end.val - spj_counts_at_startup.val) as 'LOCAL+REMOTE READS_SENT'
       from spj_counts_at_end, spj_counts_at_startup 
where spj_counts_at_end.counter_name = spj_counts_at_startup.counter_name
and (spj_counts_at_end.counter_name = 'LOCAL_READS_SENT'
       or spj_counts_at_end.counter_name = 'REMOTE_READS_SENT');
LOCAL+REMOTE READS_SENT
35281
drop table spj_save_counts;
drop table spj_counts_at_startup;
drop table spj_counts_at_end;
scan_count
2387
pruned_scan_count
11
sorted_scan_count
40
pushed_queries_defined
385
pushed_queries_dropped
12
pushed_queries_executed
539
set ndb_join_pushdown = @save_ndb_join_pushdown;

Filemanager

Name Type Size Permission Actions
bug36547.result File 455 B 0644
loaddata_autocom_ndb.result File 726 B 0644
ndb_add_partition.result File 5.91 KB 0644
ndb_alter_table.result File 10.88 KB 0644
ndb_alter_table2.result File 685 B 0644
ndb_alter_table3.result File 1.48 KB 0644
ndb_alter_table_backup.result File 1.76 KB 0644
ndb_alter_table_error.result File 648 B 0644
ndb_alter_table_online.result File 26.79 KB 0644
ndb_alter_table_online2.result File 2.62 KB 0644
ndb_alter_table_online_multi.result File 1.98 KB 0644
ndb_auto_increment.result File 9.99 KB 0644
ndb_autoinc.result File 793 B 0644
ndb_basic.result File 29.94 KB 0644
ndb_bitfield.result File 8.26 KB 0644
ndb_blob.result File 22.71 KB 0644
ndb_blob_big.result File 1.24 KB 0644
ndb_blob_partition.result File 9.03 KB 0644
ndb_bug26793.result File 257 B 0644
ndb_bug31477.result File 1.85 KB 0644
ndb_bug31754.result File 262 B 0644
ndb_bulk_delete.result File 1.87 KB 0644
ndb_cache.result File 8.68 KB 0644
ndb_cache2.result File 13.31 KB 0644
ndb_cache_multi.result File 1.67 KB 0644
ndb_cache_multi2.result File 1.68 KB 0644
ndb_cache_trans.result File 6.65 KB 0644
ndb_charset.result File 5.77 KB 0644
ndb_column_properties.result File 15.98 KB 0644
ndb_condition_pushdown.result File 72.29 KB 0644
ndb_config.result File 3.21 KB 0644
ndb_config2.result File 475 B 0644
ndb_create_table.result File 1.02 KB 0644
ndb_cursor.result File 865 B 0644
ndb_database.result File 1.23 KB 0644
ndb_dbug_lock.result File 1.64 KB 0644
ndb_dbug_tc_select.result File 5.98 KB 0644
ndb_dd_alter.result File 27.07 KB 0644
ndb_dd_basic.result File 20.67 KB 0644
ndb_dd_bug12581213.result File 334 B 0644
ndb_dd_ddl.result File 5.56 KB 0644
ndb_dd_disk2memory.result File 12.99 KB 0644
ndb_dd_dump.result File 15.97 KB 0644
ndb_dd_restore_compat.result File 3.61 KB 0644
ndb_dd_sql_features.result File 22.4 KB 0644
ndb_ddl_open_trans.result File 1.36 KB 0644
ndb_disconnect_ddl.result File 281 B 0644
ndb_discover_db.result File 1.55 KB 0644
ndb_dist_priv.result File 4.8 KB 0644
ndb_gis.result File 47.18 KB 0644
ndb_global_schema_lock.result File 3.43 KB 0644
ndb_global_schema_lock_error.result File 1.94 KB 0644
ndb_grant.result File 17.65 KB 0644
ndb_hidden_pk.result File 10.55 KB 0644
ndb_index.result File 13.93 KB 0644
ndb_index_ordered.result File 16.71 KB 0644
ndb_index_stat.result File 14.33 KB 0644
ndb_index_unique.result File 17.43 KB 0644
ndb_insert.result File 36.2 KB 0644
ndb_join_pushdown.result File 274.88 KB 0644
ndb_limit.result File 2.01 KB 0644
ndb_load.result File 2.64 KB 0644
ndb_loaddatalocal.result File 1.39 KB 0644
ndb_lock.result File 4.17 KB 0644
ndb_lock_table.result File 205 B 0644
ndb_mgm.result File 3.55 KB 0644
ndb_minmax.result File 1.47 KB 0644
ndb_multi.result File 3.7 KB 0644
ndb_multi_row.result File 1.33 KB 0644
ndb_native_default_support.result File 47.23 KB 0644
ndb_optimize_table.result File 2 KB 0644
ndb_optimized_node_selection.result File 1017 B 0644
ndb_partition_error.result File 1.41 KB 0644
ndb_partition_error2.result File 150 B 0644
ndb_partition_hash.result File 890 B 0644
ndb_partition_key.result File 8.16 KB 0644
ndb_partition_list.result File 2.31 KB 0644
ndb_partition_range.result File 7.91 KB 0644
ndb_read_multi_range.result File 14.54 KB 0644
ndb_reconnect.result File 560 B 0644
ndb_rename.result File 772 B 0644
ndb_replace.result File 3.64 KB 0644
ndb_restore_compat_downward.result File 132.43 KB 0644
ndb_restore_compat_endianness.result File 10.87 KB 0644
ndb_restore_conv_lossy_charbinary.result File 15.46 KB 0644
ndb_restore_conv_lossy_integral.result File 20.72 KB 0644
ndb_restore_conv_padding.result File 6.14 KB 0644
ndb_restore_conv_promotion.result File 23.26 KB 0644
ndb_restore_discover.result File 540 B 0644
ndb_restore_misc.result File 23.77 KB 0644
ndb_restore_print.result File 9.8 KB 0644
ndb_restore_schema_blobs.result File 6.44 KB 0644
ndb_restore_schema_partitions.result File 13.3 KB 0644
ndb_restore_schema_rewrites.result File 12.22 KB 0644
ndb_restore_schema_subsets.result File 95.9 KB 0644
ndb_restore_schema_tolerance.result File 4.57 KB 0644
ndb_restore_undolog.result File 18.66 KB 0644
ndb_row_count.result File 5.11 KB 0644
ndb_row_format.result File 1.74 KB 0644
ndb_select_count.result File 334 B 0644
ndb_share.result File 9.85 KB 0644
ndb_short_sigs.result File 2.53 KB 0644
ndb_single_user.result File 3.97 KB 0644
ndb_sp.result File 1.1 KB 0644
ndb_sql_allow_batching.result File 918 B 0644
ndb_statistics0.result File 7.78 KB 0644
ndb_statistics1.result File 8.04 KB 0644
ndb_subquery.result File 3.07 KB 0644
ndb_temporary.result File 939 B 0644
ndb_tmp_table_and_DDL.result File 3.11 KB 0644
ndb_transaction.result File 4.62 KB 0644
ndb_trigger.result File 9.38 KB 0644
ndb_truncate.result File 425 B 0644
ndb_types.result File 3.12 KB 0644
ndb_update.result File 2.76 KB 0644
ndb_update_no_read.result File 11.37 KB 0644
ndb_view.result File 597 B 0644
ndbapi.result File 734 B 0644
ndbinfo.result File 12.86 KB 0644
ndbinfo_cache.result File 423 B 0644
ndbinfo_dump.result File 95 B 0644
ps_7ndb.result File 103.12 KB 0644
strict_autoinc_5ndb.result File 651 B 0644