Debian Codegraph @

mysql-test/suite/ndb_opt/join_pushdown_default.result

raw
1 select @@session.optimizer_switch;
2 @@session.optimizer_switch
3 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,mrr=on,mrr_cost_based=on,block_nested_loop=on,batched_key_access=off,materialization=on,semijoin=on,loosescan=on,firstmatch=on,duplicateweedout=on,subquery_materialization_cost_based=on,use_index_extensions=on,condition_fanout_filter=on,derived_merge=on,use_invisible_indexes=off,skip_scan=on,hash_join=on,subquery_to_derived=off,prefer_ordering_index=on,hypergraph_optimizer=off,derived_condition_pushdown=on
4 create temporary table server_counts_at_startup
5 select * from performance_schema.global_status
6 where variable_name in
7 ('Ndb_pruned_scan_count',
8 'Ndb_sorted_scan_count',
9 'Ndb_pushed_queries_defined',
10 'Ndb_pushed_queries_dropped');
11 set @save_debug = @@global.debug;
12 set @save_ndb_join_pushdown = @@session.ndb_join_pushdown;
13 set ndb_join_pushdown = true;
14 create table t1 (
15 a int not null,
16 b int not null,
17 c int not null,
18 d int not null,
19 primary key (`a`,`b`)
20 ) engine=ndbcluster
21 partition by key() partitions 8;
22 insert into t1 values
23 (1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4),
24 (1,2,5,1), (1,3,1,2), (1,4,2,3),
25 (2,1,3,4), (2,3,4,5), (2,4,5,1),
26 (3,1,1,2), (3,2,2,3), (3,4,3,4),
27 (4,1,4,5), (4,2,5,1), (4,3,1,2);
28 explain
29 select *
30 from t1
31 join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
32 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
33 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 2 pushed join@1
34 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
35 Warnings:
36 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`))
37 select *
38 from t1
39 join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
40 a b c d a b c d
41 1 1 1 1 1 1 1 1
42 1 3 1 2 3 1 1 2
43 1 4 2 3 4 2 5 1
44 2 1 3 4 1 3 1 2
45 2 2 2 2 2 2 2 2
46 2 3 4 5 3 4 3 4
47 3 1 1 2 1 1 1 1
48 3 2 2 3 2 2 2 2
49 3 3 3 3 3 3 3 3
50 3 4 3 4 4 3 1 2
51 4 1 4 5 1 4 2 3
52 4 3 1 2 3 1 1 2
53 4 4 4 4 4 4 4 4
54 explain format=JSON
55 select *
56 from t1
57 join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
58 EXPLAIN
59 {
60 "query_block": {
61 "select_id": 1,
62 "cost_info": {
63 "query_cost": "4007.20"
64 },
65 "nested_loop": [
66 {
67 "table": {
68 "table_name": "t1",
69 "partitions": [
70 "p0",
71 "p1",
72 "p2",
73 "p3",
74 "p4",
75 "p5",
76 "p6",
77 "p7"
78 ],
79 "access_type": "ALL",
80 "rows_examined_per_scan": 16,
81 "rows_produced_per_join": 16,
82 "filtered": "100.00",
83 "pushed_join": "Parent of 2 pushed join@1",
84 "cost_info": {
85 "read_cost": "4000.00",
86 "eval_cost": "1.60",
87 "prefix_cost": "4001.60",
88 "data_read_per_join": "384"
89 },
90 "used_columns": [
91 "a",
92 "b",
93 "c",
94 "d"
95 ]
96 }
97 },
98 {
99 "table": {
100 "table_name": "t2",
101 "partitions": [
102 "p0",
103 "p1",
104 "p2",
105 "p3",
106 "p4",
107 "p5",
108 "p6",
109 "p7"
110 ],
111 "access_type": "eq_ref",
112 "possible_keys": [
113 "PRIMARY"
114 ],
115 "key": "PRIMARY",
116 "used_key_parts": [
117 "a",
118 "b"
119 ],
120 "key_length": "8",
121 "ref": [
122 "test.t1.b",
123 "test.t1.c"
124 ],
125 "rows_examined_per_scan": 1,
126 "rows_produced_per_join": 16,
127 "filtered": "100.00",
128 "pushed_join": "Child of 't1' in pushed join@1",
129 "cost_info": {
130 "read_cost": "4.00",
131 "eval_cost": "1.60",
132 "prefix_cost": "4007.20",
133 "data_read_per_join": "384"
134 },
135 "used_columns": [
136 "a",
137 "b",
138 "c",
139 "d"
140 ]
141 }
142 }
143 ]
144 }
145 }
146 Warnings:
147 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`))
148 explain
149 select straight_join count(*)
150 from t1 as x1
151 join t1 as x2 on x1.d > x2.a + 1000
152 join t1 as x3 on x1.c=x3.a and x1.d=x3.b;
153 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
154 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 NULL
155 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Using where; Using join buffer (hash join)
156 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x1.c,test.x1.d 1 100.00 NULL
157 Warnings:
158 Note 1003 Can't push table 'x2' as child, 'type' must be a 'ref' access
159 Note 1003 Can't push table 'x3' as child of 'x1', it is in a hash-bucket-branch which can't be referred.
160 Note 1003 Can't push table 'x3' as child of 'x2', column 'x1.c' is in a hash-bucket-branch which can't be referred
161 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)))
162 select straight_join count(*)
163 from t1 as x1
164 join t1 as x2 on x1.d > x2.a + 1000
165 join t1 as x3 on x1.c=x3.a and x1.d=x3.b;
166 count(*)
167 0
168 explain select *
169 from t1 as x1
170 join t1 as x2 on x1.a=1 and x1.c=x2.a and x1.d=x2.b
171 join t1 as x3
172 join t1 as x4 where x4.a=x3.c and x4.b=x1.d;
173 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
174 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
175 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x1.c,test.x1.d 1 100.00 Child of 'x1' in pushed join@1
176 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Using join buffer (hash join)
177 1 SIMPLE x4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x3.c,test.x1.d 1 100.00 NULL
178 Warnings:
179 Note 1003 Can't push table 'x3' as child, 'type' must be a 'ref' access
180 Note 1003 Can't push table 'x4' as child of 'x1', it is in a hash-bucket-branch which can't be referred.
181 Note 1003 Can't push table 'x4' as child of 'x3', column 'x1.d' is in a hash-bucket-branch which can't be referred
182 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`))
183 select *
184 from t1 as x1
185 join t1 as x2 on x1.a=1 and x1.c=x2.a and x1.d=x2.b
186 join t1 as x3
187 join t1 as x4 where x4.a=x3.c and x4.b=x1.d;
188 a b c d a b c d a b c d a b c d
189 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
190 1 1 1 1 1 1 1 1 1 3 1 2 1 1 1 1
191 1 1 1 1 1 1 1 1 1 4 2 3 2 1 3 4
192 1 1 1 1 1 1 1 1 2 1 3 4 3 1 1 2
193 1 1 1 1 1 1 1 1 2 2 2 2 2 1 3 4
194 1 1 1 1 1 1 1 1 2 3 4 5 4 1 4 5
195 1 1 1 1 1 1 1 1 3 1 1 2 1 1 1 1
196 1 1 1 1 1 1 1 1 3 2 2 3 2 1 3 4
197 1 1 1 1 1 1 1 1 3 3 3 3 3 1 1 2
198 1 1 1 1 1 1 1 1 3 4 3 4 3 1 1 2
199 1 1 1 1 1 1 1 1 4 1 4 5 4 1 4 5
200 1 1 1 1 1 1 1 1 4 3 1 2 1 1 1 1
201 1 1 1 1 1 1 1 1 4 4 4 4 4 1 4 5
202 1 3 1 2 1 2 5 1 1 1 1 1 1 2 5 1
203 1 3 1 2 1 2 5 1 1 3 1 2 1 2 5 1
204 1 3 1 2 1 2 5 1 1 4 2 3 2 2 2 2
205 1 3 1 2 1 2 5 1 2 1 3 4 3 2 2 3
206 1 3 1 2 1 2 5 1 2 2 2 2 2 2 2 2
207 1 3 1 2 1 2 5 1 2 3 4 5 4 2 5 1
208 1 3 1 2 1 2 5 1 3 1 1 2 1 2 5 1
209 1 3 1 2 1 2 5 1 3 2 2 3 2 2 2 2
210 1 3 1 2 1 2 5 1 3 3 3 3 3 2 2 3
211 1 3 1 2 1 2 5 1 3 4 3 4 3 2 2 3
212 1 3 1 2 1 2 5 1 4 1 4 5 4 2 5 1
213 1 3 1 2 1 2 5 1 4 3 1 2 1 2 5 1
214 1 3 1 2 1 2 5 1 4 4 4 4 4 2 5 1
215 1 4 2 3 2 3 4 5 1 1 1 1 1 3 1 2
216 1 4 2 3 2 3 4 5 1 3 1 2 1 3 1 2
217 1 4 2 3 2 3 4 5 1 4 2 3 2 3 4 5
218 1 4 2 3 2 3 4 5 2 1 3 4 3 3 3 3
219 1 4 2 3 2 3 4 5 2 2 2 2 2 3 4 5
220 1 4 2 3 2 3 4 5 2 3 4 5 4 3 1 2
221 1 4 2 3 2 3 4 5 3 1 1 2 1 3 1 2
222 1 4 2 3 2 3 4 5 3 2 2 3 2 3 4 5
223 1 4 2 3 2 3 4 5 3 3 3 3 3 3 3 3
224 1 4 2 3 2 3 4 5 3 4 3 4 3 3 3 3
225 1 4 2 3 2 3 4 5 4 1 4 5 4 3 1 2
226 1 4 2 3 2 3 4 5 4 3 1 2 1 3 1 2
227 1 4 2 3 2 3 4 5 4 4 4 4 4 3 1 2
228 explain
229 select *
230 from t1
231 left join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
232 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
233 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 2 pushed join@1
234 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
235 Warnings:
236 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`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`))) where true
237 select *
238 from t1
239 left join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
240 a b c d a b c d
241 1 1 1 1 1 1 1 1
242 1 2 5 1 NULL NULL NULL NULL
243 1 3 1 2 3 1 1 2
244 1 4 2 3 4 2 5 1
245 2 1 3 4 1 3 1 2
246 2 2 2 2 2 2 2 2
247 2 3 4 5 3 4 3 4
248 2 4 5 1 NULL NULL NULL NULL
249 3 1 1 2 1 1 1 1
250 3 2 2 3 2 2 2 2
251 3 3 3 3 3 3 3 3
252 3 4 3 4 4 3 1 2
253 4 1 4 5 1 4 2 3
254 4 2 5 1 NULL NULL NULL NULL
255 4 3 1 2 3 1 1 2
256 4 4 4 4 4 4 4 4
257 explain
258 select *
259 from t1
260 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
261 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
262 where t1.a = 1 and t1.b = 1;
263 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
264 1 SIMPLE t1 p7 eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 Parent of 3 pushed join@1
265 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 const,test.t1.c 1 100.00 Child of 't1' in pushed join@1
266 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 const,test.t1.c 1 100.00 Child of 't1' in pushed join@1
267 Warnings:
268 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`.`t1`.`b` = 1) and (`test`.`t2`.`a` = 1) and (`test`.`t3`.`a` = 1) and (`test`.`t1`.`a` = 1))
269 select *
270 from t1
271 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
272 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
273 where t1.a = 1 and t1.b = 1;
274 a b c d a b c d a b c d
275 1 1 1 1 1 1 1 1 1 1 1 1
276 explain
277 select *
278 from t1
279 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
280 join t1 as t3 on t3.a = t2.a and t3.b = t2.b;
281 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
282 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
283 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
284 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
285 Warnings:
286 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`))
287 select *
288 from t1
289 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
290 join t1 as t3 on t3.a = t2.a and t3.b = t2.b;
291 a b c d a b c d a b c d
292 1 1 1 1 1 1 1 1 1 1 1 1
293 1 3 1 2 3 1 1 2 3 1 1 2
294 1 4 2 3 4 2 5 1 4 2 5 1
295 2 1 3 4 1 3 1 2 1 3 1 2
296 2 2 2 2 2 2 2 2 2 2 2 2
297 2 3 4 5 3 4 3 4 3 4 3 4
298 3 1 1 2 1 1 1 1 1 1 1 1
299 3 2 2 3 2 2 2 2 2 2 2 2
300 3 3 3 3 3 3 3 3 3 3 3 3
301 3 4 3 4 4 3 1 2 4 3 1 2
302 4 1 4 5 1 4 2 3 1 4 2 3
303 4 3 1 2 3 1 1 2 3 1 1 2
304 4 4 4 4 4 4 4 4 4 4 4 4
305 explain
306 select *
307 from t1
308 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
309 left join t1 as t3 on t3.a = t2.a and t3.b = t2.b;
310 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
311 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
312 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
313 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
314 Warnings:
315 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`))
316 select *
317 from t1
318 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
319 left join t1 as t3 on t3.a = t2.a and t3.b = t2.b;
320 a b c d a b c d a b c d
321 1 1 1 1 1 1 1 1 1 1 1 1
322 1 3 1 2 3 1 1 2 3 1 1 2
323 1 4 2 3 4 2 5 1 4 2 5 1
324 2 1 3 4 1 3 1 2 1 3 1 2
325 2 2 2 2 2 2 2 2 2 2 2 2
326 2 3 4 5 3 4 3 4 3 4 3 4
327 3 1 1 2 1 1 1 1 1 1 1 1
328 3 2 2 3 2 2 2 2 2 2 2 2
329 3 3 3 3 3 3 3 3 3 3 3 3
330 3 4 3 4 4 3 1 2 4 3 1 2
331 4 1 4 5 1 4 2 3 1 4 2 3
332 4 3 1 2 3 1 1 2 3 1 1 2
333 4 4 4 4 4 4 4 4 4 4 4 4
334 explain
335 select *
336 from t1
337 left join t1 as t2 on t2.a = t1.b and t2.b = t1.c
338 left join t1 as t3 on t3.a = t2.a and t3.b = t2.b;
339 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
340 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
341 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
342 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.a,test.t2.b 1 100.00 Child of 't2' in pushed join@1
343 Warnings:
344 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`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`a` = `test`.`t1`.`b`))) left join `test`.`t1` `t3` on(((`test`.`t3`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = `test`.`t2`.`a`))) where true
345 select *
346 from t1
347 left join t1 as t2 on t2.a = t1.b and t2.b = t1.c
348 left join t1 as t3 on t3.a = t2.a and t3.b = t2.b;
349 a b c d a b c d a b c d
350 1 1 1 1 1 1 1 1 1 1 1 1
351 1 2 5 1 NULL NULL NULL NULL NULL NULL NULL NULL
352 1 3 1 2 3 1 1 2 3 1 1 2
353 1 4 2 3 4 2 5 1 4 2 5 1
354 2 1 3 4 1 3 1 2 1 3 1 2
355 2 2 2 2 2 2 2 2 2 2 2 2
356 2 3 4 5 3 4 3 4 3 4 3 4
357 2 4 5 1 NULL NULL NULL NULL NULL NULL NULL NULL
358 3 1 1 2 1 1 1 1 1 1 1 1
359 3 2 2 3 2 2 2 2 2 2 2 2
360 3 3 3 3 3 3 3 3 3 3 3 3
361 3 4 3 4 4 3 1 2 4 3 1 2
362 4 1 4 5 1 4 2 3 1 4 2 3
363 4 2 5 1 NULL NULL NULL NULL NULL NULL NULL NULL
364 4 3 1 2 3 1 1 2 3 1 1 2
365 4 4 4 4 4 4 4 4 4 4 4 4
366 set ndb_join_pushdown=true;
367 explain
368 select *
369 from t1
370 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
371 where t1.a = 2 and t1.b = 3;
372 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
373 1 SIMPLE t1 pX eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 Parent of 2 pushed join@1
374 1 SIMPLE t2 pXYZ eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
375 Warnings:
376 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))
377 select *
378 from t1
379 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
380 where t1.a = 2 and t1.b = 3;
381 a b c d a b c d
382 LOCK TABLES t1 read, t1 as t2 read;
383 explain
384 select *
385 from t1
386 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
387 where t1.a = 2 and t1.b = 3;
388 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
389 1 SIMPLE t1 pX eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 Parent of 2 pushed join@1
390 1 SIMPLE t2 pXYZ eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
391 Warnings:
392 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))
393 select *
394 from t1
395 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
396 where t1.a = 2 and t1.b = 3;
397 a b c d a b c d
398 select *
399 from t1
400 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
401 where t1.a = 3 and t1.b = 3;
402 a b c d a b c d
403 3 3 3 3 3 3 3 3
404 UNLOCK TABLES;
405 explain
406 select *
407 from t1
408 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
409 where t1.a = 2 and t1.b = 3;
410 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
411 1 SIMPLE t1 pX eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 Parent of 2 pushed join@1
412 1 SIMPLE t2 pXYZ eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
413 Warnings:
414 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))
415 select *
416 from t1
417 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
418 where t1.a = 2 and t1.b = 3;
419 a b c d a b c d
420 2 3 4 5 NULL NULL NULL NULL
421 explain
422 select *
423 from t1
424 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
425 where t1.a = 2 and t1.b = 3
426 order by t1.c;
427 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
428 1 SIMPLE t1 pX eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 Parent of 2 pushed join@1
429 1 SIMPLE t2 pXYZ eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
430 Warnings:
431 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`
432 select *
433 from t1
434 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
435 where t1.a = 2 and t1.b = 3
436 order by t1.c;
437 a b c d a b c d
438 2 3 4 5 NULL NULL NULL NULL
439 set ndb_join_pushdown=false;
440 explain
441 select *
442 from t1
443 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
444 where t1.a = 2 and t1.b = 3;
445 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
446 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
447 Warnings:
448 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 (multiple equal(2) and multiple equal(3) and multiple equal('4', NULL) and multiple equal('5', NULL))
449 select *
450 from t1
451 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
452 where t1.a = 2 and t1.b = 3;
453 a b c d a b c d
454 explain
455 select *
456 from t1
457 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
458 where t1.a = 2 and t1.b = 3;
459 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
460 1 SIMPLE t1 pX const PRIMARY PRIMARY 8 const,const 1 100.00 NULL
461 1 SIMPLE t2 pXYZ const PRIMARY PRIMARY 8 const,const 0 0.00 unique row not found
462 Warnings:
463 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 true
464 select *
465 from t1
466 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
467 where t1.a = 2 and t1.b = 3;
468 a b c d a b c d
469 2 3 4 5 NULL NULL NULL NULL
470 set ndb_join_pushdown=true;
471 explain
472 select *
473 from t1
474 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
475 where t1.a = 1 and t1.b = 1;
476 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
477 1 SIMPLE t1 p7 eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 Parent of 2 pushed join@1
478 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
479 Warnings:
480 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))
481 select *
482 from t1
483 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
484 where t1.a = 1 and t1.b = 1;
485 a b c d a b c d
486 1 1 1 1 1 1 1 1
487 explain
488 select *
489 from t1
490 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
491 where t1.a = 1 and t1.b = 1;
492 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
493 1 SIMPLE t1 p7 eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 Parent of 2 pushed join@1
494 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
495 Warnings:
496 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))
497 select *
498 from t1
499 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
500 where t1.a = 1 and t1.b = 1;
501 a b c d a b c d
502 1 1 1 1 1 1 1 1
503 set ndb_join_pushdown=false;
504 explain
505 select *
506 from t1
507 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
508 where t1.a = 1 and t1.b = 1;
509 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
510 1 SIMPLE t1 p7 const PRIMARY PRIMARY 8 const,const 1 100.00 NULL
511 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 const PRIMARY PRIMARY 8 const,const 1 100.00 NULL
512 Warnings:
513 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 true
514 select *
515 from t1
516 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
517 where t1.a = 1 and t1.b = 1;
518 a b c d a b c d
519 1 1 1 1 1 1 1 1
520 explain
521 select *
522 from t1
523 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
524 where t1.a = 1 and t1.b = 1;
525 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
526 1 SIMPLE t1 p7 const PRIMARY PRIMARY 8 const,const 1 100.00 NULL
527 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 const PRIMARY PRIMARY 8 const,const 1 100.00 NULL
528 Warnings:
529 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 true
530 select *
531 from t1
532 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d
533 where t1.a = 1 and t1.b = 1;
534 a b c d a b c d
535 1 1 1 1 1 1 1 1
536 set ndb_join_pushdown=true;
537 explain
538 select *
539 from t1
540 join t1 as t2 on t2.a = t1.c
541 join t1 as t3 on t3.a = t1.c and t3.b = t2.b;
542 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
543 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
544 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Child of 't1' in pushed join@1
545 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t2.b 1 100.00 Child of 't2' in pushed join@1
546 Warnings:
547 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`))
548 select *
549 from t1
550 join t1 as t2 on t2.a = t1.c
551 join t1 as t3 on t3.a = t1.c and t3.b = t2.b;
552 a b c d a b c d a b c d
553 1 1 1 1 1 1 1 1 1 1 1 1
554 1 1 1 1 1 2 5 1 1 2 5 1
555 1 1 1 1 1 3 1 2 1 3 1 2
556 1 1 1 1 1 4 2 3 1 4 2 3
557 1 3 1 2 1 1 1 1 1 1 1 1
558 1 3 1 2 1 2 5 1 1 2 5 1
559 1 3 1 2 1 3 1 2 1 3 1 2
560 1 3 1 2 1 4 2 3 1 4 2 3
561 1 4 2 3 2 1 3 4 2 1 3 4
562 1 4 2 3 2 2 2 2 2 2 2 2
563 1 4 2 3 2 3 4 5 2 3 4 5
564 1 4 2 3 2 4 5 1 2 4 5 1
565 2 1 3 4 3 1 1 2 3 1 1 2
566 2 1 3 4 3 2 2 3 3 2 2 3
567 2 1 3 4 3 3 3 3 3 3 3 3
568 2 1 3 4 3 4 3 4 3 4 3 4
569 2 2 2 2 2 1 3 4 2 1 3 4
570 2 2 2 2 2 2 2 2 2 2 2 2
571 2 2 2 2 2 3 4 5 2 3 4 5
572 2 2 2 2 2 4 5 1 2 4 5 1
573 2 3 4 5 4 1 4 5 4 1 4 5
574 2 3 4 5 4 2 5 1 4 2 5 1
575 2 3 4 5 4 3 1 2 4 3 1 2
576 2 3 4 5 4 4 4 4 4 4 4 4
577 3 1 1 2 1 1 1 1 1 1 1 1
578 3 1 1 2 1 2 5 1 1 2 5 1
579 3 1 1 2 1 3 1 2 1 3 1 2
580 3 1 1 2 1 4 2 3 1 4 2 3
581 3 2 2 3 2 1 3 4 2 1 3 4
582 3 2 2 3 2 2 2 2 2 2 2 2
583 3 2 2 3 2 3 4 5 2 3 4 5
584 3 2 2 3 2 4 5 1 2 4 5 1
585 3 3 3 3 3 1 1 2 3 1 1 2
586 3 3 3 3 3 2 2 3 3 2 2 3
587 3 3 3 3 3 3 3 3 3 3 3 3
588 3 3 3 3 3 4 3 4 3 4 3 4
589 3 4 3 4 3 1 1 2 3 1 1 2
590 3 4 3 4 3 2 2 3 3 2 2 3
591 3 4 3 4 3 3 3 3 3 3 3 3
592 3 4 3 4 3 4 3 4 3 4 3 4
593 4 1 4 5 4 1 4 5 4 1 4 5
594 4 1 4 5 4 2 5 1 4 2 5 1
595 4 1 4 5 4 3 1 2 4 3 1 2
596 4 1 4 5 4 4 4 4 4 4 4 4
597 4 3 1 2 1 1 1 1 1 1 1 1
598 4 3 1 2 1 2 5 1 1 2 5 1
599 4 3 1 2 1 3 1 2 1 3 1 2
600 4 3 1 2 1 4 2 3 1 4 2 3
601 4 4 4 4 4 1 4 5 4 1 4 5
602 4 4 4 4 4 2 5 1 4 2 5 1
603 4 4 4 4 4 3 1 2 4 3 1 2
604 4 4 4 4 4 4 4 4 4 4 4 4
605 explain
606 select straight_join *
607 from (t1 as x cross join t1 as y)
608 join t1 as z on z.a=x.a and z.b=y.b;
609 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
610 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 NULL
611 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Using join buffer (hash join)
612 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.a,test.y.b 1 100.00 NULL
613 Warnings:
614 Note 1003 Can't push table 'y' as child, 'type' must be a 'ref' access
615 Note 1003 Can't push table 'z' as child of 'x', it is in a hash-bucket-branch which can't be referred.
616 Note 1003 Can't push table 'z' as child of 'y', column 'x.a' is in a hash-bucket-branch which can't be referred
617 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`))
618 select straight_join *
619 from (t1 as x cross join t1 as y)
620 join t1 as z on z.a=x.a and z.b=y.b;
621 a b c d a b c d a b c d
622 1 1 1 1 1 1 1 1 1 1 1 1
623 1 1 1 1 1 2 5 1 1 2 5 1
624 1 1 1 1 1 3 1 2 1 3 1 2
625 1 1 1 1 1 4 2 3 1 4 2 3
626 1 1 1 1 2 1 3 4 1 1 1 1
627 1 1 1 1 2 2 2 2 1 2 5 1
628 1 1 1 1 2 3 4 5 1 3 1 2
629 1 1 1 1 2 4 5 1 1 4 2 3
630 1 1 1 1 3 1 1 2 1 1 1 1
631 1 1 1 1 3 2 2 3 1 2 5 1
632 1 1 1 1 3 3 3 3 1 3 1 2
633 1 1 1 1 3 4 3 4 1 4 2 3
634 1 1 1 1 4 1 4 5 1 1 1 1
635 1 1 1 1 4 2 5 1 1 2 5 1
636 1 1 1 1 4 3 1 2 1 3 1 2
637 1 1 1 1 4 4 4 4 1 4 2 3
638 1 2 5 1 1 1 1 1 1 1 1 1
639 1 2 5 1 1 2 5 1 1 2 5 1
640 1 2 5 1 1 3 1 2 1 3 1 2
641 1 2 5 1 1 4 2 3 1 4 2 3
642 1 2 5 1 2 1 3 4 1 1 1 1
643 1 2 5 1 2 2 2 2 1 2 5 1
644 1 2 5 1 2 3 4 5 1 3 1 2
645 1 2 5 1 2 4 5 1 1 4 2 3
646 1 2 5 1 3 1 1 2 1 1 1 1
647 1 2 5 1 3 2 2 3 1 2 5 1
648 1 2 5 1 3 3 3 3 1 3 1 2
649 1 2 5 1 3 4 3 4 1 4 2 3
650 1 2 5 1 4 1 4 5 1 1 1 1
651 1 2 5 1 4 2 5 1 1 2 5 1
652 1 2 5 1 4 3 1 2 1 3 1 2
653 1 2 5 1 4 4 4 4 1 4 2 3
654 1 3 1 2 1 1 1 1 1 1 1 1
655 1 3 1 2 1 2 5 1 1 2 5 1
656 1 3 1 2 1 3 1 2 1 3 1 2
657 1 3 1 2 1 4 2 3 1 4 2 3
658 1 3 1 2 2 1 3 4 1 1 1 1
659 1 3 1 2 2 2 2 2 1 2 5 1
660 1 3 1 2 2 3 4 5 1 3 1 2
661 1 3 1 2 2 4 5 1 1 4 2 3
662 1 3 1 2 3 1 1 2 1 1 1 1
663 1 3 1 2 3 2 2 3 1 2 5 1
664 1 3 1 2 3 3 3 3 1 3 1 2
665 1 3 1 2 3 4 3 4 1 4 2 3
666 1 3 1 2 4 1 4 5 1 1 1 1
667 1 3 1 2 4 2 5 1 1 2 5 1
668 1 3 1 2 4 3 1 2 1 3 1 2
669 1 3 1 2 4 4 4 4 1 4 2 3
670 1 4 2 3 1 1 1 1 1 1 1 1
671 1 4 2 3 1 2 5 1 1 2 5 1
672 1 4 2 3 1 3 1 2 1 3 1 2
673 1 4 2 3 1 4 2 3 1 4 2 3
674 1 4 2 3 2 1 3 4 1 1 1 1
675 1 4 2 3 2 2 2 2 1 2 5 1
676 1 4 2 3 2 3 4 5 1 3 1 2
677 1 4 2 3 2 4 5 1 1 4 2 3
678 1 4 2 3 3 1 1 2 1 1 1 1
679 1 4 2 3 3 2 2 3 1 2 5 1
680 1 4 2 3 3 3 3 3 1 3 1 2
681 1 4 2 3 3 4 3 4 1 4 2 3
682 1 4 2 3 4 1 4 5 1 1 1 1
683 1 4 2 3 4 2 5 1 1 2 5 1
684 1 4 2 3 4 3 1 2 1 3 1 2
685 1 4 2 3 4 4 4 4 1 4 2 3
686 2 1 3 4 1 1 1 1 2 1 3 4
687 2 1 3 4 1 2 5 1 2 2 2 2
688 2 1 3 4 1 3 1 2 2 3 4 5
689 2 1 3 4 1 4 2 3 2 4 5 1
690 2 1 3 4 2 1 3 4 2 1 3 4
691 2 1 3 4 2 2 2 2 2 2 2 2
692 2 1 3 4 2 3 4 5 2 3 4 5
693 2 1 3 4 2 4 5 1 2 4 5 1
694 2 1 3 4 3 1 1 2 2 1 3 4
695 2 1 3 4 3 2 2 3 2 2 2 2
696 2 1 3 4 3 3 3 3 2 3 4 5
697 2 1 3 4 3 4 3 4 2 4 5 1
698 2 1 3 4 4 1 4 5 2 1 3 4
699 2 1 3 4 4 2 5 1 2 2 2 2
700 2 1 3 4 4 3 1 2 2 3 4 5
701 2 1 3 4 4 4 4 4 2 4 5 1
702 2 2 2 2 1 1 1 1 2 1 3 4
703 2 2 2 2 1 2 5 1 2 2 2 2
704 2 2 2 2 1 3 1 2 2 3 4 5
705 2 2 2 2 1 4 2 3 2 4 5 1
706 2 2 2 2 2 1 3 4 2 1 3 4
707 2 2 2 2 2 2 2 2 2 2 2 2
708 2 2 2 2 2 3 4 5 2 3 4 5
709 2 2 2 2 2 4 5 1 2 4 5 1
710 2 2 2 2 3 1 1 2 2 1 3 4
711 2 2 2 2 3 2 2 3 2 2 2 2
712 2 2 2 2 3 3 3 3 2 3 4 5
713 2 2 2 2 3 4 3 4 2 4 5 1
714 2 2 2 2 4 1 4 5 2 1 3 4
715 2 2 2 2 4 2 5 1 2 2 2 2
716 2 2 2 2 4 3 1 2 2 3 4 5
717 2 2 2 2 4 4 4 4 2 4 5 1
718 2 3 4 5 1 1 1 1 2 1 3 4
719 2 3 4 5 1 2 5 1 2 2 2 2
720 2 3 4 5 1 3 1 2 2 3 4 5
721 2 3 4 5 1 4 2 3 2 4 5 1
722 2 3 4 5 2 1 3 4 2 1 3 4
723 2 3 4 5 2 2 2 2 2 2 2 2
724 2 3 4 5 2 3 4 5 2 3 4 5
725 2 3 4 5 2 4 5 1 2 4 5 1
726 2 3 4 5 3 1 1 2 2 1 3 4
727 2 3 4 5 3 2 2 3 2 2 2 2
728 2 3 4 5 3 3 3 3 2 3 4 5
729 2 3 4 5 3 4 3 4 2 4 5 1
730 2 3 4 5 4 1 4 5 2 1 3 4
731 2 3 4 5 4 2 5 1 2 2 2 2
732 2 3 4 5 4 3 1 2 2 3 4 5
733 2 3 4 5 4 4 4 4 2 4 5 1
734 2 4 5 1 1 1 1 1 2 1 3 4
735 2 4 5 1 1 2 5 1 2 2 2 2
736 2 4 5 1 1 3 1 2 2 3 4 5
737 2 4 5 1 1 4 2 3 2 4 5 1
738 2 4 5 1 2 1 3 4 2 1 3 4
739 2 4 5 1 2 2 2 2 2 2 2 2
740 2 4 5 1 2 3 4 5 2 3 4 5
741 2 4 5 1 2 4 5 1 2 4 5 1
742 2 4 5 1 3 1 1 2 2 1 3 4
743 2 4 5 1 3 2 2 3 2 2 2 2
744 2 4 5 1 3 3 3 3 2 3 4 5
745 2 4 5 1 3 4 3 4 2 4 5 1
746 2 4 5 1 4 1 4 5 2 1 3 4
747 2 4 5 1 4 2 5 1 2 2 2 2
748 2 4 5 1 4 3 1 2 2 3 4 5
749 2 4 5 1 4 4 4 4 2 4 5 1
750 3 1 1 2 1 1 1 1 3 1 1 2
751 3 1 1 2 1 2 5 1 3 2 2 3
752 3 1 1 2 1 3 1 2 3 3 3 3
753 3 1 1 2 1 4 2 3 3 4 3 4
754 3 1 1 2 2 1 3 4 3 1 1 2
755 3 1 1 2 2 2 2 2 3 2 2 3
756 3 1 1 2 2 3 4 5 3 3 3 3
757 3 1 1 2 2 4 5 1 3 4 3 4
758 3 1 1 2 3 1 1 2 3 1 1 2
759 3 1 1 2 3 2 2 3 3 2 2 3
760 3 1 1 2 3 3 3 3 3 3 3 3
761 3 1 1 2 3 4 3 4 3 4 3 4
762 3 1 1 2 4 1 4 5 3 1 1 2
763 3 1 1 2 4 2 5 1 3 2 2 3
764 3 1 1 2 4 3 1 2 3 3 3 3
765 3 1 1 2 4 4 4 4 3 4 3 4
766 3 2 2 3 1 1 1 1 3 1 1 2
767 3 2 2 3 1 2 5 1 3 2 2 3
768 3 2 2 3 1 3 1 2 3 3 3 3
769 3 2 2 3 1 4 2 3 3 4 3 4
770 3 2 2 3 2 1 3 4 3 1 1 2
771 3 2 2 3 2 2 2 2 3 2 2 3
772 3 2 2 3 2 3 4 5 3 3 3 3
773 3 2 2 3 2 4 5 1 3 4 3 4
774 3 2 2 3 3 1 1 2 3 1 1 2
775 3 2 2 3 3 2 2 3 3 2 2 3
776 3 2 2 3 3 3 3 3 3 3 3 3
777 3 2 2 3 3 4 3 4 3 4 3 4
778 3 2 2 3 4 1 4 5 3 1 1 2
779 3 2 2 3 4 2 5 1 3 2 2 3
780 3 2 2 3 4 3 1 2 3 3 3 3
781 3 2 2 3 4 4 4 4 3 4 3 4
782 3 3 3 3 1 1 1 1 3 1 1 2
783 3 3 3 3 1 2 5 1 3 2 2 3
784 3 3 3 3 1 3 1 2 3 3 3 3
785 3 3 3 3 1 4 2 3 3 4 3 4
786 3 3 3 3 2 1 3 4 3 1 1 2
787 3 3 3 3 2 2 2 2 3 2 2 3
788 3 3 3 3 2 3 4 5 3 3 3 3
789 3 3 3 3 2 4 5 1 3 4 3 4
790 3 3 3 3 3 1 1 2 3 1 1 2
791 3 3 3 3 3 2 2 3 3 2 2 3
792 3 3 3 3 3 3 3 3 3 3 3 3
793 3 3 3 3 3 4 3 4 3 4 3 4
794 3 3 3 3 4 1 4 5 3 1 1 2
795 3 3 3 3 4 2 5 1 3 2 2 3
796 3 3 3 3 4 3 1 2 3 3 3 3
797 3 3 3 3 4 4 4 4 3 4 3 4
798 3 4 3 4 1 1 1 1 3 1 1 2
799 3 4 3 4 1 2 5 1 3 2 2 3
800 3 4 3 4 1 3 1 2 3 3 3 3
801 3 4 3 4 1 4 2 3 3 4 3 4
802 3 4 3 4 2 1 3 4 3 1 1 2
803 3 4 3 4 2 2 2 2 3 2 2 3
804 3 4 3 4 2 3 4 5 3 3 3 3
805 3 4 3 4 2 4 5 1 3 4 3 4
806 3 4 3 4 3 1 1 2 3 1 1 2
807 3 4 3 4 3 2 2 3 3 2 2 3
808 3 4 3 4 3 3 3 3 3 3 3 3
809 3 4 3 4 3 4 3 4 3 4 3 4
810 3 4 3 4 4 1 4 5 3 1 1 2
811 3 4 3 4 4 2 5 1 3 2 2 3
812 3 4 3 4 4 3 1 2 3 3 3 3
813 3 4 3 4 4 4 4 4 3 4 3 4
814 4 1 4 5 1 1 1 1 4 1 4 5
815 4 1 4 5 1 2 5 1 4 2 5 1
816 4 1 4 5 1 3 1 2 4 3 1 2
817 4 1 4 5 1 4 2 3 4 4 4 4
818 4 1 4 5 2 1 3 4 4 1 4 5
819 4 1 4 5 2 2 2 2 4 2 5 1
820 4 1 4 5 2 3 4 5 4 3 1 2
821 4 1 4 5 2 4 5 1 4 4 4 4
822 4 1 4 5 3 1 1 2 4 1 4 5
823 4 1 4 5 3 2 2 3 4 2 5 1
824 4 1 4 5 3 3 3 3 4 3 1 2
825 4 1 4 5 3 4 3 4 4 4 4 4
826 4 1 4 5 4 1 4 5 4 1 4 5
827 4 1 4 5 4 2 5 1 4 2 5 1
828 4 1 4 5 4 3 1 2 4 3 1 2
829 4 1 4 5 4 4 4 4 4 4 4 4
830 4 2 5 1 1 1 1 1 4 1 4 5
831 4 2 5 1 1 2 5 1 4 2 5 1
832 4 2 5 1 1 3 1 2 4 3 1 2
833 4 2 5 1 1 4 2 3 4 4 4 4
834 4 2 5 1 2 1 3 4 4 1 4 5
835 4 2 5 1 2 2 2 2 4 2 5 1
836 4 2 5 1 2 3 4 5 4 3 1 2
837 4 2 5 1 2 4 5 1 4 4 4 4
838 4 2 5 1 3 1 1 2 4 1 4 5
839 4 2 5 1 3 2 2 3 4 2 5 1
840 4 2 5 1 3 3 3 3 4 3 1 2
841 4 2 5 1 3 4 3 4 4 4 4 4
842 4 2 5 1 4 1 4 5 4 1 4 5
843 4 2 5 1 4 2 5 1 4 2 5 1
844 4 2 5 1 4 3 1 2 4 3 1 2
845 4 2 5 1 4 4 4 4 4 4 4 4
846 4 3 1 2 1 1 1 1 4 1 4 5
847 4 3 1 2 1 2 5 1 4 2 5 1
848 4 3 1 2 1 3 1 2 4 3 1 2
849 4 3 1 2 1 4 2 3 4 4 4 4
850 4 3 1 2 2 1 3 4 4 1 4 5
851 4 3 1 2 2 2 2 2 4 2 5 1
852 4 3 1 2 2 3 4 5 4 3 1 2
853 4 3 1 2 2 4 5 1 4 4 4 4
854 4 3 1 2 3 1 1 2 4 1 4 5
855 4 3 1 2 3 2 2 3 4 2 5 1
856 4 3 1 2 3 3 3 3 4 3 1 2
857 4 3 1 2 3 4 3 4 4 4 4 4
858 4 3 1 2 4 1 4 5 4 1 4 5
859 4 3 1 2 4 2 5 1 4 2 5 1
860 4 3 1 2 4 3 1 2 4 3 1 2
861 4 3 1 2 4 4 4 4 4 4 4 4
862 4 4 4 4 1 1 1 1 4 1 4 5
863 4 4 4 4 1 2 5 1 4 2 5 1
864 4 4 4 4 1 3 1 2 4 3 1 2
865 4 4 4 4 1 4 2 3 4 4 4 4
866 4 4 4 4 2 1 3 4 4 1 4 5
867 4 4 4 4 2 2 2 2 4 2 5 1
868 4 4 4 4 2 3 4 5 4 3 1 2
869 4 4 4 4 2 4 5 1 4 4 4 4
870 4 4 4 4 3 1 1 2 4 1 4 5
871 4 4 4 4 3 2 2 3 4 2 5 1
872 4 4 4 4 3 3 3 3 4 3 1 2
873 4 4 4 4 3 4 3 4 4 4 4 4
874 4 4 4 4 4 1 4 5 4 1 4 5
875 4 4 4 4 4 2 5 1 4 2 5 1
876 4 4 4 4 4 3 1 2 4 3 1 2
877 4 4 4 4 4 4 4 4 4 4 4 4
878 explain
879 select *
880 from t1
881 straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
882 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b;
883 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
884 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 2 pushed join@1
885 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 func,test.t1.c 1 100.00 Using where
886 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
887 Warnings:
888 Note 1003 Can't push table 't2' as child, column 'a' does neither 'ref' a column nor a constant
889 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)))
890 select *
891 from t1
892 straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
893 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b;
894 a b c d a b c d a b c d
895 1 1 1 1 1 1 1 1 1 1 1 1
896 1 3 1 2 3 1 1 2 3 1 1 2
897 1 4 2 3 4 2 5 1 4 2 5 1
898 2 1 3 4 1 3 1 2 1 3 1 2
899 2 2 2 2 2 2 2 2 2 2 2 2
900 2 3 4 5 3 4 3 4 3 4 3 4
901 3 1 1 2 1 1 1 1 1 1 1 1
902 3 2 2 3 2 2 2 2 2 2 2 2
903 3 3 3 3 3 3 3 3 3 3 3 3
904 3 4 3 4 4 3 1 2 4 3 1 2
905 4 1 4 5 1 4 2 3 1 4 2 3
906 4 3 1 2 3 1 1 2 3 1 1 2
907 4 4 4 4 4 4 4 4 4 4 4 4
908 explain
909 select *
910 from t1
911 straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
912 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b
913 where t1.a=1 and t1.d=1;
914 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
915 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const # # Parent of 2 pushed join@1; Using pushed condition (`test`.`t1`.`d` = 1)
916 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 func,test.t1.c # # Using where
917 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c # # Child of 't1' in pushed join@1
918 Warnings:
919 Note 1003 Can't push table 't2' as child, column 'a' does neither 'ref' a column nor a constant
920 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)))
921 select *
922 from t1
923 straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
924 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b
925 where t1.a=1 and t1.d=1;
926 a b c d a b c d a b c d
927 1 1 1 1 1 1 1 1 1 1 1 1
928 explain
929 select *
930 from t1
931 straight_join t1 as t2 on t2.a = t1.b+0
932 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b;
933 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
934 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 NULL
935 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 func 1 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`t2`.`a` = (`test`.`t1`.`b` + 0))
936 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t2.b 1 100.00 Child of 't2' in pushed join@1
937 Warnings:
938 Note 1003 Can't push table 't2' as child, column 'a' does neither 'ref' a column nor a constant
939 Note 1003 Can't push table 't3' as child of 't1', column 't2.b' refers a table which was not pushed
940 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)))
941 select *
942 from t1
943 straight_join t1 as t2 on t2.a = t1.b+0
944 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b;
945 a b c d a b c d a b c d
946 1 1 1 1 1 1 1 1 1 1 1 1
947 1 1 1 1 1 2 5 1 1 2 5 1
948 1 1 1 1 1 3 1 2 1 3 1 2
949 1 1 1 1 1 4 2 3 1 4 2 3
950 1 2 5 1 2 1 3 4 2 1 3 4
951 1 2 5 1 2 2 2 2 2 2 2 2
952 1 2 5 1 2 3 4 5 2 3 4 5
953 1 2 5 1 2 4 5 1 2 4 5 1
954 1 3 1 2 3 1 1 2 3 1 1 2
955 1 3 1 2 3 2 2 3 3 2 2 3
956 1 3 1 2 3 3 3 3 3 3 3 3
957 1 3 1 2 3 4 3 4 3 4 3 4
958 1 4 2 3 4 1 4 5 4 1 4 5
959 1 4 2 3 4 2 5 1 4 2 5 1
960 1 4 2 3 4 3 1 2 4 3 1 2
961 1 4 2 3 4 4 4 4 4 4 4 4
962 2 1 3 4 1 1 1 1 1 1 1 1
963 2 1 3 4 1 2 5 1 1 2 5 1
964 2 1 3 4 1 3 1 2 1 3 1 2
965 2 1 3 4 1 4 2 3 1 4 2 3
966 2 2 2 2 2 1 3 4 2 1 3 4
967 2 2 2 2 2 2 2 2 2 2 2 2
968 2 2 2 2 2 3 4 5 2 3 4 5
969 2 2 2 2 2 4 5 1 2 4 5 1
970 2 3 4 5 3 1 1 2 3 1 1 2
971 2 3 4 5 3 2 2 3 3 2 2 3
972 2 3 4 5 3 3 3 3 3 3 3 3
973 2 3 4 5 3 4 3 4 3 4 3 4
974 2 4 5 1 4 1 4 5 4 1 4 5
975 2 4 5 1 4 2 5 1 4 2 5 1
976 2 4 5 1 4 3 1 2 4 3 1 2
977 2 4 5 1 4 4 4 4 4 4 4 4
978 3 1 1 2 1 1 1 1 1 1 1 1
979 3 1 1 2 1 2 5 1 1 2 5 1
980 3 1 1 2 1 3 1 2 1 3 1 2
981 3 1 1 2 1 4 2 3 1 4 2 3
982 3 2 2 3 2 1 3 4 2 1 3 4
983 3 2 2 3 2 2 2 2 2 2 2 2
984 3 2 2 3 2 3 4 5 2 3 4 5
985 3 2 2 3 2 4 5 1 2 4 5 1
986 3 3 3 3 3 1 1 2 3 1 1 2
987 3 3 3 3 3 2 2 3 3 2 2 3
988 3 3 3 3 3 3 3 3 3 3 3 3
989 3 3 3 3 3 4 3 4 3 4 3 4
990 3 4 3 4 4 1 4 5 4 1 4 5
991 3 4 3 4 4 2 5 1 4 2 5 1
992 3 4 3 4 4 3 1 2 4 3 1 2
993 3 4 3 4 4 4 4 4 4 4 4 4
994 4 1 4 5 1 1 1 1 1 1 1 1
995 4 1 4 5 1 2 5 1 1 2 5 1
996 4 1 4 5 1 3 1 2 1 3 1 2
997 4 1 4 5 1 4 2 3 1 4 2 3
998 4 2 5 1 2 1 3 4 2 1 3 4
999 4 2 5 1 2 2 2 2 2 2 2 2
1000 4 2 5 1 2 3 4 5 2 3 4 5
1001 4 2 5 1 2 4 5 1 2 4 5 1
1002 4 3 1 2 3 1 1 2 3 1 1 2
1003 4 3 1 2 3 2 2 3 3 2 2 3
1004 4 3 1 2 3 3 3 3 3 3 3 3
1005 4 3 1 2 3 4 3 4 3 4 3 4
1006 4 4 4 4 4 1 4 5 4 1 4 5
1007 4 4 4 4 4 2 5 1 4 2 5 1
1008 4 4 4 4 4 3 1 2 4 3 1 2
1009 4 4 4 4 4 4 4 4 4 4 4 4
1010 create table t1_myisam (
1011 a int not null,
1012 b int not null,
1013 c int not null,
1014 d int not null,
1015 primary key (`a`,`b`)
1016 ) engine=myisam;
1017 insert into t1_myisam values
1018 (1,1,1,1), (2,2,1,1), (3,3,1,1), (4,4,1,1);
1019 set ndb_join_pushdown=true;
1020 explain
1021 select *
1022 from t1_myisam as t1
1023 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
1024 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
1025 where t1.a=2 and t1.b=2;
1026 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1027 1 SIMPLE t1 NULL const PRIMARY PRIMARY 8 const,const 1 100.00 NULL
1028 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 Parent of 2 pushed join@1
1029 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.a,test.t2.b 1 100.00 Child of 't2' in pushed join@1; Using pushed condition ((`test`.`t3`.`b` = '1') and (`test`.`t3`.`a` = '1'))
1030 Warnings:
1031 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'))
1032 select *
1033 from t1_myisam as t1
1034 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
1035 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
1036 where t1.a=2 and t1.b=2;
1037 a b c d a b c d a b c d
1038 2 2 1 1 1 1 1 1 1 1 1 1
1039 explain
1040 select *
1041 from t1_myisam as t1
1042 join t1 as t2 on t2.a = t1.c
1043 join t1 as t3 on t3.a = t2.b and t3.b = t1.b;
1044 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1045 1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 NULL
1046 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Parent of 2 pushed join@1
1047 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.b,test.t1.b 1 100.00 Child of 't2' in pushed join@1
1048 Warnings:
1049 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_myisam` `t1` join `test`.`t1` `t2` join `test`.`t1` `t3` where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t2`.`b`))
1050 select *
1051 from t1_myisam as t1
1052 join t1 as t2 on t2.a = t1.c
1053 join t1 as t3 on t3.a = t2.b and t3.b = t1.b;
1054 a b c d a b c d a b c d
1055 1 1 1 1 1 1 1 1 1 1 1 1
1056 1 1 1 1 1 2 5 1 2 1 3 4
1057 1 1 1 1 1 3 1 2 3 1 1 2
1058 1 1 1 1 1 4 2 3 4 1 4 5
1059 2 2 1 1 1 1 1 1 1 2 5 1
1060 2 2 1 1 1 2 5 1 2 2 2 2
1061 2 2 1 1 1 3 1 2 3 2 2 3
1062 2 2 1 1 1 4 2 3 4 2 5 1
1063 3 3 1 1 1 1 1 1 1 3 1 2
1064 3 3 1 1 1 2 5 1 2 3 4 5
1065 3 3 1 1 1 3 1 2 3 3 3 3
1066 3 3 1 1 1 4 2 3 4 3 1 2
1067 4 4 1 1 1 1 1 1 1 4 2 3
1068 4 4 1 1 1 2 5 1 2 4 5 1
1069 4 4 1 1 1 3 1 2 3 4 3 4
1070 4 4 1 1 1 4 2 3 4 4 4 4
1071 drop table t1_myisam;
1072 set ndb_join_pushdown=true;
1073 explain select *
1074 from t1
1075 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
1076 where t1.d = 3;
1077 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1078 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Parent of 2 pushed join@1; Using pushed condition (`test`.`t1`.`d` = 3)
1079 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,const # # Child of 't1' in pushed join@1
1080 Warnings:
1081 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))
1082 select *
1083 from t1
1084 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
1085 where t1.d = 3;
1086 a b c d a b c d
1087 1 4 2 3 2 3 4 5
1088 3 2 2 3 2 3 4 5
1089 3 3 3 3 3 3 3 3
1090 explain select *
1091 from t1
1092 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
1093 where t1.a > 2 and t1.d = 3;
1094 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1095 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 range PRIMARY PRIMARY 4 NULL # # Parent of 2 pushed join@1; Using pushed condition ((`test`.`t1`.`d` = 3) and (`test`.`t1`.`a` > 2)); Using MRR
1096 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,const # # Child of 't1' in pushed join@1
1097 Warnings:
1098 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))
1099 select *
1100 from t1
1101 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
1102 where t1.a > 2 and t1.d = 3;
1103 a b c d a b c d
1104 3 2 2 3 2 3 4 5
1105 3 3 3 3 3 3 3 3
1106 explain select *
1107 from t1 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
1108 where t1.d = 3
1109 order by t1.a;
1110 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1111 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 index NULL PRIMARY 8 NULL # # Parent of 2 pushed join@1; Using pushed condition (`test`.`t1`.`d` = 3)
1112 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,const # # Child of 't1' in pushed join@1
1113 Warnings:
1114 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`
1115 select *
1116 from t1 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
1117 where t1.d = 3
1118 order by t1.a;
1119 a b c d a b c d
1120 1 4 2 3 2 3 4 5
1121 3 2 2 3 2 3 4 5
1122 3 3 3 3 3 3 3 3
1123 set ndb_join_pushdown=true;
1124 explain
1125 select *
1126 from t1
1127 join t1 as t2 on t2.a = t1.c
1128 join t1 as t3 on t3.a = t2.c and t3.b = t2.d
1129 where t1.a = 1 and t1.b = 1;
1130 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1131 1 SIMPLE t1 p7 eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 NULL
1132 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Parent of 2 pushed join@1
1133 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
1134 Warnings:
1135 Note 1003 Push of table 't2' as scan-child with lookup-root 't1' not implemented
1136 Note 1003 Can't push table 't3' as child of 't1', column 't2.c' refers a table which was not pushed
1137 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))
1138 select *
1139 from t1
1140 join t1 as t2 on t2.a = t1.c
1141 join t1 as t3 on t3.a = t2.c and t3.b = t2.d
1142 where t1.a = 1 and t1.b = 1;
1143 a b c d a b c d a b c d
1144 1 1 1 1 1 1 1 1 1 1 1 1
1145 1 1 1 1 1 3 1 2 1 2 5 1
1146 1 1 1 1 1 4 2 3 2 3 4 5
1147 explain
1148 select *
1149 from t1
1150 left join t1 as t2 on t2.a = t1.c
1151 left join t1 as t3 on t3.a = t2.c and t3.b = t2.d
1152 where t1.a = 1 and t1.b = 1;
1153 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1154 1 SIMPLE t1 p7 eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 NULL
1155 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Parent of 2 pushed join@1
1156 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
1157 Warnings:
1158 Note 1003 Push of table 't2' as scan-child with lookup-root 't1' not implemented
1159 Note 1003 Can't push table 't3' as child of 't1', column 't2.c' refers a table which was not pushed
1160 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))
1161 select *
1162 from t1
1163 left join t1 as t2 on t2.a = t1.c
1164 left join t1 as t3 on t3.a = t2.c and t3.b = t2.d
1165 where t1.a = 1 and t1.b = 1;
1166 a b c d a b c d a b c d
1167 1 1 1 1 1 1 1 1 1 1 1 1
1168 1 1 1 1 1 2 5 1 NULL NULL NULL NULL
1169 1 1 1 1 1 3 1 2 1 2 5 1
1170 1 1 1 1 1 4 2 3 2 3 4 5
1171 set ndb_join_pushdown=false;
1172 explain
1173 select *
1174 from t1
1175 join t1 as t2 on t2.a = t1.c
1176 join t1 as t3 on t3.a = t2.c and t3.b = t2.d
1177 where t1.a = 1 and t1.b = 1;
1178 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1179 1 SIMPLE t1 p7 const PRIMARY PRIMARY 8 const,const 1 100.00 NULL
1180 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 NULL
1181 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 NULL
1182 Warnings:
1183 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`))
1184 select *
1185 from t1
1186 join t1 as t2 on t2.a = t1.c
1187 join t1 as t3 on t3.a = t2.c and t3.b = t2.d
1188 where t1.a = 1 and t1.b = 1;
1189 a b c d a b c d a b c d
1190 1 1 1 1 1 1 1 1 1 1 1 1
1191 1 1 1 1 1 3 1 2 1 2 5 1
1192 1 1 1 1 1 4 2 3 2 3 4 5
1193 explain
1194 select *
1195 from t1
1196 left join t1 as t2 on t2.a = t1.c
1197 left join t1 as t3 on t3.a = t2.c and t3.b = t2.d
1198 where t1.a = 1 and t1.b = 1;
1199 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1200 1 SIMPLE t1 p7 const PRIMARY PRIMARY 8 const,const 1 100.00 NULL
1201 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 NULL
1202 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 NULL
1203 Warnings:
1204 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 true
1205 select *
1206 from t1
1207 left join t1 as t2 on t2.a = t1.c
1208 left join t1 as t3 on t3.a = t2.c and t3.b = t2.d
1209 where t1.a = 1 and t1.b = 1;
1210 a b c d a b c d a b c d
1211 1 1 1 1 1 1 1 1 1 1 1 1
1212 1 1 1 1 1 2 5 1 NULL NULL NULL NULL
1213 1 1 1 1 1 3 1 2 1 2 5 1
1214 1 1 1 1 1 4 2 3 2 3 4 5
1215 set ndb_join_pushdown=true;
1216 explain
1217 select *
1218 from t1 as t2
1219 join t1 as t3 on t3.a = t2.c and t3.b = t2.d
1220 where t2.a = 1;
1221 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1222 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
1223 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
1224 Warnings:
1225 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))
1226 select *
1227 from t1 as t2
1228 join t1 as t3 on t3.a = t2.c and t3.b = t2.d
1229 where t2.a = 1;
1230 a b c d a b c d
1231 1 1 1 1 1 1 1 1
1232 1 3 1 2 1 2 5 1
1233 1 4 2 3 2 3 4 5
1234 set ndb_join_pushdown=true;
1235 explain
1236 select straight_join *
1237 from t1
1238 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1239 join t1 as t3 on t3.a = t2.c and t3.b = t1.c;
1240 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1241 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
1242 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1243 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t1.c 1 100.00 Child of 't2' in pushed join@1
1244 Warnings:
1245 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`))
1246 select straight_join *
1247 from t1
1248 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1249 join t1 as t3 on t3.a = t2.c and t3.b = t1.c;
1250 a b c d a b c d a b c d
1251 1 1 1 1 1 1 1 1 1 1 1 1
1252 1 3 1 2 1 3 1 2 1 1 1 1
1253 1 4 2 3 1 4 2 3 2 2 2 2
1254 2 1 3 4 2 1 3 4 3 3 3 3
1255 2 2 2 2 2 2 2 2 2 2 2 2
1256 2 3 4 5 2 3 4 5 4 4 4 4
1257 3 1 1 2 3 1 1 2 1 1 1 1
1258 3 2 2 3 3 2 2 3 2 2 2 2
1259 3 3 3 3 3 3 3 3 3 3 3 3
1260 3 4 3 4 3 4 3 4 3 3 3 3
1261 4 1 4 5 4 1 4 5 4 4 4 4
1262 4 3 1 2 4 3 1 2 1 1 1 1
1263 4 4 4 4 4 4 4 4 4 4 4 4
1264 explain
1265 select straight_join *
1266 from t1
1267 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1268 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1269 join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
1270 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1271 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1272 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1273 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't2' in pushed join@1
1274 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t2.c 1 100.00 Child of 't3' in pushed join@1
1275 Warnings:
1276 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`))
1277 select straight_join *
1278 from t1
1279 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1280 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1281 join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
1282 a b c d a b c d a b c d a b c d
1283 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1284 1 4 2 3 1 4 2 3 2 3 4 5 4 2 5 1
1285 2 1 3 4 2 1 3 4 3 4 3 4 3 3 3 3
1286 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
1287 3 2 2 3 3 2 2 3 2 3 4 5 4 2 5 1
1288 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
1289 3 4 3 4 3 4 3 4 3 4 3 4 3 3 3 3
1290 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
1291 explain
1292 select straight_join *
1293 from t1
1294 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1295 join t1 as t3 on t3.a = t1.c and t3.b = t2.d
1296 join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
1297 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1298 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1299 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1300 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
1301 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t2.c 1 100.00 Child of 't3' in pushed join@1
1302 Warnings:
1303 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`))
1304 select straight_join *
1305 from t1
1306 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1307 join t1 as t3 on t3.a = t1.c and t3.b = t2.d
1308 join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
1309 a b c d a b c d a b c d a b c d
1310 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1311 1 4 2 3 1 4 2 3 2 3 4 5 4 2 5 1
1312 2 1 3 4 2 1 3 4 3 4 3 4 3 3 3 3
1313 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
1314 3 2 2 3 3 2 2 3 2 3 4 5 4 2 5 1
1315 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
1316 3 4 3 4 3 4 3 4 3 4 3 4 3 3 3 3
1317 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
1318 explain
1319 select straight_join *
1320 from t1
1321 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1322 join t1 as t3 on t3.a = t1.c and t3.b = t2.d
1323 join t1 as t4 on t4.a = t3.c and t4.b = t1.d;
1324 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1325 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1326 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1327 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
1328 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t1.d 1 100.00 Child of 't3' in pushed join@1
1329 Warnings:
1330 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`))
1331 select straight_join *
1332 from t1
1333 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1334 join t1 as t3 on t3.a = t1.c and t3.b = t2.d
1335 join t1 as t4 on t4.a = t3.c and t4.b = t1.d;
1336 a b c d a b c d a b c d a b c d
1337 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1338 1 4 2 3 1 4 2 3 2 3 4 5 4 3 1 2
1339 2 1 3 4 2 1 3 4 3 4 3 4 3 4 3 4
1340 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
1341 3 2 2 3 3 2 2 3 2 3 4 5 4 3 1 2
1342 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
1343 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4
1344 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
1345 explain
1346 select straight_join *
1347 from t1
1348 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1349 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1350 join t1 as t4 on t4.a = t3.a and t4.b = t2.c;
1351 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1352 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1353 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1354 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
1355 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t2.c 1 100.00 Child of 't2' in pushed join@1
1356 Warnings:
1357 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`))
1358 select straight_join *
1359 from t1
1360 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1361 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1362 join t1 as t4 on t4.a = t3.a and t4.b = t2.c;
1363 a b c d a b c d a b c d a b c d
1364 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1365 1 3 1 2 1 3 1 2 1 2 5 1 1 1 1 1
1366 1 4 2 3 1 4 2 3 2 3 4 5 2 2 2 2
1367 2 1 3 4 2 1 3 4 3 4 3 4 3 3 3 3
1368 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
1369 3 1 1 2 3 1 1 2 1 2 5 1 1 1 1 1
1370 3 2 2 3 3 2 2 3 2 3 4 5 2 2 2 2
1371 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
1372 3 4 3 4 3 4 3 4 3 4 3 4 3 3 3 3
1373 4 3 1 2 4 3 1 2 1 2 5 1 1 1 1 1
1374 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
1375 explain
1376 select straight_join *
1377 from t1
1378 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1379 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1380 join t1 as t4 on t4.a = t3.b and t4.b = t2.c;
1381 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1382 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1383 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1384 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
1385 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.d,test.t2.c 1 100.00 Child of 't2' in pushed join@1
1386 Warnings:
1387 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`))
1388 select straight_join *
1389 from t1
1390 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1391 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1392 join t1 as t4 on t4.a = t3.b and t4.b = t2.c;
1393 a b c d a b c d a b c d a b c d
1394 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1395 1 3 1 2 1 3 1 2 1 2 5 1 2 1 3 4
1396 1 4 2 3 1 4 2 3 2 3 4 5 3 2 2 3
1397 2 1 3 4 2 1 3 4 3 4 3 4 4 3 1 2
1398 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
1399 3 1 1 2 3 1 1 2 1 2 5 1 2 1 3 4
1400 3 2 2 3 3 2 2 3 2 3 4 5 3 2 2 3
1401 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
1402 3 4 3 4 3 4 3 4 3 4 3 4 4 3 1 2
1403 4 3 1 2 4 3 1 2 1 2 5 1 2 1 3 4
1404 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
1405 explain
1406 select straight_join *
1407 from t1
1408 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1409 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1410 join t1 as t4 on t4.a = t3.c and t4.b = t2.a;
1411 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1412 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1413 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1414 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
1415 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t1.a 1 100.00 Child of 't3' in pushed join@1
1416 Warnings:
1417 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`))
1418 select straight_join *
1419 from t1
1420 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1421 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1422 join t1 as t4 on t4.a = t3.c and t4.b = t2.a;
1423 a b c d a b c d a b c d a b c d
1424 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1425 1 4 2 3 1 4 2 3 2 3 4 5 4 1 4 5
1426 2 1 3 4 2 1 3 4 3 4 3 4 3 2 2 3
1427 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
1428 3 2 2 3 3 2 2 3 2 3 4 5 4 3 1 2
1429 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
1430 3 4 3 4 3 4 3 4 3 4 3 4 3 3 3 3
1431 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
1432 explain
1433 select straight_join *
1434 from t1
1435 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1436 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1437 join t1 as t4 on t4.a = t3.c and t4.b = t2.b;
1438 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1439 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1440 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1441 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
1442 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t1.b 1 100.00 Child of 't3' in pushed join@1
1443 Warnings:
1444 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`))
1445 select straight_join *
1446 from t1
1447 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1448 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1449 join t1 as t4 on t4.a = t3.c and t4.b = t2.b;
1450 a b c d a b c d a b c d a b c d
1451 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1452 1 4 2 3 1 4 2 3 2 3 4 5 4 4 4 4
1453 2 1 3 4 2 1 3 4 3 4 3 4 3 1 1 2
1454 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
1455 3 2 2 3 3 2 2 3 2 3 4 5 4 2 5 1
1456 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
1457 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4
1458 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
1459 explain
1460 select straight_join *
1461 from t1
1462 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1463 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1464 join t1 as t4 on t4.a = t1.c and t4.b = t2.c;
1465 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1466 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1467 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1468 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
1469 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t2.c 1 100.00 Child of 't2' in pushed join@1
1470 Warnings:
1471 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`))
1472 select straight_join *
1473 from t1
1474 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1475 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1476 join t1 as t4 on t4.a = t1.c and t4.b = t2.c;
1477 a b c d a b c d a b c d a b c d
1478 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1479 1 3 1 2 1 3 1 2 1 2 5 1 1 1 1 1
1480 1 4 2 3 1 4 2 3 2 3 4 5 2 2 2 2
1481 2 1 3 4 2 1 3 4 3 4 3 4 3 3 3 3
1482 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
1483 3 1 1 2 3 1 1 2 1 2 5 1 1 1 1 1
1484 3 2 2 3 3 2 2 3 2 3 4 5 2 2 2 2
1485 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
1486 3 4 3 4 3 4 3 4 3 4 3 4 3 3 3 3
1487 4 3 1 2 4 3 1 2 1 2 5 1 1 1 1 1
1488 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
1489 explain
1490 select straight_join *
1491 from t1
1492 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1493 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1494 join t1 as t4 on t4.a = t3.c and t4.b = t1.b;
1495 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1496 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1497 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1498 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
1499 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t1.b 1 100.00 Child of 't3' in pushed join@1
1500 Warnings:
1501 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`))
1502 select straight_join *
1503 from t1
1504 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1505 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1506 join t1 as t4 on t4.a = t3.c and t4.b = t1.b;
1507 a b c d a b c d a b c d a b c d
1508 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1509 1 4 2 3 1 4 2 3 2 3 4 5 4 4 4 4
1510 2 1 3 4 2 1 3 4 3 4 3 4 3 1 1 2
1511 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
1512 3 2 2 3 3 2 2 3 2 3 4 5 4 2 5 1
1513 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
1514 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4
1515 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
1516 explain
1517 select straight_join *
1518 from t1
1519 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1520 join t1 as t2x on t2x.a = t2.c and t2x.b = t2.d
1521 join t1 as t3x on t3x.a = t1.c and t3x.b = t1.d
1522 join t1 as t4 on t4.a = t3x.c and t4.b = t2x.c;
1523 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1524 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 5 pushed join@1
1525 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1526 1 SIMPLE t2x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
1527 1 SIMPLE t3x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't2x' in pushed join@1
1528 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3x.c,test.t2x.c 1 100.00 Child of 't3x' in pushed join@1
1529 Warnings:
1530 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`))
1531 explain
1532 select straight_join *
1533 from t1
1534 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1535 join t1 as t2x on t2x.a = t2.c and t2x.b = t2.d
1536 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1537 join t1 as t3x on t3x.a = t3.c and t3x.b = t3.d
1538 join t1 as t4 on t4.a = t3x.c and t4.b = t2x.c;
1539 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1540 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 6 pushed join@1
1541 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1542 1 SIMPLE t2x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
1543 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't2x' in pushed join@1
1544 1 SIMPLE t3x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t3.d 1 100.00 Child of 't3' in pushed join@1
1545 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3x.c,test.t2x.c 1 100.00 Child of 't3x' in pushed join@1
1546 Warnings:
1547 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`))
1548 explain
1549 select straight_join *
1550 from t1
1551 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1552 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1553 join t1 as t2x on t2x.a = t2.c and t2x.b = t2.d
1554 join t1 as t3x on t3x.a = t3.c and t3x.b = t3.d
1555 join t1 as t4 on t4.a = t3x.c and t4.b = t2x.c;
1556 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1557 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 6 pushed join@1
1558 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1559 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't2' in pushed join@1
1560 1 SIMPLE t2x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 Child of 't3' in pushed join@1
1561 1 SIMPLE t3x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t3.d 1 100.00 Child of 't2x' in pushed join@1
1562 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3x.c,test.t2x.c 1 100.00 Child of 't3x' in pushed join@1
1563 Warnings:
1564 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`))
1565 explain
1566 select straight_join *
1567 from t1
1568 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1569 join t1 as t2x on t2x.a = t2.c and t2x.b = t2.d
1570 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1571 join t1 as t3x on t3x.a = t1.c and t3x.b = t1.d
1572 join t1 as t4 on t4.a = t3x.c and t4.b = t2x.c;
1573 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1574 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 6 pushed join@1
1575 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1576 1 SIMPLE t2x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
1577 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't2x' in pushed join@1
1578 1 SIMPLE t3x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't3' in pushed join@1
1579 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3x.c,test.t2x.c 1 100.00 Child of 't3x' in pushed join@1
1580 Warnings:
1581 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`))
1582 explain
1583 select straight_join *
1584 from t1
1585 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1586 join t1 as t2x on t2x.a = t2.c and t2x.b = t2.d
1587 join t1 as t3 on t3.a = t1.c and t3.b = t1.b
1588 join t1 as t3x on t3x.a = t1.c and t3x.b = t1.d
1589 join t1 as t4 on t4.a = t3x.c and t4.b = t2x.c;
1590 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1591 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 6 pushed join@1
1592 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1593 1 SIMPLE t2x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
1594 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.b 1 100.00 Child of 't2x' in pushed join@1
1595 1 SIMPLE t3x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't3' in pushed join@1
1596 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3x.c,test.t2x.c 1 100.00 Child of 't3x' in pushed join@1
1597 Warnings:
1598 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`))
1599 explain
1600 select straight_join *
1601 from t1
1602 left join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1603 join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1604 left join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
1605 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1606 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
1607 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1608 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
1609 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t2.c 1 100.00 NULL
1610 Warnings:
1611 Note 1003 Can't push table 't4' as child of 't1', as it would make the parent table 't3' depend on table(s) outside of its join-nest
1612 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`))
1613 explain
1614 select straight_join *
1615 from t1
1616 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1617 left join t1 as t3 on t3.a = t1.c and t3.b = t1.d
1618 left join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
1619 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1620 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1621 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1622 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't2' in pushed join@1
1623 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t2.c 1 100.00 Child of 't3' in pushed join@1
1624 Warnings:
1625 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`))
1626 explain
1627 select straight_join *
1628 from t1
1629 left join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1630 join t1 as t3 on t3.a = t1.a
1631 left join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
1632 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1633 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
1634 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1635 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Child of 't1' in pushed join@1
1636 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t2.c 1 100.00 NULL
1637 Warnings:
1638 Note 1003 Can't push table 't4' as child of 't1', as it would make the parent table 't3' depend on table(s) outside of its join-nest
1639 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`)
1640 explain
1641 select straight_join *
1642 from t1
1643 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1644 left join t1 as t3 on t3.a = t1.a
1645 left join t1 as t4 on t4.a = t3.c and t4.b = t2.c;
1646 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1647 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1648 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1649 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Child of 't2' in pushed join@1
1650 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t2.c 1 100.00 Child of 't3' in pushed join@1
1651 Warnings:
1652 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`.`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`))
1653 explain
1654 select straight_join *
1655 from t1
1656 left join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1657 join t1 as t3 on t3.a = t1.a
1658 left join t1 as t4 on t4.a = t3.c;
1659 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1660 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1661 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1662 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Child of 't1' in pushed join@1
1663 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t3.c 1 100.00 Child of 't3' in pushed join@1
1664 Warnings:
1665 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`)
1666 explain
1667 select straight_join *
1668 from t1
1669 join t1 as t2 on t2.a = t1.a and t2.b = t1.b
1670 left join t1 as t3 on t3.a = t1.a
1671 left join t1 as t4 on t4.a = t3.c;
1672 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1673 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1674 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1675 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Child of 't1' in pushed join@1
1676 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t3.c 1 100.00 Child of 't3' in pushed join@1
1677 Warnings:
1678 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`.`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`))
1679 explain
1680 select straight_join *
1681 from
1682 ( t1 as t0 left join t1 as t1 on t1.a = t0.a and t1.b = t0.b
1683 )
1684 left join
1685 ( t1 as t2 join t1 as t3 on t3.a = t2.c and t3.b = t2.d
1686 join t1 as t4 on t4.a = t3.c and t4.b = t2.c
1687 )
1688 on t2.a = t1.a and t2.b = t1.b;
1689 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1690 1 SIMPLE t0 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 5 pushed join@1
1691 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t0.a,test.t0.b 1 100.00 Child of 't0' in pushed join@1
1692 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.a,test.t1.b 1 100.00 Child of 't1' in pushed join@1
1693 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
1694 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t3.c,test.t2.c 1 100.00 Child of 't3' in pushed join@1
1695 Warnings:
1696 Note 1003 /* select#1 */ select straight_join `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t0`.`d` AS `d`,`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` `t0` left join `test`.`t1` on(((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t1`.`a` = `test`.`t0`.`a`))) left join (`test`.`t1` `t2` join `test`.`t1` `t3` join `test`.`t1` `t4`) on(((`test`.`t3`.`b` = `test`.`t2`.`d`) and (`test`.`t3`.`a` = `test`.`t2`.`c`) and (`test`.`t4`.`b` = `test`.`t2`.`c`) and (`test`.`t4`.`a` = `test`.`t3`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`a` = `test`.`t1`.`a`))) where true
1697 explain
1698 select straight_join *
1699 from
1700 t1 as x1
1701 left join
1702 ( t1 as x2 join t1 as x3 on x3.a=x2.c
1703 join t1 as x4 on x4.a=x2.d
1704 join t1 as x5 on x5.a=x3.d and x5.b=x4.d
1705 )
1706 on x2.a=x1.c and x2.b=x1.c and
1707 x3.b=x1.d and
1708 x4.b=x1.d;
1709 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1710 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 5 pushed join@1
1711 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x1.c,test.x1.c 1 100.00 Child of 'x1' in pushed join@1
1712 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x2.c,test.x1.d 1 100.00 Child of 'x2' in pushed join@1
1713 1 SIMPLE x4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x2.d,test.x3.b 1 100.00 Child of 'x3' in pushed join@1; Using pushed condition (`test`.`x4`.`b` = `test`.`x1`.`d`)
1714 1 SIMPLE x5 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x3.d,test.x4.d 1 100.00 Child of 'x4' in pushed join@1
1715 Warnings:
1716 Note 1003 /* select#1 */ select straight_join `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`,`test`.`x5`.`a` AS `a`,`test`.`x5`.`b` AS `b`,`test`.`x5`.`c` AS `c`,`test`.`x5`.`d` AS `d` from `test`.`t1` `x1` left join (`test`.`t1` `x2` join `test`.`t1` `x3` join `test`.`t1` `x4` join `test`.`t1` `x5`) on(((`test`.`x3`.`a` = `test`.`x2`.`c`) and (`test`.`x4`.`a` = `test`.`x2`.`d`) and (`test`.`x5`.`b` = `test`.`x4`.`d`) and (`test`.`x5`.`a` = `test`.`x3`.`d`) and (`test`.`x3`.`b` = `test`.`x1`.`d`) and (`test`.`x4`.`b` = `test`.`x1`.`d`) and (`test`.`x2`.`a` = `test`.`x1`.`c`) and (`test`.`x2`.`b` = `test`.`x1`.`c`))) where true
1717 explain
1718 select straight_join * from
1719 (t1 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d)
1720 inner join t1 as t3 on t3.a = t1.b and t3.b = t1.c
1721 left join t1 as t4 on t4.a = t2.c and t4.b = t1.c;
1722 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1723 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1724 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
1725 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
1726 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t1.c 1 100.00 Child of 't2' in pushed join@1
1727 Warnings:
1728 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`.`d`) and (`test`.`t2`.`a` = `test`.`t1`.`c`))) join `test`.`t1` `t3` left join `test`.`t1` `t4` on(((`test`.`t4`.`b` = `test`.`t1`.`c`) and (`test`.`t4`.`a` = `test`.`t2`.`c`))) where ((`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t3`.`a` = `test`.`t1`.`b`))
1729 select straight_join * from
1730 (t1 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d)
1731 inner join t1 as t3 on t3.a = t1.b and t3.b = t1.c
1732 left join t1 as t4 on t4.a = t2.c and t4.b = t1.c;
1733 a b c d a b c d a b c d a b c d
1734 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1735 1 3 1 2 1 2 5 1 3 1 1 2 NULL NULL NULL NULL
1736 1 4 2 3 2 3 4 5 4 2 5 1 4 2 5 1
1737 2 1 3 4 3 4 3 4 1 3 1 2 3 3 3 3
1738 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
1739 2 3 4 5 NULL NULL NULL NULL 3 4 3 4 NULL NULL NULL NULL
1740 3 1 1 2 1 2 5 1 1 1 1 1 NULL NULL NULL NULL
1741 3 2 2 3 2 3 4 5 2 2 2 2 4 2 5 1
1742 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
1743 3 4 3 4 3 4 3 4 4 3 1 2 3 3 3 3
1744 4 1 4 5 NULL NULL NULL NULL 1 4 2 3 NULL NULL NULL NULL
1745 4 3 1 2 1 2 5 1 3 1 1 2 NULL NULL NULL NULL
1746 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
1747 explain
1748 select straight_join * from
1749 (t1 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d)
1750 inner join t1 as t3 on t3.a = t2.b and t3.b = t1.c
1751 left join t1 as t4 on t4.a = t2.c and t4.b = t1.c;
1752 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1753 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1754 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
1755 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.d,test.t1.c 1 100.00 Child of 't1' in pushed join@1
1756 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t1.c 1 100.00 Child of 't2' in pushed join@1
1757 Warnings:
1758 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` left join `test`.`t1` `t4` on(((`test`.`t4`.`b` = `test`.`t1`.`c`) and (`test`.`t4`.`a` = `test`.`t2`.`c`))) where ((`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t3`.`b` = `test`.`t1`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`d`) and (`test`.`t3`.`a` = `test`.`t1`.`d`))
1759 select straight_join * from
1760 (t1 left join t1 as t2 on t2.a = t1.c and t2.b = t1.d)
1761 inner join t1 as t3 on t3.a = t2.b and t3.b = t1.c
1762 left join t1 as t4 on t4.a = t2.c and t4.b = t1.c;
1763 a b c d a b c d a b c d a b c d
1764 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1765 1 3 1 2 1 2 5 1 2 1 3 4 NULL NULL NULL NULL
1766 1 4 2 3 2 3 4 5 3 2 2 3 4 2 5 1
1767 2 1 3 4 3 4 3 4 4 3 1 2 3 3 3 3
1768 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
1769 3 1 1 2 1 2 5 1 2 1 3 4 NULL NULL NULL NULL
1770 3 2 2 3 2 3 4 5 3 2 2 3 4 2 5 1
1771 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
1772 3 4 3 4 3 4 3 4 4 3 1 2 3 3 3 3
1773 4 3 1 2 1 2 5 1 2 1 3 4 NULL NULL NULL NULL
1774 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
1775 set ndb_join_pushdown=true;
1776 explain
1777 select * from t1 x, t1 y, t1 z, t1 where
1778 y.a=x.d and y.b=x.b and
1779 z.a=y.d and
1780 t1.a = z.d and t1.b=z.b;
1781 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1782 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
1783 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d,test.x.b 1 100.00 Child of 'x' in pushed join@1
1784 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.y.d 1 100.00 Child of 'y' in pushed join@1
1785 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.z.d,test.z.b 1 100.00 Child of 'z' in pushed join@1
1786 Warnings:
1787 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`))
1788 select * from t1 x, t1 y, t1 z, t1 where
1789 y.a=x.d and y.b=x.b and
1790 z.a=y.d and
1791 t1.a = z.d and t1.b=z.b;
1792 a b c d a b c d a b c d a b c d
1793 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1794 1 1 1 1 1 1 1 1 1 2 5 1 1 2 5 1
1795 1 1 1 1 1 1 1 1 1 3 1 2 2 3 4 5
1796 1 1 1 1 1 1 1 1 1 4 2 3 3 4 3 4
1797 1 2 5 1 1 2 5 1 1 1 1 1 1 1 1 1
1798 1 2 5 1 1 2 5 1 1 2 5 1 1 2 5 1
1799 1 2 5 1 1 2 5 1 1 3 1 2 2 3 4 5
1800 1 2 5 1 1 2 5 1 1 4 2 3 3 4 3 4
1801 1 4 2 3 3 4 3 4 4 2 5 1 1 2 5 1
1802 1 4 2 3 3 4 3 4 4 3 1 2 2 3 4 5
1803 1 4 2 3 3 4 3 4 4 4 4 4 4 4 4 4
1804 2 2 2 2 2 2 2 2 2 1 3 4 4 1 4 5
1805 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
1806 2 2 2 2 2 2 2 2 2 4 5 1 1 4 2 3
1807 2 4 5 1 1 4 2 3 3 1 1 2 2 1 3 4
1808 2 4 5 1 1 4 2 3 3 2 2 3 3 2 2 3
1809 2 4 5 1 1 4 2 3 3 3 3 3 3 3 3 3
1810 2 4 5 1 1 4 2 3 3 4 3 4 4 4 4 4
1811 3 1 1 2 2 1 3 4 4 2 5 1 1 2 5 1
1812 3 1 1 2 2 1 3 4 4 3 1 2 2 3 4 5
1813 3 1 1 2 2 1 3 4 4 4 4 4 4 4 4 4
1814 3 2 2 3 3 2 2 3 3 1 1 2 2 1 3 4
1815 3 2 2 3 3 2 2 3 3 2 2 3 3 2 2 3
1816 3 2 2 3 3 2 2 3 3 3 3 3 3 3 3 3
1817 3 2 2 3 3 2 2 3 3 4 3 4 4 4 4 4
1818 3 3 3 3 3 3 3 3 3 1 1 2 2 1 3 4
1819 3 3 3 3 3 3 3 3 3 2 2 3 3 2 2 3
1820 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
1821 3 3 3 3 3 3 3 3 3 4 3 4 4 4 4 4
1822 3 4 3 4 4 4 4 4 4 2 5 1 1 2 5 1
1823 3 4 3 4 4 4 4 4 4 3 1 2 2 3 4 5
1824 3 4 3 4 4 4 4 4 4 4 4 4 4 4 4 4
1825 4 2 5 1 1 2 5 1 1 1 1 1 1 1 1 1
1826 4 2 5 1 1 2 5 1 1 2 5 1 1 2 5 1
1827 4 2 5 1 1 2 5 1 1 3 1 2 2 3 4 5
1828 4 2 5 1 1 2 5 1 1 4 2 3 3 4 3 4
1829 4 4 4 4 4 4 4 4 4 2 5 1 1 2 5 1
1830 4 4 4 4 4 4 4 4 4 3 1 2 2 3 4 5
1831 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
1832 explain
1833 select * from t1 x, t1 y where
1834 x.a <= 2 and
1835 y.a=x.d and y.b=x.b;
1836 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1837 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 range PRIMARY PRIMARY 4 NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`a` <= 2); Using MRR
1838 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d,test.x.b 1 100.00 Child of 'x' in pushed join@1
1839 Warnings:
1840 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))
1841 select * from t1 x, t1 y where
1842 x.a <= 2 and
1843 y.a=x.d and y.b=x.b;
1844 a b c d a b c d
1845 1 1 1 1 1 1 1 1
1846 1 2 5 1 1 2 5 1
1847 1 3 1 2 2 3 4 5
1848 1 4 2 3 3 4 3 4
1849 2 1 3 4 4 1 4 5
1850 2 2 2 2 2 2 2 2
1851 2 4 5 1 1 4 2 3
1852 explain
1853 select * from t1 x, t1 y where
1854 (x.a <= 2 or x.a > 3) and
1855 y.a=x.d and y.b=x.b;
1856 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1857 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 range PRIMARY PRIMARY 4 NULL 6 100.00 Parent of 2 pushed join@1; Using pushed condition ((`test`.`x`.`a` <= 2) or (`test`.`x`.`a` > 3)); Using MRR
1858 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d,test.x.b 1 100.00 Child of 'x' in pushed join@1
1859 Warnings:
1860 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)))
1861 select * from t1 x, t1 y where
1862 (x.a <= 2 or x.a > 3) and
1863 y.a=x.d and y.b=x.b;
1864 a b c d a b c d
1865 1 1 1 1 1 1 1 1
1866 1 2 5 1 1 2 5 1
1867 1 3 1 2 2 3 4 5
1868 1 4 2 3 3 4 3 4
1869 2 1 3 4 4 1 4 5
1870 2 2 2 2 2 2 2 2
1871 2 4 5 1 1 4 2 3
1872 4 2 5 1 1 2 5 1
1873 4 3 1 2 2 3 4 5
1874 4 4 4 4 4 4 4 4
1875 explain
1876 select * from t1 x, t1 y where
1877 (x.a >= 2 or x.a < 3) and
1878 y.a=x.d and y.b=x.b;
1879 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1880 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL # # Parent of 2 pushed join@1; Using pushed condition ((`test`.`x`.`a` >= 2) or (`test`.`x`.`a` < 3))
1881 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d,test.x.b # # Child of 'x' in pushed join@1
1882 Warnings:
1883 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)))
1884 select * from t1 x, t1 y where
1885 (x.a >= 2 or x.a < 3) and
1886 y.a=x.d and y.b=x.b;
1887 a b c d a b c d
1888 1 1 1 1 1 1 1 1
1889 1 2 5 1 1 2 5 1
1890 1 3 1 2 2 3 4 5
1891 1 4 2 3 3 4 3 4
1892 2 1 3 4 4 1 4 5
1893 2 2 2 2 2 2 2 2
1894 2 4 5 1 1 4 2 3
1895 3 1 1 2 2 1 3 4
1896 3 2 2 3 3 2 2 3
1897 3 3 3 3 3 3 3 3
1898 3 4 3 4 4 4 4 4
1899 4 2 5 1 1 2 5 1
1900 4 3 1 2 2 3 4 5
1901 4 4 4 4 4 4 4 4
1902 explain
1903 select * from t1 x, t1 y where
1904 (x.a <= 2 or x.a in (0,5,4)) and
1905 y.a=x.d and y.b=x.b;
1906 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1907 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 range PRIMARY PRIMARY 4 NULL 9 100.00 Parent of 2 pushed join@1; Using pushed condition ((`test`.`x`.`a` <= 2) or (`test`.`x`.`a` in (0,5,4))); Using MRR
1908 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d,test.x.b 1 100.00 Child of 'x' in pushed join@1
1909 Warnings:
1910 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))))
1911 select * from t1 x, t1 y where
1912 (x.a <= 2 or x.a in (0,5,4)) and
1913 y.a=x.d and y.b=x.b;
1914 a b c d a b c d
1915 1 1 1 1 1 1 1 1
1916 1 2 5 1 1 2 5 1
1917 1 3 1 2 2 3 4 5
1918 1 4 2 3 3 4 3 4
1919 2 1 3 4 4 1 4 5
1920 2 2 2 2 2 2 2 2
1921 2 4 5 1 1 4 2 3
1922 4 2 5 1 1 2 5 1
1923 4 3 1 2 2 3 4 5
1924 4 4 4 4 4 4 4 4
1925 explain
1926 select * from t1 x, t1 y where
1927 (x.a <= 2 or (x.a,x.b) in ((0,0),(5,0),(4,3))) and
1928 y.a=x.d and y.b=x.b;
1929 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1930 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 range PRIMARY PRIMARY 8 NULL 5 100.00 Parent of 2 pushed join@1; Using where; Using MRR
1931 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d,test.x.b 1 100.00 Child of 'x' in pushed join@1
1932 Warnings:
1933 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 ((0,0),(5,0),(4,3)))))
1934 select * from t1 x, t1 y where
1935 (x.a <= 2 or (x.a,x.b) in ((0,0),(5,0),(4,3))) and
1936 y.a=x.d and y.b=x.b;
1937 a b c d a b c d
1938 1 1 1 1 1 1 1 1
1939 1 2 5 1 1 2 5 1
1940 1 3 1 2 2 3 4 5
1941 1 4 2 3 3 4 3 4
1942 2 1 3 4 4 1 4 5
1943 2 2 2 2 2 2 2 2
1944 2 4 5 1 1 4 2 3
1945 4 3 1 2 2 3 4 5
1946 explain format=tree
1947 select straight_join t1.b, count(distinct t2.b) as cnt
1948 from t1
1949 join t1 as t2 on t2.a = t1.c
1950 group by t1.b
1951 order by t1.b, cnt;
1952 EXPLAIN
1953 -> Sort: t1.b, cnt
1954 -> Stream results (cost=4013 rows=4)
1955 -> Group aggregate: count(distinct t2.b) (cost=4013 rows=4)
1956 -> Nested loop inner join (cost=4011 rows=16)
1957 -> Sort: t1.b (cost=4002 rows=16)
1958 -> Table scan on t1 (cost=4002 rows=16)
1959 -> Index lookup on t2 using PRIMARY (a=t1.c) (cost=0.506 rows=1)
1960
1961 Warnings:
1962 Note 1003 Can't push table 't2' as child of 't1', it is in a sorted-branch which can't be referred.
1963 select straight_join t1.b, count(distinct t2.b) as cnt
1964 from t1
1965 join t1 as t2 on t2.a = t1.c
1966 group by t1.b
1967 order by t1.b, cnt;
1968 b cnt
1969 1 4
1970 2 4
1971 3 4
1972 4 4
1973 explain
1974 select *
1975 from t1
1976 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
1977 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
1978 order by t1.c,t1.d,
1979 t1.a, t1.b;
1980 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1981 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Using filesort
1982 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Parent of 2 pushed join@1
1983 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't2' in pushed join@1
1984 Warnings:
1985 Note 1003 Can't push table 't2' as child of 't1', it is in a sorted-branch which can't be referred.
1986 Note 1003 Can't push table 't3' as child of 't1', it is in a sorted-branch which can't be referred.
1987 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`
1988 select *
1989 from t1
1990 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
1991 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
1992 order by t1.c,t1.d,
1993 t1.a, t1.b;
1994 a b c d a b c d a b c d
1995 1 1 1 1 1 1 1 1 1 1 1 1
1996 1 3 1 2 3 1 1 2 3 1 1 2
1997 3 1 1 2 1 1 1 1 1 1 1 1
1998 4 3 1 2 3 1 1 2 3 1 1 2
1999 2 2 2 2 2 2 2 2 2 2 2 2
2000 1 4 2 3 4 2 5 1 4 2 5 1
2001 3 2 2 3 2 2 2 2 2 2 2 2
2002 3 3 3 3 3 3 3 3 3 3 3 3
2003 2 1 3 4 1 3 1 2 1 3 1 2
2004 3 4 3 4 4 3 1 2 4 3 1 2
2005 4 4 4 4 4 4 4 4 4 4 4 4
2006 2 3 4 5 3 4 3 4 3 4 3 4
2007 4 1 4 5 1 4 2 3 1 4 2 3
2008 explain
2009 select *
2010 from t1
2011 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2012 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2013 order by t1.c,t2.d,
2014 t1.a, t1.b;
2015 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2016 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 3 pushed join@1; Using temporary; Using filesort
2017 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2018 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2019 Warnings:
2020 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`
2021 select *
2022 from t1
2023 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2024 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2025 order by t1.c,t2.d,
2026 t1.a, t1.b;
2027 a b c d a b c d a b c d
2028 1 1 1 1 1 1 1 1 1 1 1 1
2029 3 1 1 2 1 1 1 1 1 1 1 1
2030 1 3 1 2 3 1 1 2 3 1 1 2
2031 4 3 1 2 3 1 1 2 3 1 1 2
2032 1 4 2 3 4 2 5 1 4 2 5 1
2033 2 2 2 2 2 2 2 2 2 2 2 2
2034 3 2 2 3 2 2 2 2 2 2 2 2
2035 2 1 3 4 1 3 1 2 1 3 1 2
2036 3 4 3 4 4 3 1 2 4 3 1 2
2037 3 3 3 3 3 3 3 3 3 3 3 3
2038 4 1 4 5 1 4 2 3 1 4 2 3
2039 2 3 4 5 3 4 3 4 3 4 3 4
2040 4 4 4 4 4 4 4 4 4 4 4 4
2041 explain
2042 select *
2043 from t1
2044 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2045 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2046 order by t1.a,t1.b;
2047 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2048 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 index NULL PRIMARY 8 NULL 16 100.00 Parent of 3 pushed join@1
2049 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2050 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2051 Warnings:
2052 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`
2053 select *
2054 from t1
2055 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2056 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2057 order by t1.a,t1.b;
2058 a b c d a b c d a b c d
2059 1 1 1 1 1 1 1 1 1 1 1 1
2060 1 3 1 2 3 1 1 2 3 1 1 2
2061 1 4 2 3 4 2 5 1 4 2 5 1
2062 2 1 3 4 1 3 1 2 1 3 1 2
2063 2 2 2 2 2 2 2 2 2 2 2 2
2064 2 3 4 5 3 4 3 4 3 4 3 4
2065 3 1 1 2 1 1 1 1 1 1 1 1
2066 3 2 2 3 2 2 2 2 2 2 2 2
2067 3 3 3 3 3 3 3 3 3 3 3 3
2068 3 4 3 4 4 3 1 2 4 3 1 2
2069 4 1 4 5 1 4 2 3 1 4 2 3
2070 4 3 1 2 3 1 1 2 3 1 1 2
2071 4 4 4 4 4 4 4 4 4 4 4 4
2072 explain
2073 select *
2074 from t1
2075 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2076 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2077 order by t1.a,t2.b,
2078 t1.a, t1.b;
2079 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2080 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 3 pushed join@1; Using temporary; Using filesort
2081 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2082 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2083 Warnings:
2084 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`.`b`
2085 select *
2086 from t1
2087 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2088 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2089 order by t1.a,t2.b,
2090 t1.a, t1.b;
2091 a b c d a b c d a b c d
2092 1 1 1 1 1 1 1 1 1 1 1 1
2093 1 3 1 2 3 1 1 2 3 1 1 2
2094 1 4 2 3 4 2 5 1 4 2 5 1
2095 2 2 2 2 2 2 2 2 2 2 2 2
2096 2 1 3 4 1 3 1 2 1 3 1 2
2097 2 3 4 5 3 4 3 4 3 4 3 4
2098 3 1 1 2 1 1 1 1 1 1 1 1
2099 3 2 2 3 2 2 2 2 2 2 2 2
2100 3 3 3 3 3 3 3 3 3 3 3 3
2101 3 4 3 4 4 3 1 2 4 3 1 2
2102 4 3 1 2 3 1 1 2 3 1 1 2
2103 4 1 4 5 1 4 2 3 1 4 2 3
2104 4 4 4 4 4 4 4 4 4 4 4 4
2105 explain
2106 select *
2107 from t1
2108 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2109 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2110 order by t1.a desc,t1.b desc;
2111 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2112 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 index NULL PRIMARY 8 NULL 16 100.00 Parent of 3 pushed join@1; Backward index scan
2113 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2114 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2115 Warnings:
2116 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
2117 select *
2118 from t1
2119 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2120 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2121 order by t1.a desc,t1.b desc;
2122 a b c d a b c d a b c d
2123 4 4 4 4 4 4 4 4 4 4 4 4
2124 4 3 1 2 3 1 1 2 3 1 1 2
2125 4 1 4 5 1 4 2 3 1 4 2 3
2126 3 4 3 4 4 3 1 2 4 3 1 2
2127 3 3 3 3 3 3 3 3 3 3 3 3
2128 3 2 2 3 2 2 2 2 2 2 2 2
2129 3 1 1 2 1 1 1 1 1 1 1 1
2130 2 3 4 5 3 4 3 4 3 4 3 4
2131 2 2 2 2 2 2 2 2 2 2 2 2
2132 2 1 3 4 1 3 1 2 1 3 1 2
2133 1 4 2 3 4 2 5 1 4 2 5 1
2134 1 3 1 2 3 1 1 2 3 1 1 2
2135 1 1 1 1 1 1 1 1 1 1 1 1
2136 explain
2137 select *
2138 from t1
2139 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2140 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2141 order by t1.b,t1.a;
2142 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2143 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Using filesort
2144 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Parent of 2 pushed join@1
2145 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't2' in pushed join@1
2146 Warnings:
2147 Note 1003 Can't push table 't2' as child of 't1', it is in a sorted-branch which can't be referred.
2148 Note 1003 Can't push table 't3' as child of 't1', it is in a sorted-branch which can't be referred.
2149 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`
2150 select *
2151 from t1
2152 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2153 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2154 order by t1.b,t1.a;
2155 a b c d a b c d a b c d
2156 1 1 1 1 1 1 1 1 1 1 1 1
2157 2 1 3 4 1 3 1 2 1 3 1 2
2158 3 1 1 2 1 1 1 1 1 1 1 1
2159 4 1 4 5 1 4 2 3 1 4 2 3
2160 2 2 2 2 2 2 2 2 2 2 2 2
2161 3 2 2 3 2 2 2 2 2 2 2 2
2162 1 3 1 2 3 1 1 2 3 1 1 2
2163 2 3 4 5 3 4 3 4 3 4 3 4
2164 3 3 3 3 3 3 3 3 3 3 3 3
2165 4 3 1 2 3 1 1 2 3 1 1 2
2166 1 4 2 3 4 2 5 1 4 2 5 1
2167 3 4 3 4 4 3 1 2 4 3 1 2
2168 4 4 4 4 4 4 4 4 4 4 4 4
2169 explain
2170 select *
2171 from t1
2172 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2173 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2174 order by t1.a;
2175 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2176 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 index NULL PRIMARY 8 NULL 16 100.00 Parent of 3 pushed join@1
2177 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2178 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2179 Warnings:
2180 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`
2181 explain
2182 select *
2183 from t1
2184 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2185 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2186 order by t1.b;
2187 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2188 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Using filesort
2189 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Parent of 2 pushed join@1
2190 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't2' in pushed join@1
2191 Warnings:
2192 Note 1003 Can't push table 't2' as child of 't1', it is in a sorted-branch which can't be referred.
2193 Note 1003 Can't push table 't3' as child of 't1', it is in a sorted-branch which can't be referred.
2194 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`
2195 explain
2196 select t1.a, t1.b, count(*)
2197 from t1
2198 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2199 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2200 group by t1.a, t1.b;
2201 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2202 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 index PRIMARY PRIMARY 8 NULL 16 100.00 Parent of 3 pushed join@1
2203 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2204 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2205 Warnings:
2206 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`
2207 select t1.a, t1.b, count(*)
2208 from t1
2209 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2210 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2211 group by t1.a, t1.b;
2212 a b count(*)
2213 1 1 1
2214 1 3 1
2215 1 4 1
2216 2 1 1
2217 2 2 1
2218 2 3 1
2219 3 1 1
2220 3 2 1
2221 3 3 1
2222 3 4 1
2223 4 1 1
2224 4 3 1
2225 4 4 1
2226 explain
2227 select t1.a, count(*)
2228 from t1
2229 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2230 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2231 group by t1.a;
2232 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2233 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 index PRIMARY PRIMARY 8 NULL 16 100.00 Parent of 3 pushed join@1
2234 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2235 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2236 Warnings:
2237 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`
2238 select t1.a, count(*)
2239 from t1
2240 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2241 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2242 group by t1.a;
2243 a count(*)
2244 1 3
2245 2 3
2246 3 4
2247 4 3
2248 explain
2249 select t1.b, count(*)
2250 from t1
2251 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2252 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2253 group by t1.b;
2254 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2255 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 3 pushed join@1; Using temporary
2256 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2257 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2258 Warnings:
2259 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`
2260 select t1.b, count(*)
2261 from t1
2262 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
2263 join t1 as t3 on t3.a = t2.a and t3.b = t2.b
2264 group by t1.b;
2265 b count(*)
2266 1 4
2267 2 2
2268 3 4
2269 4 3
2270 explain
2271 select t2.c, count(distinct t2.a)
2272 from t1
2273 join t1 as t2 on t1.a = t2.c and t1.b = t2.d
2274 where t2.a = 4 and t2.b=4
2275 group by t2.c;
2276 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2277 1 SIMPLE t2 pX eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 Parent of 2 pushed join@1
2278 1 SIMPLE t1 pXYZ eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
2279 Warnings:
2280 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`
2281 select t2.c, count(distinct t2.a)
2282 from t1
2283 join t1 as t2 on t1.a = t2.c and t1.b = t2.d
2284 where t2.a = 4 and t2.b=4
2285 group by t2.c;
2286 c count(distinct t2.a)
2287 4 1
2288 explain
2289 select t2.c, count(distinct t2.a)
2290 from t1
2291 join t1 as t2 on t1.a = t2.c and t1.b = t2.d
2292 where t2.a = 4
2293 group by t2.c;
2294 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2295 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Using filesort
2296 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 NULL
2297 Warnings:
2298 Note 1003 Can't push table 't1' as child of 't2', it is in a sorted-branch which can't be referred.
2299 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`
2300 select t2.c, count(distinct t2.a)
2301 from t1
2302 join t1 as t2 on t1.a = t2.c and t1.b = t2.d
2303 where t2.a = 4
2304 group by t2.c;
2305 c count(distinct t2.a)
2306 1 1
2307 4 1
2308 explain
2309 select t2.c, count(distinct t2.a)
2310 from t1
2311 join t1 as t2 on t1.a = t2.c and t1.b = t2.d
2312 where t2.a = 4 and t2.b=4
2313 group by t2.c order by t2.c;
2314 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2315 1 SIMPLE t2 pX eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 Parent of 2 pushed join@1
2316 1 SIMPLE t1 pXYZ eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
2317 Warnings:
2318 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`
2319 select t2.c, count(distinct t2.a)
2320 from t1
2321 join t1 as t2 on t1.a = t2.c and t1.b = t2.d
2322 where t2.a = 4 and t2.b=4
2323 group by t2.c order by t2.c;
2324 c count(distinct t2.a)
2325 4 1
2326 create table tx like t1;
2327 insert into tx
2328 select x1.a+x2.a*16, x1.b+x2.b*16, x1.c+x2.c*16, x1.d+x2.d*16
2329 from t1 as x1 cross join t1 as x2;
2330 explain select count(*) from tx as x1
2331 left join tx as x2 on x1.c=x2.a and x1.d=x2.d;
2332 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2333 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 256 100.00 Parent of 2 pushed join@1
2334 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x1.c 2 100.00 Child of 'x1' in pushed join@1; Using pushed condition (`test`.`x2`.`d` = `test`.`x1`.`d`)
2335 Warnings:
2336 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`tx` `x1` left join `test`.`tx` `x2` on(((`test`.`x2`.`d` = `test`.`x1`.`d`) and (`test`.`x2`.`a` = `test`.`x1`.`c`))) where true
2337 select count(*) from tx as x1
2338 left join tx as x2 on x1.c=x2.a and x1.d=x2.d;
2339 count(*)
2340 304
2341 drop table tx;
2342 alter table t1 partition by key(a);
2343 explain select count(*) from t1
2344 join t1 as t2 on t2.a = t1.c
2345 join t1 as t3 on t3.a = t1.d;
2346 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2347 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
2348 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Child of 't1' in pushed join@1
2349 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.d 1 100.00 Child of 't1' in pushed join@1
2350 Warnings:
2351 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`.`a` = `test`.`t1`.`d`))
2352 select count(*) from t1
2353 join t1 as t2 on t2.a = t1.c
2354 join t1 as t3 on t3.a = t1.d;
2355 count(*)
2356 176
2357 CREATE TABLE tx (
2358 a int NOT NULL,
2359 PRIMARY KEY (`a`)
2360 ) comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
2361 delete from t1;
2362 insert into tx values (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
2363 insert into t1 select 1, x1.a * 10+x2.a, 1, 1 from tx as x1 cross join tx as x2;
2364 set global debug='+d,max_64rows_in_spj_batches';
2365 explain select count(*) from t1 as x1
2366 join t1 as x2 on x2.a = x1.c and x1.b < 2
2367 join t1 as x3 on x3.a = x1.d;
2368 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2369 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Parent of 3 pushed join@1; Using pushed condition (`test`.`x1`.`b` < 2)
2370 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x1.c # # Child of 'x1' in pushed join@1
2371 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x1.d # # Child of 'x1' in pushed join@1
2372 Warnings:
2373 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x2`.`a` = `test`.`x1`.`c`) and (`test`.`x3`.`a` = `test`.`x1`.`d`) and (`test`.`x1`.`b` < 2))
2374 select count(*) from t1 as x1
2375 join t1 as x2 on x2.a = x1.c and x1.b < 2
2376 join t1 as x3 on x3.a = x1.d;
2377 count(*)
2378 20000
2379 set global debug=@save_debug;
2380 drop table t1;
2381 drop table tx;
2382 create table t1 (
2383 a int not null,
2384 b int not null,
2385 c int not null,
2386 d int not null,
2387 primary key (`a`,`b`)
2388 ) engine=ndbcluster
2389 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM"
2390 partition by key(a);
2391 insert into t1 values
2392 (1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4),
2393 (1,2,5,1), (1,3,1,2), (1,4,2,3),
2394 (2,1,3,4), (2,3,4,5), (2,4,5,1),
2395 (3,1,1,2), (3,2,2,3), (3,4,3,4),
2396 (4,1,4,5), (4,2,5,1), (4,3,1,2);
2397 explain
2398 select *
2399 from t1
2400 join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
2401 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2402 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 2 pushed join@1
2403 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 Child of 't1' in pushed join@1
2404 Warnings:
2405 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`))
2406 set new=on;
2407 Warnings:
2408 Warning 1287 '@@new' is deprecated and will be removed in a future release.
2409 alter table t1 partition by hash(a);
2410 explain
2411 select *
2412 from t1
2413 join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
2414 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2415 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 NULL
2416 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 NULL
2417 Warnings:
2418 Note 1003 Table 't1' is not pushable: has user defined partioning
2419 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`))
2420 alter table t1 partition by list(a) (
2421 partition p1 values in (1),
2422 partition p2 values in (2),
2423 partition p3 values in (3),
2424 partition p4 values in (4)
2425 );
2426 explain
2427 select *
2428 from t1
2429 join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
2430 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2431 1 SIMPLE t1 p1,p2,p3,p4 ALL NULL NULL NULL NULL 16 100.00 NULL
2432 1 SIMPLE t2 p1,p2,p3,p4 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 NULL
2433 Warnings:
2434 Note 1003 Table 't1' is not pushable: has user defined partioning
2435 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`))
2436 alter table t1 partition by range(a) partitions 4 (
2437 partition p1 values less than (0),
2438 partition p2 values less than (2),
2439 partition p3 values less than (4),
2440 partition p4 values less than (99999)
2441 );
2442 explain
2443 select *
2444 from t1
2445 join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
2446 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2447 1 SIMPLE t1 p1,p2,p3,p4 ALL NULL NULL NULL NULL 16 100.00 NULL
2448 1 SIMPLE t2 p1,p2,p3,p4 eq_ref PRIMARY PRIMARY 8 test.t1.b,test.t1.c 1 100.00 NULL
2449 Warnings:
2450 Note 1003 Table 't1' is not pushable: has user defined partioning
2451 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`))
2452 drop table t1;
2453 set new=default;
2454 Warnings:
2455 Warning 1287 '@@new' is deprecated and will be removed in a future release.
2456 create table t1 (a int, b int, primary key(a) using hash) engine = ndb
2457 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
2458 insert into t1 values (1, 2);
2459 insert into t1 values (2, 3);
2460 insert into t1 values (3, 1);
2461 set ndb_join_pushdown=true;
2462 set autocommit=off;
2463 explain
2464 select *
2465 from t1, t1 as t2
2466 where t1.a in (1,3,5)
2467 and t2.a = t1.b;
2468 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2469 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 range PRIMARY PRIMARY 4 NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition ((`test`.`t1`.`a` in (1,3,5)) and (`test`.`t1`.`b` is not null)); Using MRR
2470 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1
2471 Warnings:
2472 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)))
2473 select *
2474 from t1, t1 as t2
2475 where t1.a in (1,3,5)
2476 and t2.a = t1.b;
2477 a b a b
2478 1 2 2 3
2479 3 1 1 2
2480 ndb_execute_count
2481 3
2482 This should yield 3 executes (for now...buh)
2483 set autocommit=on;
2484 drop table t1;
2485 create table t1 (a int, b int, primary key(a)) engine = ndb
2486 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
2487 insert into t1 values (1, 2);
2488 insert into t1 values (2, 3);
2489 insert into t1 values (3, 1);
2490 set ndb_join_pushdown=true;
2491 set autocommit=off;
2492 explain
2493 select *
2494 from t1, t1 as t2
2495 where t1.a in (1,3,5)
2496 and t2.a = t1.b;
2497 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2498 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 range PRIMARY PRIMARY 4 NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition ((`test`.`t1`.`a` in (1,3,5)) and (`test`.`t1`.`b` is not null)); Using MRR
2499 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1
2500 Warnings:
2501 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)))
2502 select *
2503 from t1, t1 as t2
2504 where t1.a in (1,3,5)
2505 and t2.a = t1.b;
2506 a b a b
2507 1 2 2 3
2508 3 1 1 2
2509 ndb_execute_count
2510 1
2511 This should yield 1 execute (but inefficient since it's based on scan)
2512 set autocommit=on;
2513 explain
2514 select *
2515 from t1, t1 as t2
2516 where t1.a in (1,3,5)
2517 and t2.a = t1.b
2518 order by t1.a desc;
2519 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2520 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 range PRIMARY PRIMARY 4 NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition ((`test`.`t1`.`a` in (1,3,5)) and (`test`.`t1`.`b` is not null)); Backward index scan; Using MRR
2521 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1
2522 Warnings:
2523 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
2524 select *
2525 from t1, t1 as t2
2526 where t1.a in (1,3,5)
2527 and t2.a = t1.b
2528 order by t1.a desc;
2529 a b a b
2530 3 1 1 2
2531 1 2 2 3
2532 Warnings:
2533 Warning 1296 Prepared pushed join could not be executed, prepared with incompatible access type
2534 Warning 1296 Prepared pushed join could not be executed, prepared with incompatible access type
2535 Warning 1296 Prepared pushed join could not be executed, prepared with incompatible access type
2536 drop table t1;
2537 set ndb_join_pushdown=true;
2538 create table t1 (a int, b int, primary key(a)) engine = ndb
2539 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
2540 create table t2 (c int, d int, primary key(c)) engine = ndb
2541 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
2542 create table t3 (a3 int, b3 int, c3 int not null, d3 int not null,
2543 primary key(a3, b3)) engine = ndb
2544 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
2545 create table t3_hash (a3 int, b3 int, c3 int not null, d3 int not null,
2546 primary key(a3, b3) using hash) engine = ndb
2547 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
2548 insert into t1 values (0x1f, 0x2f);
2549 insert into t1 values (0x2f, 0x3f);
2550 insert into t1 values (0x3f, 0x1f);
2551 insert into t2 values (0x1f, 0x2f);
2552 insert into t2 values (0x2f, 0x3f);
2553 insert into t2 values (0x3f, 0x1f);
2554 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
2555 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
2556 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
2557 insert into t3_hash values (0x1f, 0x2f, 1, 0x1f);
2558 insert into t3_hash values (0x2f, 0x3f, 2, 0x2f);
2559 insert into t3_hash values (0x3f, 0x1f, 3, 0x3f);
2560 explain
2561 select * from t3 x, t3 y, t1 where y.a3=x.d3 and y.b3=x.b3 and t1.a = y.d3;
2562 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2563 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3 100.00 Parent of 3 pushed join@1
2564 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d3,test.x.b3 1 100.00 Child of 'x' in pushed join@1
2565 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.y.d3 1 100.00 Child of 'y' in pushed join@1
2566 Warnings:
2567 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`))
2568 select * from t3 x, t3 y, t1 where y.a3=x.d3 and y.b3=x.b3 and t1.a = y.d3;
2569 a3 b3 c3 d3 a3 b3 c3 d3 a b
2570 31 47 1 31 31 47 1 31 31 47
2571 47 63 2 47 47 63 2 47 47 63
2572 63 31 3 63 63 31 3 63 63 31
2573 explain
2574 select *
2575 from t3 x, t3 y, t3 z, t3 z2, t1
2576 where y.a3=x.d3 and y.b3=x.b3 and
2577 z.a3=y.d3 and z.b3=y.b3 and
2578 z2.a3=z.d3 and z2.b3=z.b3 and
2579 t1.a = z2.d3;
2580 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2581 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3 100.00 Parent of 5 pushed join@1
2582 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d3,test.x.b3 1 100.00 Child of 'x' in pushed join@1
2583 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.y.d3,test.x.b3 1 100.00 Child of 'y' in pushed join@1
2584 1 SIMPLE z2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.z.d3,test.x.b3 1 100.00 Child of 'z' in pushed join@1
2585 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.z2.d3 1 100.00 Child of 'z2' in pushed join@1
2586 Warnings:
2587 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`))
2588 select *
2589 from t3 x, t3 y, t3 z, t3 z2, t1
2590 where y.a3=x.d3 and y.b3=x.b3 and
2591 z.a3=y.d3 and z.b3=y.b3 and
2592 z2.a3=z.d3 and z2.b3=z.b3 and
2593 t1.a = z2.d3;
2594 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3 a b
2595 31 47 1 31 31 47 1 31 31 47 1 31 31 47 1 31 31 47
2596 47 63 2 47 47 63 2 47 47 63 2 47 47 63 2 47 47 63
2597 63 31 3 63 63 31 3 63 63 31 3 63 63 31 3 63 63 31
2598 explain
2599 select straight_join * from t1 x, t1 y where y.a=0x1f and x.b = 0x1f;
2600 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2601 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Using pushed condition (`test`.`x`.`b` = 0x1f)
2602 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const # # NULL
2603 Warnings:
2604 Note 1003 Can't push table 'y' as child of 'x', no parent-child dependency exists between these tables
2605 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))
2606 select straight_join * from t1 x, t1 y where y.a=0x1f and x.b = 0x1f;
2607 a b a b
2608 63 31 31 47
2609 explain
2610 select straight_join * from t1 x, t1 y where y.a=x.b and x.b = 0x1f;
2611 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2612 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Using pushed condition (`test`.`x`.`b` = 0x1f)
2613 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const # # Using where
2614 Warnings:
2615 Note 1003 Can't push table 'y' as child of 'x', no parent-child dependency exists between these tables
2616 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))
2617 select straight_join * from t1 x, t1 y where y.a=x.b and x.b = 0x1f;
2618 a b a b
2619 63 31 31 47
2620 create unique index t3_d3 on t3(d3);
2621 create unique index t3_d3 on t3_hash(d3);
2622 commit;
2623 explain
2624 select * from t3 x, t3 y where x.d3=31 and y.a3=x.d3 and y.b3=x.b3;
2625 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2626 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 const 1 100.00 Parent of 2 pushed join@1
2627 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 const,test.x.b3 1 100.00 Child of 'x' in pushed join@1
2628 Warnings:
2629 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))
2630 select * from t3 x, t3 y where x.d3=31 and y.a3=x.d3 and y.b3=x.b3;
2631 a3 b3 c3 d3 a3 b3 c3 d3
2632 31 47 1 31 31 47 1 31
2633 explain
2634 select * from t3 x, t3 y where x.d3=0 and y.a3=x.d3 and y.b3=x.b3;
2635 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2636 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 const 1 100.00 Parent of 2 pushed join@1
2637 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 const,test.x.b3 1 100.00 Child of 'x' in pushed join@1
2638 Warnings:
2639 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))
2640 select * from t3 x, t3 y where x.d3=0 and y.a3=x.d3 and y.b3=x.b3;
2641 a3 b3 c3 d3 a3 b3 c3 d3
2642 explain
2643 select * from t1 x, t3 y where y.d3=x.b;
2644 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2645 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`b` is not null)
2646 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x.b 1 100.00 Child of 'x' in pushed join@1
2647 Warnings:
2648 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`)
2649 select * from t1 x, t3 y where y.d3=x.b;
2650 a b a3 b3 c3 d3
2651 31 47 47 63 2 47
2652 47 63 63 31 3 63
2653 63 31 31 47 1 31
2654 explain
2655 select * from t3 x, t3 y where x.d3=31 and y.d3=x.b3;
2656 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2657 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 const 1 100.00 Parent of 2 pushed join@1
2658 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x.b3 1 100.00 Child of 'x' in pushed join@1
2659 Warnings:
2660 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))
2661 select * from t3 x, t3 y where x.d3=31 and y.d3=x.b3;
2662 a3 b3 c3 d3 a3 b3 c3 d3
2663 31 47 1 31 47 63 2 47
2664 explain
2665 select * from t3 x, t3 y where x.d3=31 and y.d3=x.c3;
2666 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2667 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 const 1 100.00 Parent of 2 pushed join@1
2668 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x.c3 1 100.00 Child of 'x' in pushed join@1
2669 Warnings:
2670 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))
2671 select * from t3 x, t3 y where x.d3=31 and y.d3=x.c3;
2672 a3 b3 c3 d3 a3 b3 c3 d3
2673 explain
2674 select * from t3 x, t3 y
2675 where ((x.a3=0x2f and x.b3=0x3f) or x.d3=0x1f)
2676 and (y.a3=x.d3 and y.b3=x.b3);
2677 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2678 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 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 pushed condition (((`test`.`x`.`a3` = 0x2f) and (`test`.`x`.`b3` = 0x3f)) or (`test`.`x`.`d3` = 0x1f))
2679 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d3,test.x.b3 1 100.00 Child of 'x' in pushed join@1
2680 Warnings:
2681 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)))
2682 select * from t3 x, t3 y
2683 where ((x.a3=0x2f and x.b3=0x3f) or x.d3=0x1f)
2684 and (y.a3=x.d3 and y.b3=x.b3);
2685 a3 b3 c3 d3 a3 b3 c3 d3
2686 31 47 1 31 31 47 1 31
2687 47 63 2 47 47 63 2 47
2688 explain
2689 select * from t3_hash x, t3_hash y
2690 where ((x.a3=0x2f and x.b3=0x3f) or x.d3=0x1f)
2691 and (y.a3=x.d3 and y.b3=x.b3);
2692 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2693 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 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 pushed condition (((`test`.`x`.`a3` = 0x2f) and (`test`.`x`.`b3` = 0x3f)) or (`test`.`x`.`d3` = 0x1f))
2694 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d3,test.x.b3 1 100.00 Child of 'x' in pushed join@1
2695 Warnings:
2696 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)))
2697 select * from t3_hash x, t3_hash y
2698 where ((x.a3=0x2f and x.b3=0x3f) or x.d3=0x1f)
2699 and (y.a3=x.d3 and y.b3=x.b3);
2700 a3 b3 c3 d3 a3 b3 c3 d3
2701 31 47 1 31 31 47 1 31
2702 47 63 2 47 47 63 2 47
2703 explain
2704 select * from t3 x, t3 y where x.d3>=31 and y.d3=x.b3;
2705 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2706 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 range t3_d3 t3_d3 4 NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`d3` >= 31); Using MRR
2707 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x.b3 1 100.00 Child of 'x' in pushed join@1
2708 Warnings:
2709 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))
2710 select * from t3 x, t3 y where x.d3>=31 and y.d3=x.b3;
2711 a3 b3 c3 d3 a3 b3 c3 d3
2712 31 47 1 31 47 63 2 47
2713 47 63 2 47 63 31 3 63
2714 63 31 3 63 31 47 1 31
2715 insert into t1 values (0x4f, null);
2716 select * from t1 left join t1 as t2 on t2.a = t1.b;
2717 a b a b
2718 31 47 47 63
2719 47 63 63 31
2720 63 31 31 47
2721 79 NULL NULL NULL
2722 insert into t3 values (8,8,8,8);
2723 explain select count(*) from t3 as x0
2724 join t3 as x1 on x0.b3=x1.d3 and x0.d3=8
2725 join t3 as x2 on x1.b3=x2.d3
2726 join t3 as x3 on x2.b3=x3.d3
2727 join t3 as x4 on x3.b3=x4.d3
2728 join t3 as x5 on x4.b3=x5.d3
2729 join t3 as x6 on x5.b3=x6.d3
2730 join t3 as x7 on x6.b3=x7.d3
2731 join t3 as x8 on x7.b3=x8.d3
2732 join t3 as x9 on x8.b3=x9.d3
2733 join t3 as x10 on x9.b3=x10.d3
2734 join t3 as x11 on x10.b3=x11.d3
2735 join t3 as x12 on x11.b3=x12.d3
2736 join t3 as x13 on x12.b3=x13.d3
2737 join t3 as x14 on x13.b3=x14.d3
2738 join t3 as x15 on x14.b3=x15.d3
2739 join t3 as x16 on x15.b3=x16.d3
2740 join t3 as x17 on x16.b3=x17.d3;
2741 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2742 1 SIMPLE x0 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 const 1 100.00 Parent of 16 pushed join@1
2743 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x0.b3 1 100.00 Child of 'x0' in pushed join@1
2744 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x1.b3 1 100.00 Child of 'x1' in pushed join@1
2745 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x2.b3 1 100.00 Child of 'x2' in pushed join@1
2746 1 SIMPLE x4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x3.b3 1 100.00 Child of 'x3' in pushed join@1
2747 1 SIMPLE x5 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x4.b3 1 100.00 Child of 'x4' in pushed join@1
2748 1 SIMPLE x6 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x5.b3 1 100.00 Child of 'x5' in pushed join@1
2749 1 SIMPLE x7 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x6.b3 1 100.00 Child of 'x6' in pushed join@1
2750 1 SIMPLE x8 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x7.b3 1 100.00 Child of 'x7' in pushed join@1
2751 1 SIMPLE x9 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x8.b3 1 100.00 Child of 'x8' in pushed join@1
2752 1 SIMPLE x10 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x9.b3 1 100.00 Child of 'x9' in pushed join@1
2753 1 SIMPLE x11 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x10.b3 1 100.00 Child of 'x10' in pushed join@1
2754 1 SIMPLE x12 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x11.b3 1 100.00 Child of 'x11' in pushed join@1
2755 1 SIMPLE x13 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x12.b3 1 100.00 Child of 'x12' in pushed join@1
2756 1 SIMPLE x14 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x13.b3 1 100.00 Child of 'x13' in pushed join@1
2757 1 SIMPLE x15 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x14.b3 1 100.00 Child of 'x14' in pushed join@1
2758 1 SIMPLE x16 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x15.b3 1 100.00 Parent of 2 pushed join@2
2759 1 SIMPLE x17 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x16.b3 1 100.00 Child of 'x16' in pushed join@2
2760 Warnings:
2761 Note 1003 Can't push table 'x16' as child of 'x0'. Max number of pushable tables exceeded.
2762 Note 1003 Can't push table 'x17' as child of 'x0'. Max number of pushable tables exceeded.
2763 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t3` `x0` join `test`.`t3` `x1` join `test`.`t3` `x2` join `test`.`t3` `x3` join `test`.`t3` `x4` join `test`.`t3` `x5` join `test`.`t3` `x6` join `test`.`t3` `x7` join `test`.`t3` `x8` join `test`.`t3` `x9` join `test`.`t3` `x10` join `test`.`t3` `x11` join `test`.`t3` `x12` join `test`.`t3` `x13` join `test`.`t3` `x14` join `test`.`t3` `x15` join `test`.`t3` `x16` join `test`.`t3` `x17` where ((`test`.`x0`.`d3` = 8) and (`test`.`x1`.`d3` = `test`.`x0`.`b3`) and (`test`.`x2`.`d3` = `test`.`x1`.`b3`) and (`test`.`x3`.`d3` = `test`.`x2`.`b3`) and (`test`.`x4`.`d3` = `test`.`x3`.`b3`) and (`test`.`x5`.`d3` = `test`.`x4`.`b3`) and (`test`.`x6`.`d3` = `test`.`x5`.`b3`) and (`test`.`x7`.`d3` = `test`.`x6`.`b3`) and (`test`.`x8`.`d3` = `test`.`x7`.`b3`) and (`test`.`x9`.`d3` = `test`.`x8`.`b3`) and (`test`.`x10`.`d3` = `test`.`x9`.`b3`) and (`test`.`x11`.`d3` = `test`.`x10`.`b3`) and (`test`.`x12`.`d3` = `test`.`x11`.`b3`) and (`test`.`x13`.`d3` = `test`.`x12`.`b3`) and (`test`.`x14`.`d3` = `test`.`x13`.`b3`) and (`test`.`x15`.`d3` = `test`.`x14`.`b3`) and (`test`.`x16`.`d3` = `test`.`x15`.`b3`) and (`test`.`x17`.`d3` = `test`.`x16`.`b3`))
2764 select count(*) from t3 as x0
2765 join t3 as x1 on x0.b3=x1.d3 and x0.d3=8
2766 join t3 as x2 on x1.b3=x2.d3
2767 join t3 as x3 on x2.b3=x3.d3
2768 join t3 as x4 on x3.b3=x4.d3
2769 join t3 as x5 on x4.b3=x5.d3
2770 join t3 as x6 on x5.b3=x6.d3
2771 join t3 as x7 on x6.b3=x7.d3
2772 join t3 as x8 on x7.b3=x8.d3
2773 join t3 as x9 on x8.b3=x9.d3
2774 join t3 as x10 on x9.b3=x10.d3
2775 join t3 as x11 on x10.b3=x11.d3
2776 join t3 as x12 on x11.b3=x12.d3
2777 join t3 as x13 on x12.b3=x13.d3
2778 join t3 as x14 on x13.b3=x14.d3
2779 join t3 as x15 on x14.b3=x15.d3
2780 join t3 as x16 on x15.b3=x16.d3
2781 join t3 as x17 on x16.b3=x17.d3;
2782 count(*)
2783 1
2784 explain select count(*) from t3 as x0
2785 join t3 as x1 on x0.c3=x1.a3
2786 join t3 as x2 on x1.c3=x2.a3
2787 join t3 as x3 on x2.c3=x3.a3
2788 join t3 as x4 on x3.c3=x4.a3
2789 join t3 as x5 on x4.c3=x5.a3
2790 join t3 as x6 on x5.c3=x6.a3
2791 join t3 as x7 on x6.c3=x7.a3
2792 join t3 as x8 on x7.c3=x8.a3
2793 join t3 as x9 on x8.c3=x9.a3
2794 join t3 as x10 on x9.c3=x10.a3
2795 join t3 as x11 on x10.c3=x11.a3
2796 join t3 as x12 on x11.c3=x12.a3
2797 join t3 as x13 on x12.c3=x13.a3
2798 join t3 as x14 on x13.c3=x14.a3
2799 join t3 as x15 on x14.c3=x15.a3
2800 join t3 as x16 on x15.c3=x16.a3
2801 join t3 as x17 on x16.c3=x17.a3
2802 join t3 as x18 on x17.c3=x18.a3
2803 join t3 as x19 on x18.c3=x19.a3
2804 join t3 as x20 on x19.c3=x20.a3
2805 join t3 as x21 on x20.c3=x21.a3
2806 join t3 as x22 on x21.c3=x22.a3
2807 join t3 as x23 on x22.c3=x23.a3
2808 join t3 as x24 on x23.c3=x24.a3
2809 join t3 as x25 on x24.c3=x25.a3
2810 join t3 as x26 on x25.c3=x26.a3
2811 join t3 as x27 on x26.c3=x27.a3
2812 join t3 as x28 on x27.c3=x28.a3
2813 join t3 as x29 on x28.c3=x29.a3
2814 join t3 as x30 on x29.c3=x30.a3
2815 join t3 as x31 on x30.c3=x31.a3
2816 join t3 as x32 on x31.c3=x32.a3
2817 join t3 as x33 on x32.c3=x33.a3;
2818 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2819 1 SIMPLE x0 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 Parent of 32 pushed join@1
2820 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x0.c3 1 100.00 Child of 'x0' in pushed join@1
2821 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x1.c3 1 100.00 Child of 'x1' in pushed join@1
2822 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x2.c3 1 100.00 Child of 'x2' in pushed join@1
2823 1 SIMPLE x4 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x3.c3 1 100.00 Child of 'x3' in pushed join@1
2824 1 SIMPLE x5 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x4.c3 1 100.00 Child of 'x4' in pushed join@1
2825 1 SIMPLE x6 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x5.c3 1 100.00 Child of 'x5' in pushed join@1
2826 1 SIMPLE x7 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x6.c3 1 100.00 Child of 'x6' in pushed join@1
2827 1 SIMPLE x8 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x7.c3 1 100.00 Child of 'x7' in pushed join@1
2828 1 SIMPLE x9 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x8.c3 1 100.00 Child of 'x8' in pushed join@1
2829 1 SIMPLE x10 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x9.c3 1 100.00 Child of 'x9' in pushed join@1
2830 1 SIMPLE x11 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x10.c3 1 100.00 Child of 'x10' in pushed join@1
2831 1 SIMPLE x12 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x11.c3 1 100.00 Child of 'x11' in pushed join@1
2832 1 SIMPLE x13 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x12.c3 1 100.00 Child of 'x12' in pushed join@1
2833 1 SIMPLE x14 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x13.c3 1 100.00 Child of 'x13' in pushed join@1
2834 1 SIMPLE x15 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x14.c3 1 100.00 Child of 'x14' in pushed join@1
2835 1 SIMPLE x16 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x15.c3 1 100.00 Child of 'x15' in pushed join@1
2836 1 SIMPLE x17 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x16.c3 1 100.00 Child of 'x16' in pushed join@1
2837 1 SIMPLE x18 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x17.c3 1 100.00 Child of 'x17' in pushed join@1
2838 1 SIMPLE x19 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x18.c3 1 100.00 Child of 'x18' in pushed join@1
2839 1 SIMPLE x20 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x19.c3 1 100.00 Child of 'x19' in pushed join@1
2840 1 SIMPLE x21 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x20.c3 1 100.00 Child of 'x20' in pushed join@1
2841 1 SIMPLE x22 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x21.c3 1 100.00 Child of 'x21' in pushed join@1
2842 1 SIMPLE x23 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x22.c3 1 100.00 Child of 'x22' in pushed join@1
2843 1 SIMPLE x24 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x23.c3 1 100.00 Child of 'x23' in pushed join@1
2844 1 SIMPLE x25 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x24.c3 1 100.00 Child of 'x24' in pushed join@1
2845 1 SIMPLE x26 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x25.c3 1 100.00 Child of 'x25' in pushed join@1
2846 1 SIMPLE x27 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x26.c3 1 100.00 Child of 'x26' in pushed join@1
2847 1 SIMPLE x28 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x27.c3 1 100.00 Child of 'x27' in pushed join@1
2848 1 SIMPLE x29 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x28.c3 1 100.00 Child of 'x28' in pushed join@1
2849 1 SIMPLE x30 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x29.c3 1 100.00 Child of 'x29' in pushed join@1
2850 1 SIMPLE x31 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x30.c3 1 100.00 Child of 'x30' in pushed join@1
2851 1 SIMPLE x32 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x31.c3 1 100.00 Parent of 2 pushed join@2
2852 1 SIMPLE x33 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x32.c3 1 100.00 Child of 'x32' in pushed join@2
2853 Warnings:
2854 Note 1003 Can't push table 'x32' as child of 'x0'. Max number of pushable tables exceeded.
2855 Note 1003 Can't push table 'x33' as child of 'x0'. Max number of pushable tables exceeded.
2856 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t3` `x0` join `test`.`t3` `x1` join `test`.`t3` `x2` join `test`.`t3` `x3` join `test`.`t3` `x4` join `test`.`t3` `x5` join `test`.`t3` `x6` join `test`.`t3` `x7` join `test`.`t3` `x8` join `test`.`t3` `x9` join `test`.`t3` `x10` join `test`.`t3` `x11` join `test`.`t3` `x12` join `test`.`t3` `x13` join `test`.`t3` `x14` join `test`.`t3` `x15` join `test`.`t3` `x16` join `test`.`t3` `x17` join `test`.`t3` `x18` join `test`.`t3` `x19` join `test`.`t3` `x20` join `test`.`t3` `x21` join `test`.`t3` `x22` join `test`.`t3` `x23` join `test`.`t3` `x24` join `test`.`t3` `x25` join `test`.`t3` `x26` join `test`.`t3` `x27` join `test`.`t3` `x28` join `test`.`t3` `x29` join `test`.`t3` `x30` join `test`.`t3` `x31` join `test`.`t3` `x32` join `test`.`t3` `x33` where ((`test`.`x1`.`a3` = `test`.`x0`.`c3`) and (`test`.`x2`.`a3` = `test`.`x1`.`c3`) and (`test`.`x3`.`a3` = `test`.`x2`.`c3`) and (`test`.`x4`.`a3` = `test`.`x3`.`c3`) and (`test`.`x5`.`a3` = `test`.`x4`.`c3`) and (`test`.`x6`.`a3` = `test`.`x5`.`c3`) and (`test`.`x7`.`a3` = `test`.`x6`.`c3`) and (`test`.`x8`.`a3` = `test`.`x7`.`c3`) and (`test`.`x9`.`a3` = `test`.`x8`.`c3`) and (`test`.`x10`.`a3` = `test`.`x9`.`c3`) and (`test`.`x11`.`a3` = `test`.`x10`.`c3`) and (`test`.`x12`.`a3` = `test`.`x11`.`c3`) and (`test`.`x13`.`a3` = `test`.`x12`.`c3`) and (`test`.`x14`.`a3` = `test`.`x13`.`c3`) and (`test`.`x15`.`a3` = `test`.`x14`.`c3`) and (`test`.`x16`.`a3` = `test`.`x15`.`c3`) and (`test`.`x17`.`a3` = `test`.`x16`.`c3`) and (`test`.`x18`.`a3` = `test`.`x17`.`c3`) and (`test`.`x19`.`a3` = `test`.`x18`.`c3`) and (`test`.`x20`.`a3` = `test`.`x19`.`c3`) and (`test`.`x21`.`a3` = `test`.`x20`.`c3`) and (`test`.`x22`.`a3` = `test`.`x21`.`c3`) and (`test`.`x23`.`a3` = `test`.`x22`.`c3`) and (`test`.`x24`.`a3` = `test`.`x23`.`c3`) and (`test`.`x25`.`a3` = `test`.`x24`.`c3`) and (`test`.`x26`.`a3` = `test`.`x25`.`c3`) and (`test`.`x27`.`a3` = `test`.`x26`.`c3`) and (`test`.`x28`.`a3` = `test`.`x27`.`c3`) and (`test`.`x29`.`a3` = `test`.`x28`.`c3`) and (`test`.`x30`.`a3` = `test`.`x29`.`c3`) and (`test`.`x31`.`a3` = `test`.`x30`.`c3`) and (`test`.`x32`.`a3` = `test`.`x31`.`c3`) and (`test`.`x33`.`a3` = `test`.`x32`.`c3`))
2857 select count(*) from t3 as x0
2858 join t3 as x1 on x0.c3=x1.a3
2859 join t3 as x2 on x1.c3=x2.a3
2860 join t3 as x3 on x2.c3=x3.a3
2861 join t3 as x4 on x3.c3=x4.a3
2862 join t3 as x5 on x4.c3=x5.a3
2863 join t3 as x6 on x5.c3=x6.a3
2864 join t3 as x7 on x6.c3=x7.a3
2865 join t3 as x8 on x7.c3=x8.a3
2866 join t3 as x9 on x8.c3=x9.a3
2867 join t3 as x10 on x9.c3=x10.a3
2868 join t3 as x11 on x10.c3=x11.a3
2869 join t3 as x12 on x11.c3=x12.a3
2870 join t3 as x13 on x12.c3=x13.a3
2871 join t3 as x14 on x13.c3=x14.a3
2872 join t3 as x15 on x14.c3=x15.a3
2873 join t3 as x16 on x15.c3=x16.a3
2874 join t3 as x17 on x16.c3=x17.a3
2875 join t3 as x18 on x17.c3=x18.a3
2876 join t3 as x19 on x18.c3=x19.a3
2877 join t3 as x20 on x19.c3=x20.a3
2878 join t3 as x21 on x20.c3=x21.a3
2879 join t3 as x22 on x21.c3=x22.a3
2880 join t3 as x23 on x22.c3=x23.a3
2881 join t3 as x24 on x23.c3=x24.a3
2882 join t3 as x25 on x24.c3=x25.a3
2883 join t3 as x26 on x25.c3=x26.a3
2884 join t3 as x27 on x26.c3=x27.a3
2885 join t3 as x28 on x27.c3=x28.a3
2886 join t3 as x29 on x28.c3=x29.a3
2887 join t3 as x30 on x29.c3=x30.a3
2888 join t3 as x31 on x30.c3=x31.a3
2889 join t3 as x32 on x31.c3=x32.a3
2890 join t3 as x33 on x32.c3=x33.a3;
2891 count(*)
2892 1
2893 explain select count(*) from t3 as x0
2894 join t3 as x1 on x0.b3=x1.d3
2895 join t3 as x2 on x1.b3=x2.d3
2896 join t3 as x3 on x2.b3=x3.d3
2897 join t3 as x4 on x3.b3=x4.d3
2898 join t3 as x5 on x4.b3=x5.d3
2899 join t3 as x6 on x5.b3=x6.d3
2900 join t3 as x7 on x6.b3=x7.d3
2901 join t3 as x8 on x7.b3=x8.d3
2902 join t3 as x9 on x8.b3=x9.d3
2903 join t3 as x10 on x9.b3=x10.d3
2904 join t3 as x11 on x10.b3=x11.d3
2905 join t3 as x12 on x11.b3=x12.d3
2906 join t3 as x13 on x12.b3=x13.d3
2907 join t3 as x14 on x13.b3=x14.d3
2908 join t3 as x15 on x14.b3=x15.d3
2909 join t3 as x16 on x15.b3=x16.d3
2910 join t3 as x17 on x15.b3=x17.a3
2911 join t3 as x18 on x16.b3=x18.d3;
2912 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2913 1 SIMPLE x0 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 Parent of 17 pushed join@1
2914 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x0.b3 1 100.00 Child of 'x0' in pushed join@1
2915 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x1.b3 1 100.00 Child of 'x1' in pushed join@1
2916 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x2.b3 1 100.00 Child of 'x2' in pushed join@1
2917 1 SIMPLE x4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x3.b3 1 100.00 Child of 'x3' in pushed join@1
2918 1 SIMPLE x5 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x4.b3 1 100.00 Child of 'x4' in pushed join@1
2919 1 SIMPLE x6 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x5.b3 1 100.00 Child of 'x5' in pushed join@1
2920 1 SIMPLE x7 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x6.b3 1 100.00 Child of 'x6' in pushed join@1
2921 1 SIMPLE x8 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x7.b3 1 100.00 Child of 'x7' in pushed join@1
2922 1 SIMPLE x9 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x8.b3 1 100.00 Child of 'x8' in pushed join@1
2923 1 SIMPLE x10 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x9.b3 1 100.00 Child of 'x9' in pushed join@1
2924 1 SIMPLE x11 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x10.b3 1 100.00 Child of 'x10' in pushed join@1
2925 1 SIMPLE x12 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x11.b3 1 100.00 Child of 'x11' in pushed join@1
2926 1 SIMPLE x13 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x12.b3 1 100.00 Child of 'x12' in pushed join@1
2927 1 SIMPLE x14 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x13.b3 1 100.00 Child of 'x13' in pushed join@1
2928 1 SIMPLE x15 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x14.b3 1 100.00 Child of 'x14' in pushed join@1
2929 1 SIMPLE x16 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x15.b3 1 100.00 Parent of 2 pushed join@2
2930 1 SIMPLE x18 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref t3_d3 t3_d3 4 test.x16.b3 1 100.00 Child of 'x16' in pushed join@2
2931 1 SIMPLE x17 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x15.b3 1 100.00 Child of 'x15' in pushed join@1
2932 Warnings:
2933 Note 1003 Can't push table 'x16' as child of 'x0'. Max number of pushable tables exceeded.
2934 Note 1003 Can't push table 'x18' as child of 'x0'. Max number of pushable tables exceeded.
2935 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t3` `x0` join `test`.`t3` `x1` join `test`.`t3` `x2` join `test`.`t3` `x3` join `test`.`t3` `x4` join `test`.`t3` `x5` join `test`.`t3` `x6` join `test`.`t3` `x7` join `test`.`t3` `x8` join `test`.`t3` `x9` join `test`.`t3` `x10` join `test`.`t3` `x11` join `test`.`t3` `x12` join `test`.`t3` `x13` join `test`.`t3` `x14` join `test`.`t3` `x15` join `test`.`t3` `x16` join `test`.`t3` `x17` join `test`.`t3` `x18` where ((`test`.`x1`.`d3` = `test`.`x0`.`b3`) and (`test`.`x2`.`d3` = `test`.`x1`.`b3`) and (`test`.`x3`.`d3` = `test`.`x2`.`b3`) and (`test`.`x4`.`d3` = `test`.`x3`.`b3`) and (`test`.`x5`.`d3` = `test`.`x4`.`b3`) and (`test`.`x6`.`d3` = `test`.`x5`.`b3`) and (`test`.`x7`.`d3` = `test`.`x6`.`b3`) and (`test`.`x8`.`d3` = `test`.`x7`.`b3`) and (`test`.`x9`.`d3` = `test`.`x8`.`b3`) and (`test`.`x10`.`d3` = `test`.`x9`.`b3`) and (`test`.`x11`.`d3` = `test`.`x10`.`b3`) and (`test`.`x12`.`d3` = `test`.`x11`.`b3`) and (`test`.`x13`.`d3` = `test`.`x12`.`b3`) and (`test`.`x14`.`d3` = `test`.`x13`.`b3`) and (`test`.`x15`.`d3` = `test`.`x14`.`b3`) and (`test`.`x16`.`d3` = `test`.`x15`.`b3`) and (`test`.`x17`.`a3` = `test`.`x15`.`b3`) and (`test`.`x18`.`d3` = `test`.`x16`.`b3`))
2936 select count(*) from t3 as x0
2937 join t3 as x1 on x0.b3=x1.d3
2938 join t3 as x2 on x1.b3=x2.d3
2939 join t3 as x3 on x2.b3=x3.d3
2940 join t3 as x4 on x3.b3=x4.d3
2941 join t3 as x5 on x4.b3=x5.d3
2942 join t3 as x6 on x5.b3=x6.d3
2943 join t3 as x7 on x6.b3=x7.d3
2944 join t3 as x8 on x7.b3=x8.d3
2945 join t3 as x9 on x8.b3=x9.d3
2946 join t3 as x10 on x9.b3=x10.d3
2947 join t3 as x11 on x10.b3=x11.d3
2948 join t3 as x12 on x11.b3=x12.d3
2949 join t3 as x13 on x12.b3=x13.d3
2950 join t3 as x14 on x13.b3=x14.d3
2951 join t3 as x15 on x14.b3=x15.d3
2952 join t3 as x16 on x15.b3=x16.d3
2953 join t3 as x17 on x15.b3=x17.a3
2954 join t3 as x18 on x16.b3=x18.d3;
2955 count(*)
2956 4
2957 drop table t1,t2,t3, t3_hash;
2958 create table t3 (a3 int, b3 int, c3 int, d3 int,
2959 primary key(b3, a3)) engine = ndb
2960 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
2961 create table t3_hash (a3 int, b3 int, c3 int, d3 int,
2962 primary key(b3,a3) using hash) engine = ndb
2963 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
2964 create table t3_unq (pk int, a3 int not null, b3 int not null, c3 int, d3 int,
2965 primary key(pk) using hash, unique key(b3,a3) using hash) engine = ndb
2966 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
2967 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
2968 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
2969 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
2970 insert into t3_hash values (0x1f, 0x2f, 1, 0x1f);
2971 insert into t3_hash values (0x2f, 0x3f, 2, 0x2f);
2972 insert into t3_hash values (0x3f, 0x1f, 3, 0x3f);
2973 insert into t3_unq values (1001, 0x1f, 0x2f, 1, 0x1f);
2974 insert into t3_unq values (1002, 0x2f, 0x3f, 2, 0x2f);
2975 insert into t3_unq values (1003, 0x3f, 0x1f, 3, 0x3f);
2976 explain
2977 select * from t3 x, t3 y where y.a3=x.d3 and y.b3=x.b3;
2978 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2979 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`d3` is not null)
2980 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.b3,test.x.d3 1 100.00 Child of 'x' in pushed join@1
2981 Warnings:
2982 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`))
2983 select * from t3 x, t3 y where y.a3=x.d3 and y.b3=x.b3;
2984 a3 b3 c3 d3 a3 b3 c3 d3
2985 31 47 1 31 31 47 1 31
2986 47 63 2 47 47 63 2 47
2987 63 31 3 63 63 31 3 63
2988 explain
2989 select * from t3_hash x, t3_hash y where y.a3=x.d3 and y.b3=x.b3;
2990 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
2991 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`d3` is not null)
2992 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.b3,test.x.d3 1 100.00 Child of 'x' in pushed join@1
2993 Warnings:
2994 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`))
2995 select * from t3_hash x, t3_hash y where y.a3=x.d3 and y.b3=x.b3;
2996 a3 b3 c3 d3 a3 b3 c3 d3
2997 31 47 1 31 31 47 1 31
2998 47 63 2 47 47 63 2 47
2999 63 31 3 63 63 31 3 63
3000 explain
3001 select * from t3_unq x, t3_unq y where y.a3=x.d3 and y.b3=x.b3;
3002 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3003 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL b3 NULL NULL NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`d3` is not null)
3004 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 8 test.x.b3,test.x.d3 1 100.00 Child of 'x' in pushed join@1
3005 Warnings:
3006 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`))
3007 select * from t3_unq x, t3_unq y where y.a3=x.d3 and y.b3=x.b3;
3008 pk a3 b3 c3 d3 pk a3 b3 c3 d3
3009 1001 31 47 1 31 1001 31 47 1 31
3010 1002 47 63 2 47 1002 47 63 2 47
3011 1003 63 31 3 63 1003 63 31 3 63
3012 explain
3013 select * from t3 x, t3 y where y.a3=x.d3 and y.b3=x.b3
3014 and x.a3=0x2f and x.b3=0x3f;
3015 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3016 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`d3` is not null)
3017 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 const,test.x.d3 1 100.00 Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`b3` = `test`.`x`.`b3`)
3018 Warnings:
3019 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))
3020 select * from t3 x, t3 y where y.a3=x.d3 and y.b3=x.b3
3021 and x.a3=0x2f and x.b3=0x3f;
3022 a3 b3 c3 d3 a3 b3 c3 d3
3023 47 63 2 47 47 63 2 47
3024 explain
3025 select * from t3_hash x, t3_hash y where y.a3=x.d3 and y.b3=x.b3
3026 and x.a3=0x2f and x.b3=0x3f;
3027 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3028 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 const,const 1 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`d3` is not null)
3029 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 const,test.x.d3 1 100.00 Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`b3` = `test`.`x`.`b3`)
3030 Warnings:
3031 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))
3032 select * from t3_hash x, t3_hash y where y.a3=x.d3 and y.b3=x.b3
3033 and x.a3=0x2f and x.b3=0x3f;
3034 a3 b3 c3 d3 a3 b3 c3 d3
3035 47 63 2 47 47 63 2 47
3036 explain
3037 select * from t3_unq x, t3_unq y where y.a3=x.d3 and y.b3=x.b3
3038 and x.a3=0x2f and x.b3=0x3f;
3039 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3040 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 8 const,const 1 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`d3` is not null)
3041 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 8 const,test.x.d3 1 100.00 Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`b3` = `test`.`x`.`b3`)
3042 Warnings:
3043 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))
3044 select * from t3_unq x, t3_unq y where y.a3=x.d3 and y.b3=x.b3
3045 and x.a3=0x2f and x.b3=0x3f;
3046 pk a3 b3 c3 d3 pk a3 b3 c3 d3
3047 1002 47 63 2 47 1002 47 63 2 47
3048 drop table t3, t3_hash, t3_unq;
3049 create table t3 (a3 int, b3 int, c3 int, d3 int,
3050 primary key(a3), unique key(d3)) engine = ndb
3051 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3052 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
3053 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
3054 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
3055 insert into t3 values (0x4f, 0, null, null);
3056 explain
3057 select * from t3 as t1
3058 left outer join t3 as t2 on t2.d3 = t1.d3
3059 left outer join t3 as t3 on t3.a3 = t2.d3;
3060 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3061 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 Parent of 3 pushed join@1
3062 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref d3 d3 5 test.t1.d3 1 100.00 Child of 't1' in pushed join@1
3063 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.d3 1 100.00 Child of 't2' in pushed join@1
3064 Warnings:
3065 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 true
3066 select * from t3 as t1
3067 left outer join t3 as t2 on t2.d3 = t1.d3
3068 left outer join t3 as t3 on t3.a3 = t2.d3;
3069 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3
3070 31 47 1 31 31 47 1 31 31 47 1 31
3071 47 63 2 47 47 63 2 47 47 63 2 47
3072 63 31 3 63 63 31 3 63 63 31 3 63
3073 79 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
3074 explain
3075 select * from t3 as t1
3076 left outer join t3 as t2 on t2.d3 = t1.a3
3077 left outer join t3 as t3 on t3.a3 = t2.d3
3078 where t1.d3 = 47;
3079 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3080 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref d3 d3 5 const 1 100.00 Parent of 3 pushed join@1
3081 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref d3 d3 5 test.t1.a3 1 100.00 Child of 't1' in pushed join@1
3082 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.d3 1 100.00 Child of 't2' in pushed join@1
3083 Warnings:
3084 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)
3085 select * from t3 as t1
3086 left outer join t3 as t2 on t2.d3 = t1.a3
3087 left outer join t3 as t3 on t3.a3 = t2.d3
3088 where t1.d3 = 47;
3089 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3
3090 47 63 2 47 47 63 2 47 47 63 2 47
3091 explain
3092 select * from t3 as t1
3093 left outer join t3 as t2 on t2.d3 = t1.a3
3094 left outer join t3 as t3 on t3.a3 = t2.d3
3095 where t1.d3 >= 47;
3096 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3097 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 range d3 d3 5 NULL 3 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`t1`.`d3` >= 47); Using MRR
3098 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref d3 d3 5 test.t1.a3 1 100.00 Child of 't1' in pushed join@1
3099 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.d3 1 100.00 Child of 't2' in pushed join@1
3100 Warnings:
3101 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)
3102 select * from t3 as t1
3103 left outer join t3 as t2 on t2.d3 = t1.a3
3104 left outer join t3 as t3 on t3.a3 = t2.d3
3105 where t1.d3 >= 47;
3106 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3
3107 47 63 2 47 47 63 2 47 47 63 2 47
3108 63 31 3 63 63 31 3 63 63 31 3 63
3109 explain
3110 select * from t3 as t1
3111 left outer join t3 as t2 on t2.d3 = t1.a3
3112 left outer join t3 as t3 on t3.a3 = t2.d3
3113 where t1.d3 is null;
3114 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3115 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ref d3 d3 5 const 3 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`t1`.`d3` is null)
3116 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref d3 d3 5 test.t1.a3 1 100.00 Child of 't1' in pushed join@1
3117 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.d3 1 100.00 Child of 't2' in pushed join@1
3118 Warnings:
3119 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 null)
3120 select * from t3 as t1
3121 left outer join t3 as t2 on t2.d3 = t1.a3
3122 left outer join t3 as t3 on t3.a3 = t2.d3
3123 where t1.d3 is null;
3124 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3
3125 79 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
3126 explain
3127 select * from t3 as t1
3128 left outer join t3 as t2 on t2.d3 = t1.a3
3129 left outer join t3 as t3 on t3.a3 = t2.d3
3130 where t1.d3 is not null;
3131 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3132 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 range d3 d3 5 NULL 3 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`t1`.`d3` is not null); Using MRR
3133 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref d3 d3 5 test.t1.a3 1 100.00 Child of 't1' in pushed join@1
3134 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.d3 1 100.00 Child of 't2' in pushed join@1
3135 Warnings:
3136 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)
3137 select * from t3 as t1
3138 left outer join t3 as t2 on t2.d3 = t1.a3
3139 left outer join t3 as t3 on t3.a3 = t2.d3
3140 where t1.d3 is not null;
3141 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3
3142 31 47 1 31 31 47 1 31 31 47 1 31
3143 47 63 2 47 47 63 2 47 47 63 2 47
3144 63 31 3 63 63 31 3 63 63 31 3 63
3145 insert into t3 values (0x5f, 0x5f, 4, null);
3146 alter table t3 add index ix(b3);
3147 explain select straight_join *
3148 from t3 as t1
3149 left join t3 as t2 on t2.b3 = t1.a3
3150 left join t3 as t3 on t3.b3 = t2.d3
3151 where t1.d3 is null;
3152 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3153 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ref d3 d3 5 const 3 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`t1`.`d3` is null)
3154 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref ix ix 5 test.t1.a3 2 100.00 Child of 't1' in pushed join@1
3155 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix ix 5 test.t2.d3 2 100.00 Child of 't2' in pushed join@1
3156 Warnings:
3157 Note 1003 /* select#1 */ select straight_join `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`.`b3` = `test`.`t1`.`a3`)) left join `test`.`t3` on((`test`.`t3`.`b3` = `test`.`t2`.`d3`)) where (`test`.`t1`.`d3` is null)
3158 select straight_join *
3159 from t3 as t1
3160 left join t3 as t2 on t2.b3 = t1.a3
3161 left join t3 as t3 on t3.b3 = t2.d3
3162 where t1.d3 is null;
3163 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3
3164 79 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
3165 95 95 4 NULL 95 95 4 NULL NULL NULL NULL NULL
3166 explain select straight_join *
3167 from t3 as t1
3168 left join t3 as t2 on t2.d3 = t1.a3
3169 left join t3 as t3 on t3.d3 = t2.d3
3170 where t1.d3 is null;
3171 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3172 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ref d3 d3 5 const 3 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`t1`.`d3` is null)
3173 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref d3 d3 5 test.t1.a3 1 100.00 Child of 't1' in pushed join@1
3174 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref d3 d3 5 test.t2.d3 1 100.00 Child of 't2' in pushed join@1
3175 Warnings:
3176 Note 1003 /* select#1 */ select straight_join `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`.`d3` = `test`.`t2`.`d3`)) where (`test`.`t1`.`d3` is null)
3177 select straight_join *
3178 from t3 as t1
3179 left join t3 as t2 on t2.d3 = t1.a3
3180 left join t3 as t3 on t3.d3 = t2.d3
3181 where t1.d3 is null;
3182 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3
3183 79 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
3184 95 95 4 NULL NULL NULL NULL NULL NULL NULL NULL NULL
3185 alter table t3 drop index d3;
3186 alter table t3 add unique key(d3) using hash;
3187 Warnings:
3188 Warning 1121 Ndb does not support unique index on NULL valued attributes, index access with NULL value will become full table scan
3189 explain select straight_join *
3190 from t3 as t1
3191 left join t3 as t2 on t2.b3 = t1.a3
3192 left join t3 as t3 on t3.b3 = t2.d3
3193 where t1.d3 is null;
3194 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3195 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL d3 NULL NULL NULL 5 20.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`t1`.`d3` is null)
3196 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref ix ix 5 test.t1.a3 2 100.00 Child of 't1' in pushed join@1
3197 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix ix 5 test.t2.d3 2 100.00 Child of 't2' in pushed join@1
3198 Warnings:
3199 Note 1003 /* select#1 */ select straight_join `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`.`b3` = `test`.`t1`.`a3`)) left join `test`.`t3` on((`test`.`t3`.`b3` = `test`.`t2`.`d3`)) where (`test`.`t1`.`d3` is null)
3200 select straight_join *
3201 from t3 as t1
3202 left join t3 as t2 on t2.b3 = t1.a3
3203 left join t3 as t3 on t3.b3 = t2.d3
3204 where t1.d3 is null;
3205 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3
3206 79 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
3207 95 95 4 NULL 95 95 4 NULL NULL NULL NULL NULL
3208 explain select straight_join *
3209 from t3 as t1
3210 left join t3 as t2 on t2.d3 = t1.a3
3211 left join t3 as t3 on t3.d3 = t2.d3
3212 where t1.d3 is null;
3213 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3214 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL d3 NULL NULL NULL 5 20.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`t1`.`d3` is null)
3215 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref d3 d3 5 test.t1.a3 1 100.00 Child of 't1' in pushed join@1
3216 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref d3 d3 5 test.t2.d3 1 100.00 Child of 't2' in pushed join@1
3217 Warnings:
3218 Note 1003 /* select#1 */ select straight_join `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`.`d3` = `test`.`t2`.`d3`)) where (`test`.`t1`.`d3` is null)
3219 select straight_join *
3220 from t3 as t1
3221 left join t3 as t2 on t2.d3 = t1.a3
3222 left join t3 as t3 on t3.d3 = t2.d3
3223 where t1.d3 is null;
3224 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3
3225 79 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
3226 95 95 4 NULL NULL NULL NULL NULL NULL NULL NULL NULL
3227 drop table t3;
3228 create table t3 (a3 int not null, b3 int not null, c3 int, d3 int,
3229 primary key(a3), unique key(b3,d3), unique key(c3,b3), unique key(c3,d3)) engine = ndb
3230 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3231 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
3232 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
3233 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
3234 insert into t3 values (0x40, 0, null, null);
3235 insert into t3 values (0x41, 0, null, null);
3236 insert into t3 values (0x42, 0, 4, null);
3237 insert into t3 values (0x43, 0, null, 0x43);
3238 explain
3239 select straight_join *
3240 from t3 as x join t3 as y on x.b3 = y.b3;
3241 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3242 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL b3 NULL NULL NULL 7 100.00 Parent of 2 pushed join@1
3243 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 ref b3 b3 4 test.x.b3 1 100.00 Child of 'x' in pushed join@1
3244 Warnings:
3245 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`)
3246 select straight_join *
3247 from t3 as x join t3 as y on x.b3 = y.b3;
3248 a3 b3 c3 d3 a3 b3 c3 d3
3249 31 47 1 31 31 47 1 31
3250 47 63 2 47 47 63 2 47
3251 63 31 3 63 63 31 3 63
3252 64 0 NULL NULL 64 0 NULL NULL
3253 64 0 NULL NULL 65 0 NULL NULL
3254 64 0 NULL NULL 66 0 4 NULL
3255 64 0 NULL NULL 67 0 NULL 67
3256 65 0 NULL NULL 64 0 NULL NULL
3257 65 0 NULL NULL 65 0 NULL NULL
3258 65 0 NULL NULL 66 0 4 NULL
3259 65 0 NULL NULL 67 0 NULL 67
3260 66 0 4 NULL 64 0 NULL NULL
3261 66 0 4 NULL 65 0 NULL NULL
3262 66 0 4 NULL 66 0 4 NULL
3263 66 0 4 NULL 67 0 NULL 67
3264 67 0 NULL 67 64 0 NULL NULL
3265 67 0 NULL 67 65 0 NULL NULL
3266 67 0 NULL 67 66 0 4 NULL
3267 67 0 NULL 67 67 0 NULL 67
3268 explain
3269 select straight_join *
3270 from t3 as x join t3 as y on x.b3 = y.b3
3271 where y.d3 = 0x2f;
3272 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3273 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL b3 NULL NULL NULL 7 100.00 Parent of 2 pushed join@1
3274 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 test.x.b3,const 1 100.00 Child of 'x' in pushed join@1
3275 Warnings:
3276 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))
3277 select straight_join *
3278 from t3 as x join t3 as y on x.b3 = y.b3
3279 where y.d3 = 0x2f;
3280 a3 b3 c3 d3 a3 b3 c3 d3
3281 47 63 2 47 47 63 2 47
3282 explain
3283 select straight_join *
3284 from t3 as x join t3 as y on x.c3 = y.c3
3285 where y.d3 = 0x2f;
3286 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3287 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL c3,c3_2 NULL NULL NULL # # Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`c3` is not null)
3288 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref c3,c3_2 c3_2 10 test.x.c3,const # # Child of 'x' in pushed join@1
3289 Warnings:
3290 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))
3291 select straight_join *
3292 from t3 as x join t3 as y on x.c3 = y.c3
3293 where y.d3 = 0x2f;
3294 a3 b3 c3 d3 a3 b3 c3 d3
3295 47 63 2 47 47 63 2 47
3296 explain
3297 select straight_join *
3298 from t3 as x join t3 as y on x.d3 = y.d3
3299 where y.b3 = 0x2f;
3300 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3301 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 7 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`d3` is not null)
3302 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 const,test.x.d3 1 100.00 Child of 'x' in pushed join@1
3303 Warnings:
3304 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))
3305 select straight_join *
3306 from t3 as x join t3 as y on x.d3 = y.d3
3307 where y.b3 = 0x2f;
3308 a3 b3 c3 d3 a3 b3 c3 d3
3309 31 47 1 31 31 47 1 31
3310 explain
3311 select straight_join *
3312 from t3 as x join t3 as y on x.d3 = y.d3
3313 where y.b3 = 0x20+0x2f;
3314 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3315 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 7 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`d3` is not null)
3316 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 const,test.x.d3 1 100.00 Child of 'x' in pushed join@1
3317 Warnings:
3318 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` = (0x20 + 0x2f)))
3319 select straight_join *
3320 from t3 as x join t3 as y on x.d3 = y.d3
3321 where y.b3 = 0x20+0x2f;
3322 a3 b3 c3 d3 a3 b3 c3 d3
3323 explain
3324 select straight_join *
3325 from t3 as x join t3 as y on x.b3 = y.b3
3326 where y.d3 is not null;
3327 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3328 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL b3 NULL NULL NULL # # Parent of 2 pushed join@1
3329 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 ref b3 b3 4 test.x.b3 # # Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`d3` is not null)
3330 Warnings:
3331 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))
3332 select straight_join *
3333 from t3 as x join t3 as y on x.b3 = y.b3
3334 where y.d3 is not null;
3335 a3 b3 c3 d3 a3 b3 c3 d3
3336 31 47 1 31 31 47 1 31
3337 47 63 2 47 47 63 2 47
3338 63 31 3 63 63 31 3 63
3339 64 0 NULL NULL 67 0 NULL 67
3340 65 0 NULL NULL 67 0 NULL 67
3341 66 0 4 NULL 67 0 NULL 67
3342 67 0 NULL 67 67 0 NULL 67
3343 explain
3344 select straight_join *
3345 from t3 as x join t3 as y on x.b3 = y.b3
3346 where y.d3 is null;
3347 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3348 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL b3 NULL NULL NULL 7 100.00 NULL
3349 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 ref b3 b3 9 test.x.b3,const 1 100.00 Using pushed condition (`test`.`y`.`d3` is null)
3350 Warnings:
3351 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 null))
3352 select straight_join *
3353 from t3 as x join t3 as y on x.b3 = y.b3
3354 where y.d3 is null;
3355 a3 b3 c3 d3 a3 b3 c3 d3
3356 64 0 NULL NULL 64 0 NULL NULL
3357 64 0 NULL NULL 65 0 NULL NULL
3358 64 0 NULL NULL 66 0 4 NULL
3359 65 0 NULL NULL 64 0 NULL NULL
3360 65 0 NULL NULL 65 0 NULL NULL
3361 65 0 NULL NULL 66 0 4 NULL
3362 66 0 4 NULL 64 0 NULL NULL
3363 66 0 4 NULL 65 0 NULL NULL
3364 66 0 4 NULL 66 0 4 NULL
3365 67 0 NULL 67 64 0 NULL NULL
3366 67 0 NULL 67 65 0 NULL NULL
3367 67 0 NULL 67 66 0 4 NULL
3368 explain
3369 select straight_join *
3370 from t3 as x join t3 as y on x.c3 = y.c3
3371 where y.b3 = 0;
3372 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3373 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL c3,c3_2 NULL NULL NULL 7 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`c3` is not null)
3374 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3,c3,c3_2 c3 9 test.x.c3,const 1 100.00 Child of 'x' in pushed join@1
3375 Warnings:
3376 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))
3377 select straight_join *
3378 from t3 as x join t3 as y on x.c3 = y.c3
3379 where y.b3 = 0;
3380 a3 b3 c3 d3 a3 b3 c3 d3
3381 66 0 4 NULL 66 0 4 NULL
3382 explain
3383 select straight_join *
3384 from t3 as x join t3 as y on x.c3 = y.c3
3385 where y.b3 is null;
3386 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3387 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3388 Warnings:
3389 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 false
3390 select straight_join *
3391 from t3 as x join t3 as y on x.c3 = y.c3
3392 where y.b3 is null;
3393 a3 b3 c3 d3 a3 b3 c3 d3
3394 explain
3395 select straight_join * from
3396 t3 as x1
3397 join t3 as y1 on y1.b3 = x1.b3 and y1.d3 = x1.d3
3398 join t3 as x2 on x2.b3 = y1.b3+0
3399 join t3 as y2 on y2.b3 = x2.c3 and y2.d3 = x1.c3;
3400 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3401 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL b3,c3,c3_2 NULL NULL NULL 7 100.00 Parent of 2 pushed join@1; Using pushed condition ((`test`.`x1`.`d3` is not null) and (`test`.`x1`.`c3` is not null))
3402 1 SIMPLE y1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 test.x1.b3,test.x1.d3 1 100.00 Child of 'x1' in pushed join@1
3403 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref b3,c3,c3_2 b3 4 func 1 100.00 Parent of 2 pushed join@2; Using pushed condition ((`test`.`x2`.`b3` = (`test`.`x1`.`b3` + 0)) and (`test`.`x2`.`c3` is not null))
3404 1 SIMPLE y2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 test.x2.c3,test.x1.c3 1 100.00 Child of 'x2' in pushed join@2
3405 Warnings:
3406 Note 1003 Can't push table 'x2' as child, column 'b3' does neither 'ref' a column nor a constant
3407 Note 1003 Can't push table 'y2' as child of 'x1', column 'x2.c3' refers a table which was not pushed
3408 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`.`y2`.`d3` = `test`.`x1`.`c3`) and (`test`.`y2`.`b3` = `test`.`x2`.`c3`) and (`test`.`x2`.`b3` = (`test`.`x1`.`b3` + 0)))
3409 select straight_join * from
3410 t3 as x1
3411 join t3 as y1 on y1.b3 = x1.b3 and y1.d3 = x1.d3
3412 join t3 as x2 on x2.b3 = y1.b3+0
3413 join t3 as y2 on y2.b3 = x2.c3 and y2.d3 = x1.c3;
3414 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3
3415 prepare stmt1 from
3416 'select straight_join *
3417 from t3 as x join t3 as y on x.b3 = y.b3
3418 where y.d3 = 0x2f';
3419 execute stmt1;
3420 a3 b3 c3 d3 a3 b3 c3 d3
3421 47 63 2 47 47 63 2 47
3422 execute stmt1;
3423 a3 b3 c3 d3 a3 b3 c3 d3
3424 47 63 2 47 47 63 2 47
3425 drop prepare stmt1;
3426 execute stmt1;
3427 ERROR HY000: Unknown prepared statement handler (stmt1) given to EXECUTE
3428 prepare stmt1 from
3429 'select straight_join *
3430 from t3 as x join t3 as y on x.b3 = y.b3
3431 where y.d3 = 0x2f';
3432 prepare stmt1 from
3433 'select straight_join *
3434 from t3 as x join t3 as y on x.b3 = y.b3
3435 where y.d3 = 0x2f';
3436 drop prepare stmt1;
3437 prepare stmt1 from
3438 'explain select straight_join *
3439 from t3 as x join t3 as y on x.b3 = y.b3
3440 where y.d3 = 0x2f';
3441 execute stmt1;
3442 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3443 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL b3 NULL NULL NULL 7 100.00 Parent of 2 pushed join@1
3444 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 test.x.b3,const 1 100.00 Child of 'x' in pushed join@1
3445 Warnings:
3446 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))
3447 execute stmt1;
3448 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3449 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL b3 NULL NULL NULL 7 100.00 Parent of 2 pushed join@1
3450 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 test.x.b3,const 1 100.00 Child of 'x' in pushed join@1
3451 Warnings:
3452 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))
3453 commit;
3454 execute stmt1;
3455 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3456 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL b3 NULL NULL NULL 7 100.00 Parent of 2 pushed join@1
3457 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 test.x.b3,const 1 100.00 Child of 'x' in pushed join@1
3458 Warnings:
3459 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))
3460 drop index b3 on t3;
3461 execute stmt1;
3462 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3463 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # NULL
3464 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Using pushed condition (`test`.`y`.`d3` = 0x2f); Using join buffer (hash join)
3465 Warnings:
3466 Note 1003 Can't push table 'y' as child, 'type' must be a 'ref' access
3467 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))
3468 create unique index b3 on t3(b3,d3);
3469 execute stmt1;
3470 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3471 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL b3 NULL NULL NULL 7 100.00 Parent of 2 pushed join@1
3472 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 test.x.b3,const 1 100.00 Child of 'x' in pushed join@1
3473 Warnings:
3474 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))
3475 drop prepare stmt1;
3476 prepare stmt1 from
3477 'explain select straight_join *
3478 from t3 as x join t3 as y on x.b3 = y.b3
3479 where y.d3 = ?';
3480 set @a=47;
3481 execute stmt1 using @a;
3482 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3483 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL b3 NULL NULL NULL 7 100.00 Parent of 2 pushed join@1
3484 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 test.x.b3,const 1 100.00 Child of 'x' in pushed join@1
3485 Warnings:
3486 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` = 47))
3487 set @a=0;
3488 execute stmt1 using @a;
3489 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3490 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL b3 NULL NULL NULL 7 100.00 Parent of 2 pushed join@1
3491 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 test.x.b3,const 1 100.00 Child of 'x' in pushed join@1
3492 Warnings:
3493 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` = 0))
3494 set @a=null;
3495 execute stmt1 using @a;
3496 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3497 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL b3 NULL NULL NULL 7 100.00 NULL
3498 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 test.x.b3,const 1 100.00 Using where
3499 Warnings:
3500 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` = NULL))
3501 prepare stmt1 from
3502 'select straight_join *
3503 from t3 as x join t3 as y on x.b3 = y.b3
3504 where y.d3 = ?';
3505 set @a=47;
3506 execute stmt1 using @a;
3507 a3 b3 c3 d3 a3 b3 c3 d3
3508 47 63 2 47 47 63 2 47
3509 set @a=0;
3510 execute stmt1 using @a;
3511 a3 b3 c3 d3 a3 b3 c3 d3
3512 set @a=null;
3513 execute stmt1 using @a;
3514 a3 b3 c3 d3 a3 b3 c3 d3
3515 prepare stmt1 from
3516 'explain select straight_join *
3517 from t3 as x join t3 as y on x.b3 = y.b3 and x.d3 = y.d3
3518 where x.a3 = ?';
3519 set @a=47;
3520 execute stmt1 using @a;
3521 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3522 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,b3 PRIMARY 4 const 1 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`d3` is not null)
3523 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 test.x.b3,test.x.d3 1 100.00 Child of 'x' in pushed join@1
3524 Warnings:
3525 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` = `test`.`x`.`b3`) and (`test`.`x`.`a3` = 47))
3526 set @a=0;
3527 execute stmt1 using @a;
3528 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3529 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,b3 PRIMARY 4 const 1 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`d3` is not null)
3530 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref b3 b3 9 test.x.b3,test.x.d3 1 100.00 Child of 'x' in pushed join@1
3531 Warnings:
3532 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` = `test`.`x`.`b3`) and (`test`.`x`.`a3` = 0))
3533 set @a=null;
3534 execute stmt1 using @a;
3535 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3536 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
3537 Warnings:
3538 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 (multiple equal(NULL, `test`.`x`.`a3`) and multiple equal(`test`.`x`.`b3`, `test`.`y`.`b3`) and multiple equal(`test`.`x`.`d3`, `test`.`y`.`d3`))
3539 prepare stmt1 from
3540 'select straight_join *
3541 from t3 as x join t3 as y on x.b3 = y.b3 and x.d3 = y.d3
3542 where x.a3 = ?';
3543 set @a=47;
3544 execute stmt1 using @a;
3545 a3 b3 c3 d3 a3 b3 c3 d3
3546 47 63 2 47 47 63 2 47
3547 set @a=0;
3548 execute stmt1 using @a;
3549 a3 b3 c3 d3 a3 b3 c3 d3
3550 set @a=null;
3551 execute stmt1 using @a;
3552 a3 b3 c3 d3 a3 b3 c3 d3
3553 drop table t3;
3554 set @a=47;
3555 execute stmt1 using @a;
3556 ERROR 42S02: Table 'test.t3' doesn't exist
3557 create table t1 (a int primary key, b int, c int, index(b,c)) engine = ndb
3558 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3559 insert into t1 values (1,null, 2);
3560 insert into t1 values (2,1, null);
3561 insert into t1 values (3,2,2);
3562 insert into t1 values (4,null, 2);
3563 insert into t1 values (5,1, null);
3564 insert into t1 values (6,2,2);
3565 set ndb_join_pushdown=false;
3566 select *
3567 from t1
3568 join t1 as t2 on (t2.b = t1.b or t2.b = t1.a)
3569 join t1 as t3 on t3.a = t2.a
3570 join t1 as t4 on t4.a = t3.b /* index scan disguised as JT_ALL, pushdown=off */;
3571 a b c a b c a b c a b c
3572 1 NULL 2 2 1 NULL 2 1 NULL 1 NULL 2
3573 1 NULL 2 5 1 NULL 5 1 NULL 1 NULL 2
3574 2 1 NULL 2 1 NULL 2 1 NULL 1 NULL 2
3575 2 1 NULL 3 2 2 3 2 2 2 1 NULL
3576 2 1 NULL 5 1 NULL 5 1 NULL 1 NULL 2
3577 2 1 NULL 6 2 2 6 2 2 2 1 NULL
3578 3 2 2 3 2 2 3 2 2 2 1 NULL
3579 3 2 2 6 2 2 6 2 2 2 1 NULL
3580 5 1 NULL 2 1 NULL 2 1 NULL 1 NULL 2
3581 5 1 NULL 5 1 NULL 5 1 NULL 1 NULL 2
3582 6 2 2 3 2 2 3 2 2 2 1 NULL
3583 6 2 2 6 2 2 6 2 2 2 1 NULL
3584 set ndb_join_pushdown=true;
3585 explain
3586 select *
3587 from t1
3588 join t1 as t2 on (t2.b = t1.b or t2.b = t1.a)
3589 join t1 as t3 on t3.a = t2.a
3590 join t1 as t4 on t4.a = t3.b /* index scan disguised as JT_ALL, pushdown=on */;
3591 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3592 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY,b NULL NULL NULL 6 100.00 NULL
3593 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY,b NULL NULL NULL 6 30.56 Range checked for each record (index map: 0x3); Using pushed condition ((`test`.`t2`.`b` = `test`.`t1`.`b`) or (`test`.`t2`.`b` = `test`.`t1`.`a`))
3594 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,b PRIMARY 4 test.t2.a 1 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`t3`.`b` is not null)
3595 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t3.b 1 100.00 Child of 't3' in pushed join@1
3596 Warnings:
3597 Note 1003 Table 't2' is not pushable: Access type was not chosen at 'prepare' time
3598 Note 1003 Can't push table 't3' as child of 't1', column 't2.a' refers a table which was not pushed
3599 Note 1003 Can't push table 't4' as child of 't1', column 't3.b' refers a table which was not pushed
3600 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`.`t2`.`b` = `test`.`t1`.`b`) or (`test`.`t2`.`b` = `test`.`t1`.`a`)))
3601 select *
3602 from t1
3603 join t1 as t2 on (t2.b = t1.b or t2.b = t1.a)
3604 join t1 as t3 on t3.a = t2.a
3605 join t1 as t4 on t4.a = t3.b /* index scan disguised as JT_ALL, pushdown=on */;
3606 a b c a b c a b c a b c
3607 1 NULL 2 2 1 NULL 2 1 NULL 1 NULL 2
3608 1 NULL 2 5 1 NULL 5 1 NULL 1 NULL 2
3609 2 1 NULL 2 1 NULL 2 1 NULL 1 NULL 2
3610 2 1 NULL 3 2 2 3 2 2 2 1 NULL
3611 2 1 NULL 5 1 NULL 5 1 NULL 1 NULL 2
3612 2 1 NULL 6 2 2 6 2 2 2 1 NULL
3613 3 2 2 3 2 2 3 2 2 2 1 NULL
3614 3 2 2 6 2 2 6 2 2 2 1 NULL
3615 5 1 NULL 2 1 NULL 2 1 NULL 1 NULL 2
3616 5 1 NULL 5 1 NULL 5 1 NULL 1 NULL 2
3617 6 2 2 3 2 2 3 2 2 2 1 NULL
3618 6 2 2 6 2 2 6 2 2 2 1 NULL
3619 explain
3620 select *
3621 from t1 where b in
3622 (select x.a from t1 as x join t1 as y on (y.a = x.b))
3623 xor c > 5;
3624 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3625 1 PRIMARY t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 6 100.00 Using where
3626 2 DEPENDENT SUBQUERY x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,b PRIMARY 4 func 1 100.00 Parent of 2 pushed join@1; Using where; Using pushed condition (`test`.`x`.`b` is not null); Full scan on NULL key
3627 2 DEPENDENT SUBQUERY y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.b 1 100.00 Child of 'x' in pushed join@1
3628 Warnings:
3629 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 `test`.`x`.`a` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`a` = `test`.`x`.`b`) and <if>(outer_field_is_not_null, (<cache>(`test`.`t1`.`b`) = `test`.`x`.`a`), true)))) xor (`test`.`t1`.`c` > 5))
3630 select *
3631 from t1 where b in
3632 (select x.a from t1 as x join t1 as y on (y.a = x.b))
3633 xor c > 5;
3634 a b c
3635 3 2 2
3636 6 2 2
3637 Warning 1296 Prepared pushed join could not be executed, prepared with incompatible access type
3638 Warnings:
3639 explain
3640 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;
3641 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3642 1 PRIMARY t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # NULL
3643 2 DEPENDENT SUBQUERY x p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL # # NULL
3644 2 DEPENDENT SUBQUERY y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,b PRIMARY 4 test.t1.b # # Using where
3645 Warnings:
3646 Note 1276 Field or reference 'test.t1.b' of SELECT #2 was resolved in SELECT #1
3647 Note 1003 Can't push table 'y' as child of 'x', column 't1.b' is in a subquery-branch which can't be referred
3648 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`
3649 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;
3650 a (select straight_join x.a from t1 as x join t1 as y on x.a=y.b where y.a = t1.b)
3651 1 NULL
3652 2 NULL
3653 3 1
3654 4 NULL
3655 5 NULL
3656 6 1
3657 drop table t1;
3658 create table t1 (a int primary key, b int) engine = ndb
3659 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3660 create table t2 (a int primary key, b int) engine = myisam;
3661 insert into t1 values(1,1), (2,2), (3,3), (4,4);
3662 insert into t2 values(1,1), (2,2), (3,3), (4,4);
3663 explain
3664 select * from t1, t2, t1 as t3
3665 where t2.a = t1.b
3666 and t3.a = t2.b /* mixed engines */;
3667 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3668 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 Using pushed condition (`test`.`t1`.`b` is not null)
3669 1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using where
3670 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 NULL
3671 Warnings:
3672 Note 1003 Can't push table 't3' as child of 't1', column 't2.b' refers a table which was not pushed
3673 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`))
3674 select * from t1, t2, t1 as t3
3675 where t2.a = t1.b
3676 and t3.a = t2.b /* mixed engines */;
3677 a b a b a b
3678 1 1 1 1 1 1
3679 2 2 2 2 2 2
3680 3 3 3 3 3 3
3681 4 4 4 4 4 4
3682 drop table t1, t2;
3683 create table t1 (a int primary key, b int, c blob) engine = ndb
3684 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3685 create table t2 (a int primary key, b int) engine = ndb
3686 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3687 insert into t1 values (1,1, 'kalle');
3688 insert into t1 values (2,1, 'kalle');
3689 insert into t1 values (3,3, 'kalle');
3690 insert into t1 values (4,1, 'kalle');
3691 insert into t2 values (1,1);
3692 insert into t2 values (2,1);
3693 insert into t2 values (3,3);
3694 insert into t2 values (4,1);
3695 set ndb_join_pushdown=true;
3696 explain
3697 select t1.a, t1.b, t2.a, t2.b
3698 from t1, t2
3699 where t2.a = t1.b;
3700 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3701 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`t1`.`b` is not null)
3702 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1
3703 Warnings:
3704 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`)
3705 select t1.a, t1.b, t2.a, t2.b
3706 from t1, t2
3707 where t2.a = t1.b;
3708 a b a b
3709 1 1 1 1
3710 2 1 1 1
3711 3 3 3 3
3712 4 1 1 1
3713 explain
3714 select t1.a, t1.b, t2.a, t2.b
3715 from t1, t2
3716 where t2.a = t1.b
3717 and t1.a = 2;
3718 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3719 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`t1`.`b` is not null)
3720 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1
3721 Warnings:
3722 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`))
3723 select t1.a, t1.b, t2.a, t2.b
3724 from t1, t2
3725 where t2.a = t1.b
3726 and t1.a = 2;
3727 a b a b
3728 2 1 1 1
3729 explain
3730 select t1.a, t1.b, t2.a, t2.b
3731 from t1, t2
3732 where t1.a = t2.b;
3733 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3734 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`t2`.`b` is not null)
3735 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 Child of 't2' in pushed join@1
3736 Warnings:
3737 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`)
3738 select t1.a, t1.b, t2.a, t2.b
3739 from t1, t2
3740 where t2.a = t1.b;
3741 a b a b
3742 1 1 1 1
3743 2 1 1 1
3744 3 3 3 3
3745 4 1 1 1
3746 explain
3747 select t1.a, t1.b, t2.a, t2.b
3748 from t1, t2
3749 where t1.a = t2.b
3750 and t2.a = 3;
3751 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3752 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`t2`.`b` is not null)
3753 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 Child of 't2' in pushed join@1
3754 Warnings:
3755 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`))
3756 select t1.a, t1.b, t2.a, t2.b
3757 from t1, t2
3758 where t1.a = t2.b
3759 and t2.a = 3;
3760 a b a b
3761 3 3 3 3
3762 explain
3763 select *
3764 from t1, t2
3765 where t2.a = t1.b;
3766 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3767 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 Using pushed condition (`test`.`t1`.`b` is not null)
3768 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 NULL
3769 Warnings:
3770 Note 1003 Table 't1' is not pushable: select list can't contain BLOB columns
3771 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`)
3772 select *
3773 from t1, t2
3774 where t2.a = t1.b;
3775 a b c a b
3776 1 1 kalle 1 1
3777 2 1 kalle 1 1
3778 3 3 kalle 3 3
3779 4 1 kalle 1 1
3780 explain
3781 select *
3782 from t1, t2
3783 where t2.a = t1.b
3784 and t1.a = 2;
3785 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3786 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Using where
3787 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 NULL
3788 Warnings:
3789 Note 1003 Table 't1' is not pushable: select list can't contain BLOB columns
3790 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` = 2) and (`test`.`t2`.`a` = `test`.`t1`.`b`))
3791 select *
3792 from t1, t2
3793 where t2.a = t1.b
3794 and t1.a = 2;
3795 a b c a b
3796 2 1 kalle 1 1
3797 explain
3798 select *
3799 from t1, t2
3800 where t1.a = t2.b;
3801 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3802 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 Using pushed condition (`test`.`t2`.`b` is not null)
3803 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 NULL
3804 Warnings:
3805 Note 1003 Table 't1' is not pushable: select list can't contain BLOB columns
3806 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`)
3807 select *
3808 from t1, t2
3809 where t2.a = t1.b;
3810 a b c a b
3811 1 1 kalle 1 1
3812 2 1 kalle 1 1
3813 3 3 kalle 3 3
3814 4 1 kalle 1 1
3815 explain
3816 select *
3817 from t1, t2
3818 where t1.a = t2.b
3819 and t2.a = 3;
3820 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3821 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Using where
3822 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 NULL
3823 Warnings:
3824 Note 1003 Table 't1' is not pushable: select list can't contain BLOB columns
3825 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`))
3826 select *
3827 from t1, t2
3828 where t1.a = t2.b
3829 and t2.a = 3;
3830 a b c a b
3831 3 3 kalle 3 3
3832 drop table t1, t2;
3833 create table t3 (a3 int, b3 tinyint, c3 int not null, d3 int not null,
3834 primary key(a3,b3)) engine = ndb
3835 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3836 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
3837 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
3838 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
3839 explain
3840 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3="63";
3841 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3842 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
3843 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 5 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
3844 Warnings:
3845 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))
3846 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3="63";
3847 a3 b3 c3 d3 a3 b3 c3 d3
3848 47 63 2 47 47 63 2 47
3849 drop table t3;
3850 create table t3 (a3 int, b3 tinyint unsigned, c3 int not null, d3 int not null,
3851 primary key(a3,b3)) engine = ndb
3852 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3853 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
3854 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
3855 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
3856 explain
3857 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3858 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3859 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
3860 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 5 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
3861 Warnings:
3862 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` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
3863 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3864 a3 b3 c3 d3 a3 b3 c3 d3
3865 47 63 2 47 47 63 2 47
3866 drop table t3;
3867 create table t3 (a3 int, b3 smallint, c3 int not null, d3 int not null,
3868 primary key(a3,b3)) engine = ndb
3869 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3870 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
3871 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
3872 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
3873 explain
3874 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3875 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3876 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
3877 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 6 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
3878 Warnings:
3879 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` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
3880 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3881 a3 b3 c3 d3 a3 b3 c3 d3
3882 47 63 2 47 47 63 2 47
3883 drop table t3;
3884 create table t3 (a3 int, b3 smallint unsigned, c3 int not null, d3 int not null,
3885 primary key(a3,b3)) engine = ndb
3886 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3887 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
3888 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
3889 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
3890 explain
3891 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3892 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3893 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
3894 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 6 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
3895 Warnings:
3896 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` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
3897 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3898 a3 b3 c3 d3 a3 b3 c3 d3
3899 47 63 2 47 47 63 2 47
3900 drop table t3;
3901 create table t3 (a3 int, b3 mediumint, c3 int not null, d3 int not null,
3902 primary key(a3,b3)) engine = ndb
3903 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3904 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
3905 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
3906 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
3907 explain
3908 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3909 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3910 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
3911 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 7 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
3912 Warnings:
3913 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` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
3914 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3915 a3 b3 c3 d3 a3 b3 c3 d3
3916 47 63 2 47 47 63 2 47
3917 drop table t3;
3918 create table t3 (a3 int, b3 mediumint unsigned, c3 int not null, d3 int not null,
3919 primary key(a3,b3)) engine = ndb
3920 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3921 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
3922 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
3923 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
3924 explain
3925 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3926 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3927 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
3928 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 7 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
3929 Warnings:
3930 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` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
3931 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3932 a3 b3 c3 d3 a3 b3 c3 d3
3933 47 63 2 47 47 63 2 47
3934 drop table t3;
3935 create table t3 (a3 int, b3 int, c3 int not null, d3 int not null,
3936 primary key(a3,b3)) engine = ndb
3937 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3938 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
3939 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
3940 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
3941 explain
3942 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3943 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3944 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
3945 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
3946 Warnings:
3947 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` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
3948 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3949 a3 b3 c3 d3 a3 b3 c3 d3
3950 47 63 2 47 47 63 2 47
3951 drop table t3;
3952 create table t3 (a3 int, b3 int unsigned, c3 int not null, d3 int not null,
3953 primary key(a3,b3)) engine = ndb
3954 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3955 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
3956 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
3957 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
3958 explain
3959 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3960 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3961 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
3962 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
3963 Warnings:
3964 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` = (60 + 3)) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
3965 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3966 a3 b3 c3 d3 a3 b3 c3 d3
3967 47 63 2 47 47 63 2 47
3968 drop table t3;
3969 create table t3 (a3 int, b3 bigint, c3 int not null, d3 int not null,
3970 primary key(a3,b3)) engine = ndb
3971 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3972 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
3973 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
3974 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
3975 explain
3976 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3977 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3978 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
3979 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 12 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`b3` = 63)
3980 Warnings:
3981 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))
3982 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3983 a3 b3 c3 d3 a3 b3 c3 d3
3984 47 63 2 47 47 63 2 47
3985 drop table t3;
3986 create table t3 (a3 int, b3 bigint unsigned, c3 int not null, d3 int not null,
3987 primary key(a3,b3)) engine = ndb
3988 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
3989 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
3990 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
3991 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
3992 explain
3993 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
3994 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
3995 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
3996 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 12 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`b3` = 63)
3997 Warnings:
3998 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))
3999 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=(60+3);
4000 a3 b3 c3 d3 a3 b3 c3 d3
4001 47 63 2 47 47 63 2 47
4002 drop table t3;
4003 create table t3 (a3 int, b3 boolean, c3 int not null, d3 int not null,
4004 primary key(a3,b3)) engine = ndb
4005 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4006 insert into t3 values (0x1f, 0, 1, 0x1f);
4007 insert into t3 values (0x2f, 1, 2, 0x2f);
4008 insert into t3 values (0x3f, 0, 3, 0x3f);
4009 explain
4010 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=1;
4011 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4012 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4013 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 5 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
4014 Warnings:
4015 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))
4016 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=1;
4017 a3 b3 c3 d3 a3 b3 c3 d3
4018 47 1 2 47 47 1 2 47
4019 drop table t3;
4020 create table t3 (a3 int, b3 float, c3 int not null, d3 int not null,
4021 primary key(a3,b3)) engine = ndb
4022 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4023 insert into t3 values (0x1f, 2.71, 1, 0x1f);
4024 insert into t3 values (0x2f, 3.00, 2, 0x2f);
4025 insert into t3 values (0x3f, 0.50, 3, 0x3f);
4026 explain
4027 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.0;
4028 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4029 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4030 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`b3` = 3)
4031 Warnings:
4032 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))
4033 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.0;
4034 a3 b3 c3 d3 a3 b3 c3 d3
4035 47 3 2 47 47 3 2 47
4036 drop table t3;
4037 create table t3 (a3 int, b3 float unsigned, c3 int not null, d3 int not null,
4038 primary key(a3,b3)) engine = ndb
4039 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4040 Warnings:
4041 Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release.
4042 insert into t3 values (0x1f, 2.71, 1, 0x1f);
4043 insert into t3 values (0x2f, 3.00, 2, 0x2f);
4044 insert into t3 values (0x3f, 0.50, 3, 0x3f);
4045 explain
4046 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.0;
4047 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4048 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4049 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`b3` = 3)
4050 Warnings:
4051 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))
4052 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.0;
4053 a3 b3 c3 d3 a3 b3 c3 d3
4054 47 3 2 47 47 3 2 47
4055 drop table t3;
4056 create table t3 (a3 int, b3 double, c3 int not null, d3 int not null,
4057 primary key(a3,b3)) engine = ndb
4058 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4059 insert into t3 values (0x1f, 2.71, 1, 0x1f);
4060 insert into t3 values (0x2f, 3.14, 2, 0x2f);
4061 insert into t3 values (0x3f, 0.50, 3, 0x3f);
4062 explain
4063 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14;
4064 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4065 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4066 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 12 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
4067 Warnings:
4068 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))
4069 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14;
4070 a3 b3 c3 d3 a3 b3 c3 d3
4071 47 3.14 2 47 47 3.14 2 47
4072 drop table t3;
4073 create table t3 (a3 int, b3 double unsigned, c3 int not null, d3 int not null,
4074 primary key(a3,b3)) engine = ndb
4075 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4076 Warnings:
4077 Warning 1681 UNSIGNED for decimal and floating point data types is deprecated and support for it will be removed in a future release.
4078 insert into t3 values (0x1f, 2.71, 1, 0x1f);
4079 insert into t3 values (0x2f, 3.14, 2, 0x2f);
4080 insert into t3 values (0x3f, 0.50, 3, 0x3f);
4081 explain
4082 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14;
4083 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4084 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4085 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 12 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
4086 Warnings:
4087 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))
4088 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14;
4089 a3 b3 c3 d3 a3 b3 c3 d3
4090 47 3.14 2 47 47 3.14 2 47
4091 drop table t3;
4092 create table t3 (a3 int, b3 decimal, c3 int not null, d3 int not null,
4093 primary key(a3,b3)) engine = ndb
4094 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4095 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
4096 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
4097 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
4098 explain
4099 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=63;
4100 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4101 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4102 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 9 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
4103 Warnings:
4104 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))
4105 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=63;
4106 a3 b3 c3 d3 a3 b3 c3 d3
4107 47 63 2 47 47 63 2 47
4108 drop table t3;
4109 create table t3 (a3 int, b3 decimal(12,4), c3 int not null, d3 int not null,
4110 primary key(a3,b3)) engine = ndb
4111 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4112 insert into t3 values (0x1f, 2.71, 1, 0x1f);
4113 insert into t3 values (0x2f, 3.14, 2, 0x2f);
4114 insert into t3 values (0x3f, 0.50, 3, 0x3f);
4115 explain
4116 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14;
4117 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4118 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4119 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 10 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
4120 Warnings:
4121 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.1400) and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
4122 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3=3.14;
4123 a3 b3 c3 d3 a3 b3 c3 d3
4124 47 3.1400 2 47 47 3.1400 2 47
4125 drop table t3;
4126 create table t3 (a3 int, b3 date, c3 int not null, d3 int not null,
4127 primary key(a3,b3)) engine = ndb
4128 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4129 insert into t3 values (0x1f, '1905-05-17', 1, 0x1f);
4130 insert into t3 values (0x2f, '2000-02-28', 2, 0x2f);
4131 insert into t3 values (0x3f, '2000-02-29', 3, 0x3f);
4132 explain
4133 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='2000-02-28';
4134 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4135 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4136 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 7 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
4137 Warnings:
4138 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` = DATE'2000-02-28') and (`test`.`y`.`a3` = `test`.`x`.`d3`) and (`test`.`x`.`a3` = 0x2f))
4139 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='2000-02-28';
4140 a3 b3 c3 d3 a3 b3 c3 d3
4141 47 2000-02-28 2 47 47 2000-02-28 2 47
4142 drop table t3;
4143 create table t3 (a3 int, b3 char(16), c3 int not null, d3 int not null,
4144 primary key(a3,b3)) engine = ndb
4145 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4146 insert into t3 values (0x1f, 'Ole', 1, 0x1f);
4147 insert into t3 values (0x2f, 'Dole', 2, 0x2f);
4148 insert into t3 values (0x3f, 'Doffen', 2, 0x3f);
4149 explain
4150 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
4151 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4152 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4153 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 68 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`b3` = 'Dole')
4154 Warnings:
4155 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))
4156 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
4157 a3 b3 c3 d3 a3 b3 c3 d3
4158 47 Dole 2 47 47 Dole 2 47
4159 drop table t3;
4160 create table t3 (a3 int, b3 varchar(16), c3 int not null, d3 int not null,
4161 primary key(a3,b3)) engine = ndb
4162 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4163 insert into t3 values (0x1f, 'Ole', 1, 0x1f);
4164 insert into t3 values (0x2f, 'Dole', 2, 0x2f);
4165 insert into t3 values (0x3f, 'Doffen', 2, 0x3f);
4166 explain
4167 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
4168 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4169 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4170 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 70 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
4171 Warnings:
4172 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))
4173 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
4174 a3 b3 c3 d3 a3 b3 c3 d3
4175 47 Dole 2 47 47 Dole 2 47
4176 drop table t3;
4177 create table t3 (a3 int, b3 varchar(512), c3 int not null, d3 int not null,
4178 primary key(a3,b3)) engine = ndb
4179 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4180 insert into t3 values (0x1f, 'Ole', 1, 0x1f);
4181 insert into t3 values (0x2f, 'Dole', 2, 0x2f);
4182 insert into t3 values (0x3f, 'Doffen', 2, 0x3f);
4183 explain
4184 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
4185 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4186 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4187 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 2054 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1
4188 Warnings:
4189 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))
4190 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
4191 a3 b3 c3 d3 a3 b3 c3 d3
4192 47 Dole 2 47 47 Dole 2 47
4193 drop table t3;
4194 create table t3 (a3 int, b3 binary(16), c3 int not null, d3 int not null,
4195 primary key(a3,b3)) engine = ndb
4196 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4197 insert into t3 values (0x1f, 'Ole', 1, 0x1f);
4198 insert into t3 values (0x2f, 'Dole', 2, 0x2f);
4199 insert into t3 values (0x3f, 'Doffen', 2, 0x3f);
4200 explain
4201 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
4202 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4203 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4204 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 20 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using where
4205 Warnings:
4206 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))
4207 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
4208 a3 b3 c3 d3 a3 b3 c3 d3
4209 drop table t3;
4210 create table t3 (a3 int, b3 varbinary(16), c3 int not null, d3 int not null,
4211 primary key(a3,b3)) engine = ndb
4212 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4213 insert into t3 values (0x1f, 'Ole', 1, 0x1f);
4214 insert into t3 values (0x2f, 'Dole', 2, 0x2f);
4215 insert into t3 values (0x3f, 'Doffen', 2, 0x3f);
4216 explain
4217 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
4218 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4219 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 const 3 100.00 Parent of 2 pushed join@1
4220 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 22 test.x.d3,const 1 100.00 Child of 'x' in pushed join@1; Using where
4221 Warnings:
4222 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))
4223 select * from t3 x, t3 y where x.a3=0x2f and y.a3=x.d3 and y.b3='Dole';
4224 a3 b3 c3 d3 a3 b3 c3 d3
4225 47 Dole 2 47 47 Dole 2 47
4226 drop table t3;
4227 create table t3 (a3 int, b3 tinyint, c3 int not null, d3 int not null,
4228 primary key(a3,b3)) engine = ndb
4229 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4230 insert into t3 values (0x1f, 0x2f, 1, 0x1f);
4231 insert into t3 values (0x2f, 0x3f, 2, 0x2f);
4232 insert into t3 values (0x3f, 0x1f, 3, 0x3f);
4233 explain
4234 select * from t3 x, t3 y where y.a3=x.b3 and y.b3="63";
4235 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4236 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3 100.00 NULL
4237 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 5 test.x.b3,const 1 100.00 Using where
4238 Warnings:
4239 Note 1003 Can't push table 'y' as child, column 'a3' does not have same datatype as ref'ed column 'x.b3'
4240 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))
4241 select * from t3 x, t3 y where y.a3=x.b3 and y.b3="63";
4242 a3 b3 c3 d3 a3 b3 c3 d3
4243 31 47 1 31 47 63 2 47
4244 drop table t3;
4245 create table t3 (a3 varchar(16), b3 int, c3 int not null, d3 int not null,
4246 primary key(a3,b3)) engine = ndb
4247 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4248 insert into t3 values ('Ole', 0x1f, 1, 0x1f);
4249 insert into t3 values ('Dole', 0x2f, 2, 0x2f);
4250 insert into t3 values ('Doffen', 0x3f, 2, 0x3f);
4251 explain
4252 select * from t3 x, t3 y where x.a3='Dole' and x.b3=0x2f and y.a3=x.a3 and y.b3=x.d3;
4253 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4254 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 70 const,const 1 100.00 Parent of 2 pushed join@1
4255 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 70 const,test.x.d3 1 100.00 Child of 'x' in pushed join@1
4256 Warnings:
4257 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))
4258 select * from t3 x, t3 y where x.a3='Dole' and x.b3=0x2f and y.a3=x.a3 and y.b3=x.d3;
4259 a3 b3 c3 d3 a3 b3 c3 d3
4260 Dole 47 2 47 Dole 47 2 47
4261 explain
4262 select * from t3 x, t3 y where x.a3='Dole' and y.a3=x.a3 and y.b3=x.d3;
4263 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4264 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 66 const 3 100.00 Parent of 2 pushed join@1
4265 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 70 const,test.x.d3 1 100.00 Child of 'x' in pushed join@1
4266 Warnings:
4267 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'))
4268 select * from t3 x, t3 y where x.a3='Dole' and y.a3=x.a3 and y.b3=x.d3;
4269 a3 b3 c3 d3 a3 b3 c3 d3
4270 Dole 47 2 47 Dole 47 2 47
4271 drop table t3;
4272 create table t1 (k int primary key, b int) engine = ndb
4273 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4274 insert into t1 values (1,1), (2,1), (3,1), (4,1);
4275 explain
4276 select *
4277 from t1
4278 straight_join t1 as t2 on t2.k = t1.b+0
4279 straight_join t1 as t3 on t3.k = t2.b
4280 straight_join t1 as t4 on t4.k = t1.b;
4281 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4282 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`t1`.`b` is not null)
4283 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 func 1 100.00 Parent of 2 pushed join@2; Using pushed condition ((`test`.`t2`.`k` = (`test`.`t1`.`b` + 0)) and (`test`.`t2`.`b` is not null))
4284 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 Child of 't2' in pushed join@2
4285 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1
4286 Warnings:
4287 Note 1003 Can't push table 't2' as child, column 'k' does neither 'ref' a column nor a constant
4288 Note 1003 Can't push table 't3' as child of 't1', column 't2.b' refers a table which was not pushed
4289 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)))
4290 select *
4291 from t1
4292 straight_join t1 as t2 on t2.k = t1.b+0
4293 straight_join t1 as t3 on t3.k = t2.b
4294 straight_join t1 as t4 on t4.k = t1.b;
4295 k b k b k b k b
4296 1 1 1 1 1 1 1 1
4297 2 1 1 1 1 1 1 1
4298 3 1 1 1 1 1 1 1
4299 4 1 1 1 1 1 1 1
4300 explain
4301 select *
4302 from t1
4303 straight_join t1 as t2 on t2.k = t1.b+0
4304 straight_join t1 as t3 on t3.k = t2.b
4305 straight_join t1 as t4 on t4.k = t1.b
4306 where t2.k = 1;
4307 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4308 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 Parent of 2 pushed join@1; Using where; Using pushed condition (`test`.`t1`.`b` is not null)
4309 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Parent of 2 pushed join@2; Using pushed condition (`test`.`t2`.`b` is not null)
4310 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 Child of 't2' in pushed join@2
4311 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1
4312 Warnings:
4313 Note 1003 Can't push table 't2' as child of 't1', no parent-child dependency exists between these tables
4314 Note 1003 Can't push table 't3' as child of 't1', column 't2.b' refers a table which was not pushed
4315 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)))
4316 select *
4317 from t1
4318 straight_join t1 as t2 on t2.k = t1.b+0
4319 straight_join t1 as t3 on t3.k = t2.b
4320 straight_join t1 as t4 on t4.k = t1.b
4321 where t2.k = 1;
4322 k b k b k b k b
4323 1 1 1 1 1 1 1 1
4324 2 1 1 1 1 1 1 1
4325 3 1 1 1 1 1 1 1
4326 4 1 1 1 1 1 1 1
4327 drop table t1;
4328 set global debug='+d,max_64rows_in_spj_batches';
4329 create table t1 (
4330 a int not null auto_increment,
4331 b char(255) not null,
4332 c int not null,
4333 d char(255) not null,
4334 primary key (`a`,`b`)
4335 ) engine=ndbcluster
4336 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4337 explain
4338 select count(*)
4339 from t1
4340 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
4341 join t1 as t3 on t3.a = t2.c and t3.b = t2.d;
4342 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4343 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3000 100.00 Parent of 3 pushed join@1
4344 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 1024 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
4345 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 1024 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
4346 Warnings:
4347 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`))
4348 select count(*)
4349 from t1
4350 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
4351 join t1 as t3 on t3.a = t2.c and t3.b = t2.d;
4352 count(*)
4353 2996
4354 explain
4355 select count(*)
4356 from t1
4357 join t1 as t2 on t2.a = t1.c
4358 join t1 as t3 on t3.a = t2.c and t3.b = t2.d;
4359 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4360 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3000 100.00 Parent of 3 pushed join@1
4361 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.c 30 100.00 Child of 't1' in pushed join@1
4362 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 1024 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
4363 Warnings:
4364 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`))
4365 select count(*)
4366 from t1
4367 join t1 as t2 on t2.a = t1.c
4368 join t1 as t3 on t3.a = t2.c and t3.b = t2.d;
4369 count(*)
4370 8990
4371 explain
4372 select count(*)
4373 from t1
4374 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
4375 join t1 as t3 on t3.a = t2.c;
4376 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4377 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3000 100.00 Parent of 3 pushed join@1
4378 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 1024 test.t1.c,test.t1.d 1 100.00 Child of 't1' in pushed join@1
4379 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t2.c 30 100.00 Child of 't2' in pushed join@1
4380 Warnings:
4381 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`))
4382 select count(*)
4383 from t1
4384 join t1 as t2 on t2.a = t1.c and t2.b = t1.d
4385 join t1 as t3 on t3.a = t2.c;
4386 count(*)
4387 8988
4388 alter table t1 partition by key(a);
4389 explain
4390 select count(*)
4391 from t1
4392 join t1 as t2 on t2.a = t1.c
4393 join t1 as t3 on t3.a = t2.c and t3.b = t2.d;
4394 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4395 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3000 100.00 Parent of 3 pushed join@1
4396 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.c 30 100.00 Child of 't1' in pushed join@1
4397 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 1024 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
4398 Warnings:
4399 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`))
4400 select count(*)
4401 from t1
4402 join t1 as t2 on t2.a = t1.c
4403 join t1 as t3 on t3.a = t2.c and t3.b = t2.d;
4404 count(*)
4405 8990
4406 drop table t1;
4407 set global debug=@save_debug;
4408 create logfile group lg1
4409 add undofile 'undofile.dat'
4410 initial_size 1m
4411 undo_buffer_size = 1m
4412 engine=ndb;
4413 create tablespace ts1
4414 add datafile 'datafile.dat'
4415 use logfile group lg1
4416 initial_size 6m
4417 engine ndb;
4418 create table t1 (a int not null,
4419 b int not null storage disk,
4420 c int not null storage memory,
4421 primary key(a))
4422 tablespace ts1 storage disk engine = ndb
4423 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4424 insert into t1 values (10, 11, 11);
4425 insert into t1 values (11, 12, 12);
4426 insert into t1 values (12, 13, 13);
4427 create table t2 (a int not null,
4428 b int not null, primary key(a)) engine = ndb
4429 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4430 insert into t2 values (10, 11);
4431 insert into t2 values (11, 12);
4432 insert into t2 values (12, 13);
4433 explain select * from t1, t2 where t1.c = t2.a;
4434 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4435 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3 100.00 Parent of 2 pushed join@1
4436 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Child of 't1' in pushed join@1
4437 Warnings:
4438 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`)
4439 select * from t1, t2 where t1.c = t2.a;
4440 a b c a b
4441 10 11 11 11 12
4442 11 12 12 12 13
4443 explain select * from t1, t2 where t1.a=11 and t1.c = t2.a;
4444 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4445 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Parent of 2 pushed join@1
4446 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Child of 't1' in pushed join@1
4447 Warnings:
4448 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))
4449 select * from t1, t2 where t1.a=11 and t1.c = t2.a;
4450 a b c a b
4451 11 12 12 12 13
4452 explain select * from t2, t1 where t2.b = t1.a;
4453 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4454 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3 100.00 Parent of 2 pushed join@1
4455 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 Child of 't2' in pushed join@1
4456 Warnings:
4457 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`)
4458 select * from t2, t1 where t2.b = t1.a;
4459 a b a b c
4460 10 11 11 12 12
4461 11 12 12 13 13
4462 explain select * from t2, t1 where t2.a=11 and t2.b = t1.a;
4463 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4464 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Parent of 2 pushed join@1
4465 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 Child of 't2' in pushed join@1
4466 Warnings:
4467 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))
4468 select * from t2, t1 where t2.a=11 and t2.b = t1.a;
4469 a b a b c
4470 11 12 12 13 13
4471 explain select t1.a, t1.c, t2.a, t2.b from t1, t2 where t1.b = t2.a;
4472 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4473 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3 100.00 Parent of 2 pushed join@1
4474 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1
4475 Warnings:
4476 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`)
4477 select t1.a, t1.c, t2.a, t2.b from t1, t2 where t1.b = t2.a;
4478 a c a b
4479 10 11 11 12
4480 11 12 12 13
4481 explain select t1.a, t1.c, t2.a, t2.b from t1, t2 where t1.a=11 and t1.b = t2.a;
4482 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4483 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Parent of 2 pushed join@1
4484 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1
4485 Warnings:
4486 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))
4487 select t1.a, t1.c, t2.a, t2.b from t1, t2 where t1.a=11 and t1.b = t2.a;
4488 a c a b
4489 11 12 12 13
4490 drop table t1;
4491 drop table t2;
4492 alter tablespace ts1
4493 drop datafile 'datafile.dat';
4494 drop tablespace ts1;
4495 drop logfile group lg1
4496 engine ndb;
4497 create temporary table old_count
4498 select counter_name, sum(val) as val
4499 from ndbinfo.counters
4500 where block_name='DBSPJ'
4501 group by counter_name;
4502 create table t1 (a int not null,
4503 b int not null,
4504 c int not null,
4505 primary key(a))
4506 engine = ndb
4507 partition by key() partitions 8;
4508 insert into t1 values (1, 2, 2);
4509 insert into t1 values (2, 3, 3);
4510 insert into t1 values (3, 4, 4);
4511 select * from t1 t1, t1 t2 where t1.a = 2 and t2.a = t1.b;
4512 a b c a b c
4513 2 3 3 3 4 4
4514 select count(*) from t1 t1, t1 t2 where t2.a = t1.b;
4515 count(*)
4516 2
4517 select count(*) from t1 t1, t1 t2 where t1.a >= 2 and t2.a = t1.b;
4518 count(*)
4519 1
4520 create temporary table new_count
4521 select counter_name, sum(val) as val
4522 from ndbinfo.counters
4523 where block_name='DBSPJ'
4524 group by counter_name;
4525 select new_count.counter_name, new_count.val - old_count.val
4526 from new_count, old_count
4527 where new_count.counter_name = old_count.counter_name
4528 and new_count.counter_name <> 'LOCAL_READS_SENT'
4529 and new_count.counter_name <> 'REMOTE_READS_SENT';
4530 counter_name new_count.val - old_count.val
4531 CONST_PRUNED_RANGE_SCANS_RECEIVED 0
4532 LOCAL_RANGE_SCANS_SENT 8
4533 LOCAL_TABLE_SCANS_SENT 8
4534 PRUNED_RANGE_SCANS_RECEIVED 0
4535 RANGE_SCANS_RECEIVED 2
4536 READS_NOT_FOUND 2
4537 READS_RECEIVED 1
4538 REMOTE_RANGE_SCANS_SENT 0
4539 SCAN_BATCHES_RETURNED 4
4540 SCAN_ROWS_RETURNED 8
4541 TABLE_SCANS_RECEIVED 2
4542 select 'READS_SENT', sum(new_count.val - old_count.val)
4543 from new_count, old_count
4544 where new_count.counter_name = old_count.counter_name
4545 and (new_count.counter_name = 'LOCAL_READS_SENT'
4546 or new_count.counter_name = 'REMOTE_READS_SENT');
4547 READS_SENT sum(new_count.val - old_count.val)
4548 READS_SENT 7
4549 drop table old_count;
4550 drop table new_count;
4551 drop table t1;
4552 create table t1 (
4553 a int primary key,
4554 b int,
4555 c int) engine = ndb
4556 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4557 insert into t1 values (1, 2, 3);
4558 insert into t1 values (2, 3, 4);
4559 insert into t1 values (3, 4, 5);
4560 explain select * from t1 x, t1 y where x.b=y.a and x.c=4;
4561 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4562 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Parent of 2 pushed join@1; Using pushed condition ((`test`.`x`.`c` = 4) and (`test`.`x`.`b` is not null))
4563 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.b # # Child of 'x' in pushed join@1
4564 Warnings:
4565 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`))
4566 select * from t1 x, t1 y where x.b=y.a and x.c=4;
4567 a b c a b c
4568 2 3 4 3 4 5
4569 lookups
4570 1
4571 explain select * from t1 x, t1 y, t1 z where x.b=y.a and y.c=4 and y.b=z.a;
4572 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4573 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Parent of 3 pushed join@1; Using pushed condition (`test`.`x`.`b` is not null)
4574 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.b # # Child of 'x' in pushed join@1; Using pushed condition ((`test`.`y`.`c` = 4) and (`test`.`y`.`b` is not null))
4575 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.y.b # # Child of 'y' in pushed join@1
4576 Warnings:
4577 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`))
4578 select * from t1 x, t1 y, t1 z where x.b=y.a and y.c=4 and y.b=z.a;
4579 a b c a b c a b c
4580 1 2 3 2 3 4 3 4 5
4581 lookups
4582 5
4583 drop table t1;
4584 create table t1(
4585 a int not null,
4586 b int not null,
4587 c int not null,
4588 primary key(a,b))
4589 engine = ndb
4590 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM"
4591 partition by key (a);
4592 insert into t1 values (10, 10, 11);
4593 insert into t1 values (11, 11, 12);
4594 insert into t1 values (12, 12, 13);
4595 select * from t1 t1, t1 t2
4596 where t1.a = 10 and t1.b = 10 and
4597 t2.a = t1.c and t2.b = t1.c;
4598 a b c a b c
4599 10 10 11 11 11 12
4600 create temporary table server_counts
4601 select * from performance_schema.global_status
4602 where variable_name in
4603 ('Ndb_scan_count',
4604 'Ndb_pruned_scan_count',
4605 'Ndb_sorted_scan_count',
4606 'Ndb_pushed_queries_defined',
4607 'Ndb_pushed_queries_dropped',
4608 'Ndb_pushed_reads');
4609 select * from t1 t1, t1 t2
4610 where t1.a = 11 and t1.b = 11 and
4611 t2.a = t1.c and t2.b = t1.c;
4612 a b c a b c
4613 11 11 12 12 12 13
4614 select * from t1 t1, t1 t2
4615 where t2.a = t1.c and t2.b = t1.c
4616 order by t1.a;
4617 a b c a b c
4618 10 10 11 11 11 12
4619 11 11 12 12 12 13
4620 select count(*) from t1 t1, t1 t2
4621 where t1.a = 11 and
4622 t2.a = t1.c and t2.b = t1.c;
4623 count(*)
4624 1
4625 select new.variable_name, new.variable_value - old.variable_value
4626 from server_counts as old,
4627 performance_schema.global_status as new
4628 where new.variable_name = old.variable_name
4629 order by new.variable_name;
4630 variable_name new.variable_value - old.variable_value
4631 Ndb_pruned_scan_count 1
4632 Ndb_pushed_queries_defined 3
4633 Ndb_pushed_queries_dropped 0
4634 Ndb_pushed_reads 4
4635 Ndb_scan_count 2
4636 Ndb_sorted_scan_count 1
4637 drop table server_counts;
4638 drop table t1;
4639 create table t1(
4640 d int not null,
4641 c int not null,
4642 a int not null,
4643 b int not null,
4644 primary key using hash (a,b))
4645 engine = ndb
4646 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM"
4647 partition by key (a);
4648 insert into t1(a,b,c,d) values (10, 10, 11, 11);
4649 insert into t1(a,b,c,d) values (11, 11, 12, 12);
4650 insert into t1(a,b,c,d) values (12, 12, 13, 13);
4651 create index i1 on t1(c,a);
4652 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;
4653 count(*)
4654 1
4655 drop index i1 on t1;
4656 pruned_scan_count
4657 1
4658 create index i2 on t1(a,b);
4659 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;
4660 count(*)
4661 1
4662 pruned_scan_count
4663 1
4664 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;
4665 count(*)
4666 0
4667 pruned_scan_count
4668 1
4669 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;
4670 count(*)
4671 1
4672 pruned_scan_count
4673 0
4674 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;
4675 count(*)
4676 1
4677 pruned_scan_count
4678 0
4679 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;
4680 count(*)
4681 1
4682 pruned_scan_count
4683 1
4684 drop table t1;
4685 create table t2(
4686 d int not null,
4687 e int not null,
4688 f int not null,
4689 a int not null,
4690 b int not null,
4691 c int not null,
4692 primary key using hash (a,b,c))
4693 engine = ndb
4694 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM"
4695 partition by key (b,a);
4696 insert into t2(a,b,c,d,e,f) values (1, 2, 3, 1, 2, 3);
4697 insert into t2(a,b,c,d,e,f) values (1, 2, 4, 1, 2, 3);
4698 insert into t2(a,b,c,d,e,f) values (2, 3, 4, 1, 2, 3);
4699 insert into t2(a,b,c,d,e,f) values (3, 4, 5, 1, 2, 3);
4700 insert into t2(a,b,c,d,e,f) values (4, 5, 6, 1, 2, 3);
4701 insert into t2(a,b,c,d,e,f) values (5, 6, 7, 1, 2, 3);
4702 insert into t2(a,b,c,d,e,f) values (6, 7, 8, 1, 2, 3);
4703 insert into t2(a,b,c,d,e,f) values (7, 8, 9, 1, 2, 3);
4704 create index i2_1 on t2(d, a, b, e);
4705 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;
4706 count(*)
4707 2
4708 pruned_scan_count
4709 1
4710 drop index i2_1 on t2;
4711 create index i2_3 on t2(a, d, b, e);
4712 set optimizer_switch='condition_fanout_filter=off';
4713 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;
4714 count(*)
4715 2
4716 set optimizer_switch='condition_fanout_filter=default';
4717 pruned_scan_count
4718 1
4719 drop table t2;
4720 create table t1 (a binary(10) primary key, b binary(10) not null) engine = ndb
4721 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4722 insert into t1 values ('\0123456789', '1234567890');
4723 insert into t1 values ('1234567890', '\0123456789');
4724 explain
4725 select count(*)
4726 from t1 join t1 as t2 on t2.a = t1.b
4727 where t1.a = '\0123456789';
4728 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4729 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 10 const 1 100.00 Parent of 2 pushed join@1; Using where
4730 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 10 test.t1.b 1 100.00 Child of 't1' in pushed join@1
4731 Warnings:
4732 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'))
4733 select count(*)
4734 from t1 join t1 as t2 on t2.a = t1.b
4735 where t1.a = '\0123456789';
4736 count(*)
4737 1
4738 drop table t1;
4739 create table t1 (pk int primary key, a int unique key) engine = ndb
4740 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4741 insert into t1 values (1,10), (2,20), (3,30);
4742 set ndb_join_pushdown = false;
4743 explain
4744 select * from t1 as x right join t1 as y
4745 on x.pk = y.pk
4746 and x.pk = y.a
4747 and x.a = y.pk
4748 where y.pk = 2;
4749 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4750 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 const PRIMARY PRIMARY 4 const 1 100.00 NULL
4751 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 const PRIMARY,a PRIMARY 4 const 1 100.00 Impossible ON condition
4752 Warnings:
4753 Note 1003 /* select#1 */ select NULL AS `pk`,NULL AS `a`,'2' AS `pk`,'20' AS `a` from `test`.`t1` `y` left join `test`.`t1` `x` on((multiple equal(2, NULL, NULL))) where true
4754 select * from t1 as x right join t1 as y
4755 on x.pk = y.pk
4756 and x.pk = y.a
4757 and x.a = y.pk
4758 where y.pk = 2;
4759 pk a pk a
4760 NULL NULL 2 20
4761 set ndb_join_pushdown = true;
4762 explain
4763 select * from t1 as x right join t1 as y
4764 on x.pk = y.pk
4765 and x.pk = y.a
4766 and x.a = y.pk
4767 where y.pk = 2;
4768 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4769 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const 1 100.00 NULL
4770 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,a PRIMARY 4 const 1 100.00 Using where
4771 Warnings:
4772 Note 1003 Can't push table 'x' as child of 'y', no parent-child dependency exists between these tables
4773 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)
4774 select * from t1 as x right join t1 as y
4775 on x.pk = y.pk
4776 and x.pk = y.a
4777 and x.a = y.pk
4778 where y.pk = 2;
4779 pk a pk a
4780 NULL NULL 2 20
4781 drop table t1;
4782 create table t1 (pk int primary key, u int not null, a int, b int) engine=ndb
4783 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4784 create index ix1 on t1(b,a);
4785 insert into t1 values (0,1,10,20);
4786 insert into t1 values (1,2,20,30);
4787 insert into t1 values (2,3,30,40);
4788 explain select * from t1 as x join t1 as y join t1 as z on x.u=y.pk and y.a=z.b;
4789 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4790 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Parent of 3 pushed join@1
4791 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.u # # Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`a` is not null)
4792 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.y.a # # Child of 'y' in pushed join@1
4793 Warnings:
4794 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`))
4795 select * from t1 as x join t1 as y join t1 as z on x.u=y.pk and y.a=z.b;
4796 pk u a b pk u a b pk u a b
4797 0 1 10 20 1 2 20 30 0 1 10 20
4798 1 2 20 30 2 3 30 40 1 2 20 30
4799 drop table t1;
4800 create table t1 (pk int primary key, u int not null) engine=ndb
4801 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4802 insert into t1 values (0,-1), (1,-1), (2,-1), (3,-1), (4,-1), (5,-1), (6,-1),
4803 (7,-1), (8,-1), (9,-1), (10,-1), (11,-1), (12,-1), (13,-1), (14,-1), (15,-1),
4804 (16,-1), (17,-1), (18,-1), (19,-1), (20,-1), (21,-1), (22,-1), (23,-1),
4805 (24,-1), (25,-1), (26,-1), (27,-1), (28,-1), (29,-1), (30,-1), (31,-1),
4806 (32,-1), (33,-1), (34,-1), (35,-1), (36,-1), (37,-1), (38,-1), (39,-1),
4807 (40,-1), (41,-1), (42,-1), (43,-1), (44,-1), (45,-1), (46,-1), (47,-1),
4808 (48,-1), (49,-1), (50,-1), (51,-1), (52,-1), (53,-1), (54,-1), (55,-1),
4809 (56,-1), (57,-1), (58,-1), (59,-1), (60,-1), (61,-1), (62,-1), (63,-1),
4810 (64,-1), (65,-1), (66,-1), (67,-1), (68,-1), (69,-1), (70,-1), (71,-1),
4811 (72,-1), (73,-1), (74,-1), (75,-1), (76,-1), (77,-1), (78,-1), (79,-1),
4812 (80,-1), (81,-1), (82,-1), (83,-1), (84,-1), (85,-1), (86,-1), (87,-1),
4813 (88,-1), (89,-1), (90,-1), (91,-1), (92,-1), (93,-1), (94,-1), (95,-1),
4814 (96,-1), (97,-1), (98,-1), (99,-1), (100,-1), (101,-1), (102,-1), (103,-1),
4815 (104,-1), (105,-1), (106,-1), (107,-1), (108,-1), (109,-1), (110,-1),
4816 (111,-1), (112,-1), (113,-1), (114,-1), (115,-1), (116,-1), (117,-1),
4817 (118,-1), (119,-1), (120,-1), (121,-1), (122,-1), (123,-1), (124,-1),
4818 (125,-1), (126,-1), (127,-1), (128,-1), (129,-1), (130,-1), (131,-1),
4819 (132,-1), (133,-1), (134,-1), (135,-1), (136,-1), (137,-1), (138,-1), (139,-1);
4820 set global debug='+d,max_64rows_in_spj_batches';
4821 explain select * from t1 as x join t1 as y on x.u=y.pk order by(x.pk);
4822 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4823 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 index NULL PRIMARY 4 NULL 140 100.00 Parent of 2 pushed join@1
4824 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.u 1 100.00 Child of 'x' in pushed join@1
4825 Warnings:
4826 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`
4827 select * from t1 as x join t1 as y on x.u=y.pk order by(x.pk);
4828 pk u pk u
4829 set global debug=@save_debug;
4830 drop table t1;
4831 create table t1 (pk int primary key, u int not null, a int, b int) engine=ndb
4832 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
4833 create index ix1 on t1(b,a);
4834 create unique index ix2 on t1(u);
4835 insert into t1 values (0,0,10,10);
4836 insert into t1 values (1,1,10,10);
4837 insert into t1 values (2,2,10,10);
4838 insert into t1 values (3,3,10,10);
4839 insert into t1 values (4,4,10,10);
4840 insert into t1 values (5,5,10,10);
4841 insert into t1 values (6,6,10,10);
4842 insert into t1 values (7,7,10,10);
4843 insert into t1 values (8,8,10,10);
4844 insert into t1 values (9,9,10,10);
4845 insert into t1 values (10,10,10,10);
4846 insert into t1 values (11,11,10,10);
4847 explain select count(*) from t1 as x1 join t1 as x2 join t1 as x3
4848 on x1.a=x2.u and x2.a = x3.b;
4849 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4850 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 12 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`x1`.`a` is not null)
4851 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref ix2 ix2 4 test.x1.a 1 100.00 Child of 'x1' in pushed join@1; Using pushed condition (`test`.`x2`.`a` is not null)
4852 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x2.a 2 100.00 Child of 'x2' in pushed join@1
4853 Warnings:
4854 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`))
4855 select count(*) from t1 as x1 join t1 as x2 join t1 as x3
4856 on x1.a=x2.u and x2.a = x3.b;
4857 count(*)
4858 144
4859 explain select count(*) from t1 as x1, t1 as x2, t1 as x3
4860 where x1.u=x2.pk and x1.a=x3.b;
4861 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4862 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL ix2 NULL NULL NULL 12 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`x1`.`a` is not null)
4863 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x1.u 1 100.00 Child of 'x1' in pushed join@1
4864 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a 2 100.00 Child of 'x1' in pushed join@1
4865 Warnings:
4866 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`))
4867 select count(*) from t1 as x1, t1 as x2, t1 as x3
4868 where x1.u=x2.pk and x1.a=x3.b;
4869 count(*)
4870 144
4871 insert into t1 values (12,12,20,10);
4872 explain select count(*) from t1 as x1 left join t1 as x2 on x1.a=x2.b;
4873 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4874 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 2 pushed join@1
4875 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a 2 100.00 Child of 'x1' in pushed join@1
4876 Warnings:
4877 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` left join `test`.`t1` `x2` on((`test`.`x2`.`b` = `test`.`x1`.`a`)) where true
4878 select count(*) from t1 as x1 left join t1 as x2 on x1.a=x2.b;
4879 count(*)
4880 157
4881 set ndb_join_pushdown=off;
4882 select count(*) from t1 as x1 left join t1 as x2 on x1.a=x2.b;
4883 count(*)
4884 157
4885 set ndb_join_pushdown=on;
4886 explain select count(*) from t1 as x1
4887 left join t1 as x2 on x1.u=x2.pk
4888 left join t1 as x3 on x2.a=x3.b;
4889 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4890 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 3 pushed join@1
4891 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x1.u 1 100.00 Child of 'x1' in pushed join@1
4892 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x2.a 2 100.00 Child of 'x2' in pushed join@1
4893 Warnings:
4894 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` left join `test`.`t1` `x2` on((`test`.`x2`.`pk` = `test`.`x1`.`u`)) left join `test`.`t1` `x3` on((`test`.`x3`.`b` = `test`.`x2`.`a`)) where true
4895 select count(*) from t1 as x1
4896 left join t1 as x2 on x1.u=x2.pk
4897 left join t1 as x3 on x2.a=x3.b;
4898 count(*)
4899 157
4900 set ndb_join_pushdown=off;
4901 select count(*) from t1 as x1
4902 left join t1 as x2 on x1.u=x2.pk
4903 left join t1 as x3 on x2.a=x3.b;
4904 count(*)
4905 157
4906 set ndb_join_pushdown=on;
4907 explain select count(*) from t1 as x1
4908 left join t1 as x2 on x1.u=x2.pk
4909 left join t1 as x3 on x2.a=x3.b
4910 left join t1 as x4 on x3.u=x4.pk
4911 left join t1 as x5 on x4.a=x5.b;
4912 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4913 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 5 pushed join@1
4914 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x1.u 1 100.00 Child of 'x1' in pushed join@1
4915 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x2.a 2 100.00 Child of 'x2' in pushed join@1
4916 1 SIMPLE x4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x3.u 1 100.00 Child of 'x3' in pushed join@1
4917 1 SIMPLE x5 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x4.a 2 100.00 Child of 'x4' in pushed join@1
4918 Warnings:
4919 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` left join `test`.`t1` `x2` on((`test`.`x2`.`pk` = `test`.`x1`.`u`)) left join `test`.`t1` `x3` on((`test`.`x3`.`b` = `test`.`x2`.`a`)) left join `test`.`t1` `x4` on((`test`.`x4`.`pk` = `test`.`x3`.`u`)) left join `test`.`t1` `x5` on((`test`.`x5`.`b` = `test`.`x4`.`a`)) where true
4920 select count(*) from t1 as x1
4921 left join t1 as x2 on x1.u=x2.pk
4922 left join t1 as x3 on x2.a=x3.b
4923 left join t1 as x4 on x3.u=x4.pk
4924 left join t1 as x5 on x4.a=x5.b;
4925 count(*)
4926 1885
4927 set ndb_join_pushdown=off;
4928 select count(*) from t1 as x1
4929 left join t1 as x2 on x1.u=x2.pk
4930 left join t1 as x3 on x2.a=x3.b
4931 left join t1 as x4 on x3.u=x4.pk
4932 left join t1 as x5 on x4.a=x5.b;
4933 count(*)
4934 1885
4935 set ndb_join_pushdown=on;
4936 explain select count(*) from t1 as x1
4937 join t1 as x2 on x1.a=x2.b
4938 where x1.pk = 1 or x1.u=1;
4939 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4940 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 index_merge PRIMARY,ix2 ix2,PRIMARY 4,4 NULL 2 100.00 Using sort_union(ix2,PRIMARY); Using pushed condition (((`test`.`x1`.`pk` = 1) or (`test`.`x1`.`u` = 1)) and (`test`.`x1`.`a` is not null))
4941 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a 2 100.00 NULL
4942 Warnings:
4943 Note 1003 Push of table 'x2' as scan-child with lookup-root 'x1' not implemented
4944 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)))
4945 select count(*) from t1 as x1
4946 join t1 as x2 on x1.a=x2.b
4947 where x1.pk = 1 or x1.u=1;
4948 count(*)
4949 13
4950 set global debug='+d,max_4rows_in_spj_batches';
4951 set ndb_join_pushdown=on;
4952 explain
4953 select straight_join * from t1 as table1
4954 left join
4955 (t1 as table2 join t1 as table3 on table2.pk = table3.b)
4956 on table1.pk = table2.b;
4957 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4958 1 SIMPLE table1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 3 pushed join@1
4959 1 SIMPLE table2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY,ix1 ix1 5 test.table1.pk 2 100.00 Child of 'table1' in pushed join@1
4960 1 SIMPLE table3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.table2.pk 2 100.00 Child of 'table2' in pushed join@1
4961 Warnings:
4962 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`.`table3`.`b` = `test`.`table2`.`pk`) and (`test`.`table2`.`b` = `test`.`table1`.`pk`))) where true
4963 select straight_join * from t1 as table1
4964 left join
4965 (t1 as table2 join t1 as table3 on table2.pk = table3.b)
4966 on table1.pk = table2.b;
4967 pk u a b pk u a b pk u a b
4968 0 0 10 10 NULL NULL NULL NULL NULL NULL NULL NULL
4969 1 1 10 10 NULL NULL NULL NULL NULL NULL NULL NULL
4970 10 10 10 10 10 10 10 10 0 0 10 10
4971 10 10 10 10 10 10 10 10 1 1 10 10
4972 10 10 10 10 10 10 10 10 10 10 10 10
4973 10 10 10 10 10 10 10 10 11 11 10 10
4974 10 10 10 10 10 10 10 10 12 12 20 10
4975 10 10 10 10 10 10 10 10 2 2 10 10
4976 10 10 10 10 10 10 10 10 3 3 10 10
4977 10 10 10 10 10 10 10 10 4 4 10 10
4978 10 10 10 10 10 10 10 10 5 5 10 10
4979 10 10 10 10 10 10 10 10 6 6 10 10
4980 10 10 10 10 10 10 10 10 7 7 10 10
4981 10 10 10 10 10 10 10 10 8 8 10 10
4982 10 10 10 10 10 10 10 10 9 9 10 10
4983 11 11 10 10 NULL NULL NULL NULL NULL NULL NULL NULL
4984 12 12 20 10 NULL NULL NULL NULL NULL NULL NULL NULL
4985 2 2 10 10 NULL NULL NULL NULL NULL NULL NULL NULL
4986 3 3 10 10 NULL NULL NULL NULL NULL NULL NULL NULL
4987 4 4 10 10 NULL NULL NULL NULL NULL NULL NULL NULL
4988 5 5 10 10 NULL NULL NULL NULL NULL NULL NULL NULL
4989 6 6 10 10 NULL NULL NULL NULL NULL NULL NULL NULL
4990 7 7 10 10 NULL NULL NULL NULL NULL NULL NULL NULL
4991 8 8 10 10 NULL NULL NULL NULL NULL NULL NULL NULL
4992 9 9 10 10 NULL NULL NULL NULL NULL NULL NULL NULL
4993 set global debug=@save_debug;
4994 explain select straight_join * from t1 as x1
4995 inner join t1 as x2 on x2.b = x1.a;
4996 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4997 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x1`.`a` is not null)
4998 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a 2 100.00 Child of 'x1' in pushed join@1
4999 Warnings:
5000 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`)
5001 explain select straight_join * from t1 as x1
5002 left join t1 as x2 on x2.b = x1.a;
5003 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5004 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 2 pushed join@1
5005 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a 2 100.00 Child of 'x1' in pushed join@1
5006 Warnings:
5007 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 true
5008 explain select straight_join * from t1 as x1
5009 right join t1 as x2 on x2.b = x1.a;
5010 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5011 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 NULL
5012 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Using where; Using join buffer (hash join)
5013 Warnings:
5014 Note 1003 Can't push table 'x1' as child, 'type' must be a 'ref' access
5015 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`.`x1`.`a` = `test`.`x2`.`b`)) where true
5016 explain select straight_join * from
5017 t1 as x1 inner join
5018 (t1 as x2 inner join t1 as x3 on x3.b = x2.a)
5019 on x2.pk = x1.a;
5020 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5021 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`x1`.`a` is not null)
5022 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x1.a 1 100.00 Child of 'x1' in pushed join@1; Using pushed condition (`test`.`x2`.`a` is not null)
5023 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x2.a 2 100.00 Child of 'x2' in pushed join@1
5024 Warnings:
5025 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`))
5026 explain select straight_join * from
5027 t1 as x1 left join
5028 (t1 as x2 inner join t1 as x3 on x3.b = x2.a)
5029 on x2.pk = x1.a;
5030 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5031 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 3 pushed join@1
5032 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x1.a 1 100.00 Child of 'x1' in pushed join@1
5033 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x2.a 2 100.00 Child of 'x2' in pushed join@1
5034 Warnings:
5035 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`.`x3`.`b` = `test`.`x2`.`a`) and (`test`.`x2`.`pk` = `test`.`x1`.`a`))) where true
5036 explain select straight_join count(*) from t1 as x1
5037 join t1 as x2 on x2.b = x1.a
5038 join t1 as x3 on x3.b = x1.b;
5039 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5040 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL ix1 NULL NULL NULL 13 100.00 Parent of 3 pushed join@1; Using pushed condition ((`test`.`x1`.`a` is not null) and (`test`.`x1`.`b` is not null))
5041 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a 2 100.00 Child of 'x1' in pushed join@1
5042 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.b 2 100.00 Child of 'x1' in pushed join@1
5043 Warnings:
5044 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`))
5045 set ndb_join_pushdown=off;
5046 select straight_join count(*) from t1 as x1
5047 join t1 as x2 on x2.b = x1.a
5048 join t1 as x3 on x3.b = x1.b;
5049 count(*)
5050 2028
5051 set ndb_join_pushdown=on;
5052 select straight_join count(*) from t1 as x1
5053 join t1 as x2 on x2.b = x1.a
5054 join t1 as x3 on x3.b = x1.b;
5055 count(*)
5056 2028
5057 explain select straight_join count(*) from t1 as x1
5058 join t1 as x2 on x2.b = x1.a
5059 join t1 as x3 on x3.b = x1.a
5060 join t1 as x4 on x4.b = x1.a
5061 join t1 as x5 on x5.b = x1.a
5062 join t1 as x6 on x6.b = x1.a
5063 join t1 as x7 on x7.b = x1.a
5064 where x3.a < x2.pk and x4.a < x3.pk;
5065 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5066 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Parent of 7 pushed join@1; Using pushed condition (`test`.`x1`.`a` is not null)
5067 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY,ix1 ix1 5 test.x1.a # # Child of 'x1' in pushed join@1
5068 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY,ix1 ix1 5 test.x1.a # # Child of 'x2' in pushed join@1; Using pushed condition (`test`.`x3`.`a` < `test`.`x2`.`pk`)
5069 1 SIMPLE x4 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a # # Child of 'x3' in pushed join@1; Using pushed condition (`test`.`x4`.`a` < `test`.`x3`.`pk`)
5070 1 SIMPLE x5 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a # # Child of 'x1' in pushed join@1
5071 1 SIMPLE x6 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a # # Child of 'x1' in pushed join@1
5072 1 SIMPLE x7 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a # # Child of 'x1' in pushed join@1
5073 Warnings:
5074 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`))
5075 set global debug='+d,max_64rows_in_spj_batches';
5076 select straight_join count(*) from t1 as x1
5077 join t1 as x2 on x2.b = x1.a
5078 join t1 as x3 on x3.b = x1.a
5079 join t1 as x4 on x4.b = x1.a
5080 join t1 as x5 on x5.b = x1.a
5081 join t1 as x6 on x6.b = x1.a
5082 join t1 as x7 on x7.b = x1.a
5083 where x3.a < x2.pk and x4.a < x3.pk;
5084 count(*)
5085 632736
5086 set global debug=@save_debug;
5087 explain select straight_join count(*) from t1 as x1
5088 left join t1 as x2 on x2.b = x1.a
5089 join t1 as x3 on x3.b = x1.b;
5090 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5091 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL ix1 NULL NULL NULL 13 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`x1`.`b` is not null)
5092 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a 2 100.00 Child of 'x1' in pushed join@1
5093 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.b 2 100.00 Child of 'x1' in pushed join@1
5094 Warnings:
5095 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`)
5096 set ndb_join_pushdown=off;
5097 select straight_join count(*) from t1 as x1
5098 left join t1 as x2 on x2.b = x1.a
5099 join t1 as x3 on x3.b = x1.b;
5100 count(*)
5101 2041
5102 set ndb_join_pushdown=on;
5103 select straight_join count(*) from t1 as x1
5104 left join t1 as x2 on x2.b = x1.a
5105 join t1 as x3 on x3.b = x1.b;
5106 count(*)
5107 2041
5108 explain select straight_join count(*) from t1 as x1
5109 join t1 as x2 on x2.b = x1.a
5110 left join t1 as x3 on x3.b = x1.b;
5111 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5112 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`x1`.`a` is not null)
5113 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a 2 100.00 Child of 'x1' in pushed join@1
5114 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.b 2 100.00 Child of 'x1' in pushed join@1
5115 Warnings:
5116 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`)
5117 set ndb_join_pushdown=off;
5118 select straight_join count(*) from t1 as x1
5119 join t1 as x2 on x2.b = x1.a
5120 left join t1 as x3 on x3.b = x1.b;
5121 count(*)
5122 2028
5123 set ndb_join_pushdown=on;
5124 select straight_join count(*) from t1 as x1
5125 join t1 as x2 on x2.b = x1.a
5126 left join t1 as x3 on x3.b = x1.b;
5127 count(*)
5128 2028
5129 explain
5130 select straight_join count(*) from t1 as x1
5131 join t1 as x2 on x2.b = x1.a
5132 join t1 as x3 on x3.pk = x1.a join t1 as x4 on x4.b = x3.a;
5133 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5134 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 4 pushed join@1; Using pushed condition (`test`.`x1`.`a` is not null)
5135 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a 2 100.00 Child of 'x1' in pushed join@1
5136 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x1.a 1 100.00 Child of 'x1' in pushed join@1; Using pushed condition (`test`.`x3`.`a` is not null)
5137 1 SIMPLE x4 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x3.a 2 100.00 Child of 'x3' in pushed join@1
5138 Warnings:
5139 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`))
5140 set ndb_join_pushdown=off;
5141 select straight_join count(*) from t1 as x1
5142 join t1 as x2 on x2.b = x1.a
5143 join t1 as x3 on x3.pk = x1.a join t1 as x4 on x4.b = x3.a;
5144 count(*)
5145 2028
5146 set ndb_join_pushdown=on;
5147 select straight_join count(*) from t1 as x1
5148 join t1 as x2 on x2.b = x1.a
5149 join t1 as x3 on x3.pk = x1.a join t1 as x4 on x4.b = x3.a;
5150 count(*)
5151 2028
5152 explain select straight_join count(*) from t1 as x1
5153 left join t1 as x3 on x3.b = x1.a
5154 join t1 as x2 on x2.pk = x1.a;
5155 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5156 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`x1`.`a` is not null)
5157 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a 2 100.00 Child of 'x1' in pushed join@1
5158 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x1.a 1 100.00 Child of 'x1' in pushed join@1
5159 Warnings:
5160 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`)) join `test`.`t1` `x2` where (`test`.`x2`.`pk` = `test`.`x1`.`a`)
5161 select straight_join count(*) from t1 as x1
5162 left join t1 as x3 on x3.b = x1.a
5163 join t1 as x2 on x2.pk = x1.a;
5164 count(*)
5165 156
5166 update t1 set b=b+10;
5167 select straight_join count(*) from t1 as x1
5168 left join t1 as x3 on x3.b = x1.a
5169 join t1 as x2 on x2.pk = x1.a;
5170 count(*)
5171 12
5172 update t1 set b=b-10;
5173 update t1 set u=u+100;
5174 set ndb_join_pushdown=on;
5175 set global debug='+d,max_64rows_in_spj_batches';
5176 explain select straight_join count(*) from
5177 (t1 as x join t1 as y on y.b = x.a)
5178 left outer join t1 as z on z.u = x.a;
5179 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5180 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`x`.`a` is not null)
5181 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x.a 2 100.00 Child of 'x' in pushed join@1
5182 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 eq_ref ix2 ix2 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5183 Warnings:
5184 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`.`z`.`u` = `test`.`x`.`a`)) where (`test`.`y`.`b` = `test`.`x`.`a`)
5185 select straight_join count(*) from
5186 (t1 as x join t1 as y on y.b = x.a)
5187 left outer join t1 as z on z.u = x.a;
5188 count(*)
5189 156
5190 set global debug=@save_debug;
5191 update t1 set u=u-100;
5192 update t1 set a=a+pk;
5193 set ndb_join_pushdown=on;
5194 explain
5195 select straight_join count(*) from t1 as x
5196 left join t1 as y on y.pk = x.a
5197 join t1 as z on z.b = x.b;
5198 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5199 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL ix1 NULL NULL NULL 13 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`x`.`b` is not null)
5200 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5201 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x.b 2 100.00 Child of 'x' in pushed join@1
5202 Warnings:
5203 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x` left join `test`.`t1` `y` on((`test`.`y`.`pk` = `test`.`x`.`a`)) join `test`.`t1` `z` where (`test`.`z`.`b` = `test`.`x`.`b`)
5204 select straight_join count(*) from t1 as x
5205 left join t1 as y on y.pk = x.a
5206 join t1 as z on z.b = x.b;
5207 count(*)
5208 169
5209 explain
5210 select straight_join count(*) from t1 as x
5211 left join t1 as y1 on y1.pk = x.a
5212 left join t1 as y2 on y2.pk = x.a
5213 join t1 as z on z.b = x.b;
5214 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5215 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL ix1 NULL NULL NULL 13 100.00 Parent of 4 pushed join@1; Using pushed condition (`test`.`x`.`b` is not null)
5216 1 SIMPLE y1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5217 1 SIMPLE y2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5218 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x.b 2 100.00 Child of 'x' in pushed join@1
5219 Warnings:
5220 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x` left join `test`.`t1` `y1` on((`test`.`y1`.`pk` = `test`.`x`.`a`)) left join `test`.`t1` `y2` on((`test`.`y2`.`pk` = `test`.`x`.`a`)) join `test`.`t1` `z` where (`test`.`z`.`b` = `test`.`x`.`b`)
5221 select straight_join count(*) from t1 as x
5222 left join t1 as y1 on y1.pk = x.a
5223 left join t1 as y2 on y2.pk = x.a
5224 join t1 as z on z.b = x.b;
5225 count(*)
5226 169
5227 explain
5228 select straight_join count(*) from t1 as x
5229 join t1 as y1 on y1.pk = x.a
5230 left join t1 as y2 on y2.pk = x.a
5231 join t1 as z on z.b = x.b;
5232 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5233 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL ix1 NULL NULL NULL 13 100.00 Parent of 4 pushed join@1; Using pushed condition ((`test`.`x`.`a` is not null) and (`test`.`x`.`b` is not null))
5234 1 SIMPLE y1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5235 1 SIMPLE y2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5236 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x.b 2 100.00 Child of 'x' in pushed join@1
5237 Warnings:
5238 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x` join `test`.`t1` `y1` left join `test`.`t1` `y2` on((`test`.`y2`.`pk` = `test`.`x`.`a`)) join `test`.`t1` `z` where ((`test`.`y1`.`pk` = `test`.`x`.`a`) and (`test`.`z`.`b` = `test`.`x`.`b`))
5239 select straight_join count(*) from t1 as x
5240 join t1 as y1 on y1.pk = x.a
5241 left join t1 as y2 on y2.pk = x.a
5242 join t1 as z on z.b = x.b;
5243 count(*)
5244 39
5245 explain
5246 select straight_join count(*) from t1 as x
5247 left join t1 as y1 on y1.pk = x.a
5248 join t1 as y2 on y2.pk = x.a
5249 join t1 as z on z.b = x.b;
5250 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5251 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL ix1 NULL NULL NULL 13 100.00 Parent of 4 pushed join@1; Using pushed condition ((`test`.`x`.`a` is not null) and (`test`.`x`.`b` is not null))
5252 1 SIMPLE y1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5253 1 SIMPLE y2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5254 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x.b 2 100.00 Child of 'x' in pushed join@1
5255 Warnings:
5256 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x` left join `test`.`t1` `y1` on((`test`.`y1`.`pk` = `test`.`x`.`a`)) join `test`.`t1` `y2` join `test`.`t1` `z` where ((`test`.`y2`.`pk` = `test`.`x`.`a`) and (`test`.`z`.`b` = `test`.`x`.`b`))
5257 select straight_join count(*) from t1 as x
5258 left join t1 as y1 on y1.pk = x.a
5259 join t1 as y2 on y2.pk = x.a
5260 join t1 as z on z.b = x.b;
5261 count(*)
5262 39
5263 explain
5264 select straight_join count(*) from t1 as x
5265 left join (t1 as y join t1 as yy on yy.pk=y.u) on y.pk = x.a
5266 join t1 as z on z.b = x.b;
5267 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5268 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL ix1 NULL NULL NULL 13 100.00 Parent of 4 pushed join@1; Using pushed condition (`test`.`x`.`b` is not null)
5269 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,ix2 PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5270 1 SIMPLE yy p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.y.u 1 100.00 Child of 'y' in pushed join@1
5271 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x.b 2 100.00 Child of 'x' in pushed join@1
5272 Warnings:
5273 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x` left join (`test`.`t1` `y` join `test`.`t1` `yy`) on(((`test`.`yy`.`pk` = `test`.`y`.`u`) and (`test`.`y`.`pk` = `test`.`x`.`a`))) join `test`.`t1` `z` where (`test`.`z`.`b` = `test`.`x`.`b`)
5274 select straight_join count(*) from t1 as x
5275 left join (t1 as y join t1 as yy on yy.pk=y.u) on y.pk = x.a
5276 join t1 as z on z.b = x.b;
5277 count(*)
5278 169
5279 explain
5280 select straight_join count(*) from t1 as x
5281 join t1 as z on z.b = x.b
5282 left join t1 as y on y.pk = x.a;
5283 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5284 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL ix1 NULL NULL NULL 13 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`x`.`b` is not null)
5285 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x.b 2 100.00 Child of 'x' in pushed join@1
5286 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5287 Warnings:
5288 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x` join `test`.`t1` `z` left join `test`.`t1` `y` on((`test`.`y`.`pk` = `test`.`x`.`a`)) where (`test`.`z`.`b` = `test`.`x`.`b`)
5289 select straight_join count(*) from t1 as x
5290 join t1 as z on z.b = x.b
5291 left join t1 as y on y.pk = x.a;
5292 count(*)
5293 169
5294 explain
5295 select straight_join count(*) from t1 as x
5296 left join t1 as y1 on y1.pk = x.a
5297 left join t1 as y2 on y2.pk = x.a
5298 left join t1 as y3 on y3.pk = x.a;
5299 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5300 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 4 pushed join@1
5301 1 SIMPLE y1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5302 1 SIMPLE y2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5303 1 SIMPLE y3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5304 Warnings:
5305 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x` left join `test`.`t1` `y1` on((`test`.`y1`.`pk` = `test`.`x`.`a`)) left join `test`.`t1` `y2` on((`test`.`y2`.`pk` = `test`.`x`.`a`)) left join `test`.`t1` `y3` on((`test`.`y3`.`pk` = `test`.`x`.`a`)) where true
5306 select straight_join count(*) from t1 as x
5307 left join t1 as y1 on y1.pk = x.a
5308 left join t1 as y2 on y2.pk = x.a
5309 left join t1 as y3 on y3.pk = x.a;
5310 count(*)
5311 13
5312 explain
5313 select straight_join count(*) from t1 as x
5314 left join t1 as y on y.pk = x.a
5315 left join t1 as z on z.pk = x.a
5316 left join t1 as y1 on y1.pk = y.b;
5317 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5318 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 4 pushed join@1
5319 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5320 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5321 1 SIMPLE y1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.y.b 1 100.00 Child of 'y' in pushed join@1
5322 Warnings:
5323 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x` left join `test`.`t1` `y` on((`test`.`y`.`pk` = `test`.`x`.`a`)) left join `test`.`t1` `z` on((`test`.`z`.`pk` = `test`.`x`.`a`)) left join `test`.`t1` `y1` on((`test`.`y1`.`pk` = `test`.`y`.`b`)) where true
5324 select straight_join count(*) from t1 as x
5325 left join t1 as y on y.pk = x.a
5326 left join t1 as z on z.pk = x.a
5327 left join t1 as y1 on y1.pk = y.b;
5328 count(*)
5329 13
5330 explain
5331 select straight_join count(*) from t1 as x
5332 join t1 as y on y.pk = x.a
5333 left join t1 as y1 on y1.pk = y.b
5334 left join t1 as z on z.pk = x.b;
5335 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5336 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 Parent of 4 pushed join@1; Using pushed condition (`test`.`x`.`a` is not null)
5337 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5338 1 SIMPLE y1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.y.b 1 100.00 Child of 'y' in pushed join@1
5339 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.b 1 100.00 Child of 'x' in pushed join@1
5340 Warnings:
5341 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x` join `test`.`t1` `y` left join `test`.`t1` `y1` on((`test`.`y1`.`pk` = `test`.`y`.`b`)) left join `test`.`t1` `z` on((`test`.`z`.`pk` = `test`.`x`.`b`)) where (`test`.`y`.`pk` = `test`.`x`.`a`)
5342 select straight_join count(*) from t1 as x
5343 join t1 as y on y.pk = x.a
5344 left join t1 as y1 on y1.pk = y.b
5345 left join t1 as z on z.pk = x.b;
5346 count(*)
5347 3
5348 explain
5349 select straight_join count(*) from t1 as x
5350 left join t1 as y1 on y1.pk = x.a
5351 join t1 as y2 on y2.pk = x.b
5352 join t1 as z on z.b = y2.b;
5353 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5354 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL ix1 NULL NULL NULL 13 100.00 Parent of 4 pushed join@1; Using pushed condition (`test`.`x`.`b` is not null)
5355 1 SIMPLE y1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.a 1 100.00 Child of 'x' in pushed join@1
5356 1 SIMPLE y2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,ix1 PRIMARY 4 test.x.b 1 100.00 Child of 'x' in pushed join@1; Using pushed condition (`test`.`y2`.`b` is not null)
5357 1 SIMPLE z p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.y2.b 2 100.00 Child of 'y2' in pushed join@1
5358 Warnings:
5359 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x` left join `test`.`t1` `y1` on((`test`.`y1`.`pk` = `test`.`x`.`a`)) join `test`.`t1` `y2` join `test`.`t1` `z` where ((`test`.`y2`.`pk` = `test`.`x`.`b`) and (`test`.`z`.`b` = `test`.`y2`.`b`))
5360 select straight_join count(*) from t1 as x
5361 left join t1 as y1 on y1.pk = x.a
5362 join t1 as y2 on y2.pk = x.b
5363 join t1 as z on z.b = y2.b;
5364 count(*)
5365 169
5366 update t1 set a=a-pk;
5367 drop index ix2 on t1;
5368 create unique index ix2 on t1(a,u);
5369 set ndb_join_pushdown=on;
5370 explain
5371 select straight_join * from
5372 t1 as table1 join
5373 (t1 as table2 join t1 as table3 on table3.a = table2.a)
5374 on table3.u = table1.u
5375 where table2.pk = 3;
5376 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5377 1 SIMPLE table1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 13 100.00 NULL
5378 1 SIMPLE table2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,ix2 PRIMARY 4 const 1 100.00 Using where
5379 1 SIMPLE table3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref ix2 ix2 9 test.table2.a,test.table1.u 1 100.00 NULL
5380 Warnings:
5381 Note 1003 Can't push table 'table2' as child of 'table1', no parent-child dependency exists between these tables
5382 Note 1003 Can't push table 'table3' as child of 'table1', column 'table2.a' refers a table which was not pushed
5383 Note 1003 Can't push table 'table3' as child of 'table2', since it referes to column 'table1.u' prior to a potential 'const' root.
5384 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))
5385 select straight_join * from
5386 t1 as table1 join
5387 (t1 as table2 join t1 as table3 on table3.a = table2.a)
5388 on table3.u = table1.u
5389 where table2.pk = 3;
5390 pk u a b pk u a b pk u a b
5391 0 0 10 10 3 3 10 10 0 0 10 10
5392 1 1 10 10 3 3 10 10 1 1 10 10
5393 10 10 10 10 3 3 10 10 10 10 10 10
5394 11 11 10 10 3 3 10 10 11 11 10 10
5395 2 2 10 10 3 3 10 10 2 2 10 10
5396 3 3 10 10 3 3 10 10 3 3 10 10
5397 4 4 10 10 3 3 10 10 4 4 10 10
5398 5 5 10 10 3 3 10 10 5 5 10 10
5399 6 6 10 10 3 3 10 10 6 6 10 10
5400 7 7 10 10 3 3 10 10 7 7 10 10
5401 8 8 10 10 3 3 10 10 8 8 10 10
5402 9 9 10 10 3 3 10 10 9 9 10 10
5403 drop table t1;
5404 CREATE TABLE t1 (
5405 a int NOT NULL,
5406 b int NOT NULL,
5407 c int NOT NULL,
5408 d int NOT NULL,
5409 PRIMARY KEY (`a`,`b`)
5410 ) ENGINE=ndbcluster
5411 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5412 insert into t1 values (1,1,1,1), (1,2,1,1), (1,3,1,1), (1,4,1,2);
5413 CREATE TABLE t2 (
5414 a int NOT NULL,
5415 PRIMARY KEY (`a`)
5416 ) ENGINE=ndbcluster
5417 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5418 CREATE TABLE t3 (
5419 a int NOT NULL,
5420 b int NOT NULL,
5421 PRIMARY KEY (`a`,`b`)
5422 ) ENGINE=ndbcluster
5423 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5424 insert into t2 values (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
5425 insert into t3 select 1, x1.a * 10+x2.a from t2 as x1 cross join t2 as x2;
5426 set global debug='+d,max_64rows_in_spj_batches';
5427 explain select straight_join count(*) from t1 as x0
5428 join t3 as x1 on x1.a=x0.c
5429 join t1 as x2 on x2.a=x0.d
5430 join t3 as x3 on x3.a=x2.c
5431 join t1 as x4 on x4.a=x0.d and x4.b=x3.b;
5432 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5433 1 SIMPLE x0 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 Parent of 5 pushed join@1
5434 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x0.c 1 100.00 Child of 'x0' in pushed join@1
5435 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x0.d 1 100.00 Child of 'x0' in pushed join@1
5436 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x2.c 1 100.00 Child of 'x2' in pushed join@1
5437 1 SIMPLE x4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.x0.d,test.x3.b 1 100.00 Child of 'x3' in pushed join@1
5438 Warnings:
5439 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x0` join `test`.`t3` `x1` join `test`.`t1` `x2` join `test`.`t3` `x3` join `test`.`t1` `x4` where ((`test`.`x1`.`a` = `test`.`x0`.`c`) and (`test`.`x3`.`a` = `test`.`x2`.`c`) and (`test`.`x4`.`b` = `test`.`x3`.`b`) and (`test`.`x2`.`a` = `test`.`x0`.`d`) and (`test`.`x4`.`a` = `test`.`x0`.`d`))
5440 select straight_join count(*) from t1 as x0
5441 join t3 as x1 on x1.a=x0.c
5442 join t1 as x2 on x2.a=x0.d
5443 join t3 as x3 on x3.a=x2.c
5444 join t1 as x4 on x4.a=x0.d and x4.b=x3.b;
5445 count(*)
5446 4800
5447 explain select straight_join count(*) from t1 as x1
5448 join t1 as x2 on x1.c=x2.a and x2.d=2
5449 join t3 as x3 on x1.d=x3.a;
5450 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5451 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Parent of 3 pushed join@1
5452 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x1.c # # Child of 'x1' in pushed join@1; Using pushed condition (`test`.`x2`.`d` = 2)
5453 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x1.d # # Child of 'x1' in pushed join@1
5454 Warnings:
5455 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t3` `x3` where ((`test`.`x2`.`d` = 2) and (`test`.`x2`.`a` = `test`.`x1`.`c`) and (`test`.`x3`.`a` = `test`.`x1`.`d`))
5456 select straight_join count(*) from t1 as x1
5457 join t1 as x2 on x1.c=x2.a and x2.d=2
5458 join t3 as x3 on x1.d=x3.a;
5459 count(*)
5460 300
5461 set global debug=@save_debug;
5462 drop table t1;
5463 drop table t2;
5464 drop table t3;
5465 create table t1(
5466 d int not null,
5467 e int null,
5468 f int null,
5469 a int not null,
5470 b int not null,
5471 c int not null,
5472 primary key (a,b,c))
5473 engine = ndb partition by key (b) partitions 8;
5474 insert into t1(a,b,c,d,e,f) values
5475 (1, 2, 3, 1, 2, 3),
5476 (1, 2, 4, 1, 2, 3),
5477 (2, 3, 4, 1, 2, 3),
5478 (3, 4, 5, 1, 2, 3),
5479 (4, 5, 6, 1, 2, 3),
5480 (5, 6, 7, 1, 2, 3),
5481 (6, 7, 8, 1, 2, 3),
5482 (7, 8, 9, 1, 2, 3);
5483 set ndb_join_pushdown=on;
5484 explain
5485 select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
5486 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5487 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`e` is not null)
5488 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 8 test.x.d,test.x.e # # Child of 'x' in pushed join@1
5489 Warnings:
5490 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`))
5491 select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
5492 d e f a b c d e f a b c
5493 1 2 3 1 2 3 1 2 3 1 2 3
5494 1 2 3 1 2 3 1 2 3 1 2 4
5495 1 2 3 1 2 4 1 2 3 1 2 3
5496 1 2 3 1 2 4 1 2 3 1 2 4
5497 1 2 3 2 3 4 1 2 3 1 2 3
5498 1 2 3 2 3 4 1 2 3 1 2 4
5499 1 2 3 3 4 5 1 2 3 1 2 3
5500 1 2 3 3 4 5 1 2 3 1 2 4
5501 1 2 3 4 5 6 1 2 3 1 2 3
5502 1 2 3 4 5 6 1 2 3 1 2 4
5503 1 2 3 5 6 7 1 2 3 1 2 3
5504 1 2 3 5 6 7 1 2 3 1 2 4
5505 1 2 3 6 7 8 1 2 3 1 2 3
5506 1 2 3 6 7 8 1 2 3 1 2 4
5507 1 2 3 7 8 9 1 2 3 1 2 3
5508 1 2 3 7 8 9 1 2 3 1 2 4
5509 alter table t1 partition by key (a) partitions 8;
5510 select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
5511 d e f a b c d e f a b c
5512 1 2 3 1 2 3 1 2 3 1 2 3
5513 1 2 3 1 2 3 1 2 3 1 2 4
5514 1 2 3 1 2 4 1 2 3 1 2 3
5515 1 2 3 1 2 4 1 2 3 1 2 4
5516 1 2 3 2 3 4 1 2 3 1 2 3
5517 1 2 3 2 3 4 1 2 3 1 2 4
5518 1 2 3 3 4 5 1 2 3 1 2 3
5519 1 2 3 3 4 5 1 2 3 1 2 4
5520 1 2 3 4 5 6 1 2 3 1 2 3
5521 1 2 3 4 5 6 1 2 3 1 2 4
5522 1 2 3 5 6 7 1 2 3 1 2 3
5523 1 2 3 5 6 7 1 2 3 1 2 4
5524 1 2 3 6 7 8 1 2 3 1 2 3
5525 1 2 3 6 7 8 1 2 3 1 2 4
5526 1 2 3 7 8 9 1 2 3 1 2 3
5527 1 2 3 7 8 9 1 2 3 1 2 4
5528 alter table t1 partition by key (a,b) partitions 8;
5529 select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
5530 d e f a b c d e f a b c
5531 1 2 3 1 2 3 1 2 3 1 2 3
5532 1 2 3 1 2 3 1 2 3 1 2 4
5533 1 2 3 1 2 4 1 2 3 1 2 3
5534 1 2 3 1 2 4 1 2 3 1 2 4
5535 1 2 3 2 3 4 1 2 3 1 2 3
5536 1 2 3 2 3 4 1 2 3 1 2 4
5537 1 2 3 3 4 5 1 2 3 1 2 3
5538 1 2 3 3 4 5 1 2 3 1 2 4
5539 1 2 3 4 5 6 1 2 3 1 2 3
5540 1 2 3 4 5 6 1 2 3 1 2 4
5541 1 2 3 5 6 7 1 2 3 1 2 3
5542 1 2 3 5 6 7 1 2 3 1 2 4
5543 1 2 3 6 7 8 1 2 3 1 2 3
5544 1 2 3 6 7 8 1 2 3 1 2 4
5545 1 2 3 7 8 9 1 2 3 1 2 3
5546 1 2 3 7 8 9 1 2 3 1 2 4
5547 alter table t1 partition by key (b,a) partitions 8;
5548 select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
5549 d e f a b c d e f a b c
5550 1 2 3 1 2 3 1 2 3 1 2 3
5551 1 2 3 1 2 3 1 2 3 1 2 4
5552 1 2 3 1 2 4 1 2 3 1 2 3
5553 1 2 3 1 2 4 1 2 3 1 2 4
5554 1 2 3 2 3 4 1 2 3 1 2 3
5555 1 2 3 2 3 4 1 2 3 1 2 4
5556 1 2 3 3 4 5 1 2 3 1 2 3
5557 1 2 3 3 4 5 1 2 3 1 2 4
5558 1 2 3 4 5 6 1 2 3 1 2 3
5559 1 2 3 4 5 6 1 2 3 1 2 4
5560 1 2 3 5 6 7 1 2 3 1 2 3
5561 1 2 3 5 6 7 1 2 3 1 2 4
5562 1 2 3 6 7 8 1 2 3 1 2 3
5563 1 2 3 6 7 8 1 2 3 1 2 4
5564 1 2 3 7 8 9 1 2 3 1 2 3
5565 1 2 3 7 8 9 1 2 3 1 2 4
5566 alter table t1 partition by key (b) partitions 8;
5567 select straight_join * from t1 x, t1 y where y.a=x.d and y.b=2;
5568 d e f a b c d e f a b c
5569 1 2 3 1 2 3 1 2 3 1 2 3
5570 1 2 3 1 2 3 1 2 3 1 2 4
5571 1 2 3 1 2 4 1 2 3 1 2 3
5572 1 2 3 1 2 4 1 2 3 1 2 4
5573 1 2 3 2 3 4 1 2 3 1 2 3
5574 1 2 3 2 3 4 1 2 3 1 2 4
5575 1 2 3 3 4 5 1 2 3 1 2 3
5576 1 2 3 3 4 5 1 2 3 1 2 4
5577 1 2 3 4 5 6 1 2 3 1 2 3
5578 1 2 3 4 5 6 1 2 3 1 2 4
5579 1 2 3 5 6 7 1 2 3 1 2 3
5580 1 2 3 5 6 7 1 2 3 1 2 4
5581 1 2 3 6 7 8 1 2 3 1 2 3
5582 1 2 3 6 7 8 1 2 3 1 2 4
5583 1 2 3 7 8 9 1 2 3 1 2 3
5584 1 2 3 7 8 9 1 2 3 1 2 4
5585 alter table t1 partition by key (a) partitions 8;
5586 select straight_join * from t1 x, t1 y where y.a=1 and y.b=x.e;
5587 d e f a b c d e f a b c
5588 1 2 3 1 2 3 1 2 3 1 2 3
5589 1 2 3 1 2 3 1 2 3 1 2 4
5590 1 2 3 1 2 4 1 2 3 1 2 3
5591 1 2 3 1 2 4 1 2 3 1 2 4
5592 1 2 3 2 3 4 1 2 3 1 2 3
5593 1 2 3 2 3 4 1 2 3 1 2 4
5594 1 2 3 3 4 5 1 2 3 1 2 3
5595 1 2 3 3 4 5 1 2 3 1 2 4
5596 1 2 3 4 5 6 1 2 3 1 2 3
5597 1 2 3 4 5 6 1 2 3 1 2 4
5598 1 2 3 5 6 7 1 2 3 1 2 3
5599 1 2 3 5 6 7 1 2 3 1 2 4
5600 1 2 3 6 7 8 1 2 3 1 2 3
5601 1 2 3 6 7 8 1 2 3 1 2 4
5602 1 2 3 7 8 9 1 2 3 1 2 3
5603 1 2 3 7 8 9 1 2 3 1 2 4
5604 select straight_join * from t1 x, t1 y where y.a=0 and y.b=x.e;
5605 d e f a b c d e f a b c
5606 alter table t1 partition by key (a,b) partitions 8;
5607 select straight_join * from t1 x, t1 y where y.a=1 and y.b=x.e;
5608 d e f a b c d e f a b c
5609 1 2 3 1 2 3 1 2 3 1 2 3
5610 1 2 3 1 2 3 1 2 3 1 2 4
5611 1 2 3 1 2 4 1 2 3 1 2 3
5612 1 2 3 1 2 4 1 2 3 1 2 4
5613 1 2 3 2 3 4 1 2 3 1 2 3
5614 1 2 3 2 3 4 1 2 3 1 2 4
5615 1 2 3 3 4 5 1 2 3 1 2 3
5616 1 2 3 3 4 5 1 2 3 1 2 4
5617 1 2 3 4 5 6 1 2 3 1 2 3
5618 1 2 3 4 5 6 1 2 3 1 2 4
5619 1 2 3 5 6 7 1 2 3 1 2 3
5620 1 2 3 5 6 7 1 2 3 1 2 4
5621 1 2 3 6 7 8 1 2 3 1 2 3
5622 1 2 3 6 7 8 1 2 3 1 2 4
5623 1 2 3 7 8 9 1 2 3 1 2 3
5624 1 2 3 7 8 9 1 2 3 1 2 4
5625 select straight_join * from t1 x, t1 y where y.a=x.d and y.b=2;
5626 d e f a b c d e f a b c
5627 1 2 3 1 2 3 1 2 3 1 2 3
5628 1 2 3 1 2 3 1 2 3 1 2 4
5629 1 2 3 1 2 4 1 2 3 1 2 3
5630 1 2 3 1 2 4 1 2 3 1 2 4
5631 1 2 3 2 3 4 1 2 3 1 2 3
5632 1 2 3 2 3 4 1 2 3 1 2 4
5633 1 2 3 3 4 5 1 2 3 1 2 3
5634 1 2 3 3 4 5 1 2 3 1 2 4
5635 1 2 3 4 5 6 1 2 3 1 2 3
5636 1 2 3 4 5 6 1 2 3 1 2 4
5637 1 2 3 5 6 7 1 2 3 1 2 3
5638 1 2 3 5 6 7 1 2 3 1 2 4
5639 1 2 3 6 7 8 1 2 3 1 2 3
5640 1 2 3 6 7 8 1 2 3 1 2 4
5641 1 2 3 7 8 9 1 2 3 1 2 3
5642 1 2 3 7 8 9 1 2 3 1 2 4
5643 alter table t1 drop primary key, add primary key using hash (d,b,a,c);
5644 alter table t1 partition by key (b) partitions 8;
5645 create index ix1 on t1(b,d,a);
5646 explain
5647 select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
5648 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5649 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL # # Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`e` is not null)
5650 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 4 test.x.e # # Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`a` = `test`.`x`.`d`)
5651 Warnings:
5652 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`))
5653 insert into t1(a,b,c,d,e,f) values
5654 (8, 9, 0, 1, null, 3),
5655 (9, 9, 0, 1, 2, null);
5656 alter table t1 partition by key (b) partitions 8;
5657 select straight_join * from t1 x, t1 y where y.a=x.d and y.b=x.e;
5658 d e f a b c d e f a b c
5659 1 2 3 1 2 3 1 2 3 1 2 3
5660 1 2 3 1 2 3 1 2 3 1 2 4
5661 1 2 3 1 2 4 1 2 3 1 2 3
5662 1 2 3 1 2 4 1 2 3 1 2 4
5663 1 2 3 2 3 4 1 2 3 1 2 3
5664 1 2 3 2 3 4 1 2 3 1 2 4
5665 1 2 3 3 4 5 1 2 3 1 2 3
5666 1 2 3 3 4 5 1 2 3 1 2 4
5667 1 2 3 4 5 6 1 2 3 1 2 3
5668 1 2 3 4 5 6 1 2 3 1 2 4
5669 1 2 3 5 6 7 1 2 3 1 2 3
5670 1 2 3 5 6 7 1 2 3 1 2 4
5671 1 2 3 6 7 8 1 2 3 1 2 3
5672 1 2 3 6 7 8 1 2 3 1 2 4
5673 1 2 3 7 8 9 1 2 3 1 2 3
5674 1 2 3 7 8 9 1 2 3 1 2 4
5675 1 2 NULL 9 9 0 1 2 3 1 2 3
5676 1 2 NULL 9 9 0 1 2 3 1 2 4
5677 pruned
5678 14
5679 const_pruned
5680 6
5681 drop table t1;
5682 create table t1 (pk int primary key, a int, b int) engine=ndb
5683 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5684 create index ix1 on t1(b,a);
5685 insert into t1 values (0,10,10);
5686 insert into t1 values (1,10,20);
5687 insert into t1 values (2,20,20);
5688 insert into t1 values (3,10,10);
5689 insert into t1 values (4,10,20);
5690 insert into t1 values (5,10,20);
5691 insert into t1 values (6,10,10);
5692 insert into t1 values (7,10,10);
5693 insert into t1 values (8,10,20);
5694 insert into t1 values (9,10,10);
5695 explain select x1.pk,x1.a,x1.b from t1 as x1
5696 join t1 as x2 on x1.a=x2.b
5697 join t1 as x3 on x2.a=x3.b
5698 order by x1.pk limit 70;
5699 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5700 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 index NULL PRIMARY 4 NULL 10 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`x1`.`a` is not null)
5701 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a 2 100.00 Child of 'x1' in pushed join@1; Using pushed condition (`test`.`x2`.`a` is not null)
5702 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x2.a 2 100.00 Child of 'x2' in pushed join@1
5703 Warnings:
5704 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
5705 select x1.pk,x1.a,x1.b from t1 as x1
5706 join t1 as x2 on x1.a=x2.b
5707 join t1 as x3 on x2.a=x3.b
5708 order by x1.pk limit 70;
5709 pk a b
5710 0 10 10
5711 0 10 10
5712 0 10 10
5713 0 10 10
5714 0 10 10
5715 0 10 10
5716 0 10 10
5717 0 10 10
5718 0 10 10
5719 0 10 10
5720 0 10 10
5721 0 10 10
5722 0 10 10
5723 0 10 10
5724 0 10 10
5725 0 10 10
5726 0 10 10
5727 0 10 10
5728 0 10 10
5729 0 10 10
5730 0 10 10
5731 0 10 10
5732 0 10 10
5733 0 10 10
5734 0 10 10
5735 1 10 20
5736 1 10 20
5737 1 10 20
5738 1 10 20
5739 1 10 20
5740 1 10 20
5741 1 10 20
5742 1 10 20
5743 1 10 20
5744 1 10 20
5745 1 10 20
5746 1 10 20
5747 1 10 20
5748 1 10 20
5749 1 10 20
5750 1 10 20
5751 1 10 20
5752 1 10 20
5753 1 10 20
5754 1 10 20
5755 1 10 20
5756 1 10 20
5757 1 10 20
5758 1 10 20
5759 1 10 20
5760 2 20 20
5761 2 20 20
5762 2 20 20
5763 2 20 20
5764 2 20 20
5765 2 20 20
5766 2 20 20
5767 2 20 20
5768 2 20 20
5769 2 20 20
5770 2 20 20
5771 2 20 20
5772 2 20 20
5773 2 20 20
5774 2 20 20
5775 2 20 20
5776 2 20 20
5777 2 20 20
5778 2 20 20
5779 2 20 20
5780 explain select * from t1 as x1, t1 as x2 where x1.a=x2.b and x1.b = 3;
5781 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5782 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 const 3 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x1`.`a` is not null)
5783 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref ix1 ix1 5 test.x1.a 2 100.00 Child of 'x1' in pushed join@1
5784 Warnings:
5785 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`))
5786 select * from t1 as x1, t1 as x2 where x1.a=x2.b and x1.b = 3;
5787 pk a b pk a b
5788 drop table t1;
5789 create table t (pk int primary key, a int) engine=ndb
5790 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5791 insert into t values
5792 (1,1), (2,1),
5793 (4,3), (6,3),
5794 (7,4), (8,4);
5795 explain
5796 select distinct straight_join table1.pk FROM
5797 t as table1 join
5798 (t as table2 join
5799 (t as table3 join t as table4 on table3.pk = table4.a)
5800 on table2.pk = table3.pk )
5801 on table1.a = table4.pk
5802 where table2.pk != 6;
5803 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5804 1 SIMPLE table1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL # # Using pushed condition (`test`.`table1`.`a` is not null); Using temporary
5805 1 SIMPLE table2 p0,p1,p2,p3,p4,p5,p6,p7 range PRIMARY PRIMARY 4 NULL # # Parent of 2 pushed join@1; Using pushed condition (`test`.`table2`.`pk` <> 6); Using MRR; Distinct; Using join buffer (hash join)
5806 1 SIMPLE table3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.table2.pk # # Child of 'table2' in pushed join@1; Distinct
5807 1 SIMPLE table4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.table1.a # # Using where; Distinct
5808 Warnings:
5809 Note 1003 Can't push table 'table2' as child, access type 'Range-scan' not implemented
5810 Note 1003 Can't push table 'table3' as child of 'table1', it is in a hash-bucket-branch which can't be referred.
5811 Note 1003 Can't push table 'table4' as child of 'table1', it is in a hash-bucket-branch which can't be referred.
5812 Note 1003 Can't push table 'table4' as child of 'table2', column 'table1.a' is in a hash-bucket-branch which can't be referred
5813 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))
5814 select distinct straight_join table1.pk FROM
5815 t as table1 join
5816 (t as table2 join
5817 (t as table3 join t as table4 on table3.pk = table4.a)
5818 on table2.pk = table3.pk )
5819 on table1.a = table4.pk
5820 where table2.pk != 6;
5821 pk
5822 1
5823 2
5824 drop table t;
5825 create table t (b int, a int, primary key (a,b)) engine=ndb
5826 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5827 insert into t values(0,0);
5828 explain
5829 select * from t as t1 join t as t2 on t2.a=t1.a where t1.a < 8 or t1.a >= 8;
5830 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5831 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL # # Parent of 2 pushed join@1; Using pushed condition ((`test`.`t1`.`a` < 8) or (`test`.`t1`.`a` >= 8))
5832 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.a # # Child of 't1' in pushed join@1
5833 Warnings:
5834 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)))
5835 select * from t as t1 join t as t2 on t2.a=t1.a where t1.a < 8 or t1.a >= 8;
5836 b a b a
5837 0 0 0 0
5838 drop table t;
5839 create table t (pk1 int, pk2 int, primary key(pk1,pk2)) engine = ndb
5840 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5841 insert into t values (1,3), (3,6), (6,9), (9,1);
5842 explain
5843 select * from t as t1 join t as t2
5844 on t1.pk2 = t2.pk1
5845 where t1.pk1 != 6
5846 order by t1.pk1 DESC;
5847 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5848 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 range PRIMARY PRIMARY 4 NULL # # Parent of 2 pushed join@1; Using pushed condition (`test`.`t1`.`pk1` <> 6); Backward index scan; Using MRR
5849 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.pk2 # # Child of 't1' in pushed join@1
5850 Warnings:
5851 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
5852 select * from t as t1 join t as t2
5853 on t1.pk2 = t2.pk1
5854 where t1.pk1 != 6
5855 order by t1.pk1 DESC;
5856 pk1 pk2 pk1 pk2
5857 9 1 1 3
5858 3 6 6 9
5859 1 3 3 6
5860 drop table t;
5861 create table t (k int, uq int, unique key ix1 (uq)) engine = ndb
5862 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5863 insert into t values (1,3), (3,NULL), (6,9), (9,1);
5864 explain
5865 select straight_join * from t as a join t as b
5866 on a.uq=b.uq or b.uq is null;
5867 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5868 1 SIMPLE a p0,p1,p2,p3,p4,p5,p6,p7 ALL ix1 NULL NULL NULL 4 100.00 NULL
5869 1 SIMPLE b p0,p1,p2,p3,p4,p5,p6,p7 ref_or_null ix1 ix1 5 test.a.uq 2 100.00 Using pushed condition ((`test`.`b`.`uq` = `test`.`a`.`uq`) or (`test`.`b`.`uq` is null))
5870 Warnings:
5871 Note 1003 Table 'b' is not pushable: Access type was not chosen at 'prepare' time
5872 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 (`test`.`b`.`uq` is null))
5873 select straight_join * from t as a join t as b
5874 on a.uq=b.uq or b.uq is null;
5875 k uq k uq
5876 1 3 1 3
5877 1 3 3 NULL
5878 3 NULL 3 NULL
5879 6 9 3 NULL
5880 6 9 6 9
5881 9 1 3 NULL
5882 9 1 9 1
5883 drop table t;
5884 create table t (k int primary key, uq int) engine = ndb
5885 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5886 insert into t values (1,3), (3,NULL), (6,9), (9,1);
5887 #############
5888 # WL#14370: AccessPath will contain a 'zero rows'-AccessPath in place
5889 # of the known 'false' condition.
5890 explain select * from t as a left join t as b
5891 on a.k is null and a.uq=b.uq;
5892 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5893 1 SIMPLE a p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 NULL
5894 1 SIMPLE b p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (hash join)
5895 Warnings:
5896 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(((`test`.`b`.`uq` = `test`.`a`.`uq`) and (`test`.`a`.`k` is null))) where true
5897 explain format=tree select * from t as a left join t as b
5898 on a.k is null and a.uq=b.uq;
5899 EXPLAIN
5900 -> Left hash join (no condition)
5901 -> Table scan on a
5902 -> Hash
5903 -> Zero rows (Impossible filter)
5904
5905 select * from t as a left join t as b
5906 on a.k is null and a.uq=b.uq;
5907 k uq k uq
5908 1 3 NULL NULL
5909 3 NULL NULL NULL
5910 6 9 NULL NULL
5911 9 1 NULL NULL
5912 drop table t;
5913 create table tc(
5914 a varchar(10) not null,
5915 b varchar(10),
5916 c varchar(10),
5917 primary key (a),
5918 unique key uk1 (b, c)
5919 ) engine=ndbcluster
5920 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5921 insert into tc values ('aa','bb', 'x'), ('bb','cc', 'x'), ('cc', 'dd', 'x');
5922 explain select * from tc as x1
5923 right outer join tc as x2 on x1.b=x2.a
5924 left outer join tc as x3 on x2.b = x3.b and x1.c=x3.c;
5925 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5926 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 3 100.00 Parent of 3 pushed join@1
5927 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ref uk1 uk1 43 test.x2.a 1 100.00 Child of 'x2' in pushed join@1
5928 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref uk1 uk1 86 test.x2.b,test.x1.c 1 100.00 Child of 'x1' in pushed join@1
5929 Warnings:
5930 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`.`x3`.`c` = `test`.`x1`.`c`) and (`test`.`x3`.`b` = `test`.`x2`.`b`))) where true
5931 select * from tc as x1
5932 right outer join tc as x2 on x1.b=x2.a
5933 left outer join tc as x3 on x2.b = x3.b and x1.c=x3.c;
5934 a b c a b c a b c
5935 NULL NULL NULL aa bb x NULL NULL NULL
5936 aa bb x bb cc x bb cc x
5937 bb cc x cc dd x cc dd x
5938 explain select * from tc as x1, tc as x2 where x1.b=x2.a for update;
5939 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5940 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL uk1 NULL NULL NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x1`.`b` is not null)
5941 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 42 test.x1.b 1 100.00 Child of 'x1' in pushed join@1
5942 Warnings:
5943 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`)
5944 explain select * from tc as x1, tc as x2 where x1.b=x2.a;
5945 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5946 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL uk1 NULL NULL NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x1`.`b` is not null)
5947 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 42 test.x1.b 1 100.00 Child of 'x1' in pushed join@1
5948 Warnings:
5949 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`)
5950 drop table tc;
5951 create table t1 (
5952 a varchar(16) not null,
5953 b int not null,
5954 c varchar(16) not null,
5955 d int not null,
5956 primary key (a,b)
5957 ) engine ndb
5958 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM"
5959 partition by key (a);
5960 insert into t1 values ('aaa', 1, 'aaa', 1);
5961 select * from t1 as q1, t1 as q2 where q1.a = 'aaa' and q1.c=q2.a;
5962 a b c d a b c d
5963 aaa 1 aaa 1 aaa 1 aaa 1
5964 drop table t1;
5965 CREATE TABLE t1 (
5966 id int NOT NULL AUTO_INCREMENT,
5967 t2_id int,
5968 PRIMARY KEY (id)
5969 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
5970 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5971 CREATE TABLE t2 (
5972 id int NOT NULL AUTO_INCREMENT,
5973 t3_id varchar(20) DEFAULT NULL,
5974 PRIMARY KEY (id)
5975 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
5976 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5977 CREATE TABLE t3 (
5978 id varchar(20) NOT NULL,
5979 PRIMARY KEY (`id`)
5980 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
5981 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5982 CREATE TABLE t4 (
5983 pk int NOT NULL,
5984 id varchar(20) NOT NULL,
5985 PRIMARY KEY (pk),
5986 UNIQUE KEY (`id`)
5987 ) ENGINE=ndbcluster DEFAULT CHARSET=latin1
5988 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
5989 INSERT INTO t1 VALUES (20, NULL);
5990 INSERT INTO t1 VALUES (23, 24);
5991 INSERT INTO t2 VALUES (24, NULL);
5992 EXPLAIN
5993 SELECT *
5994 FROM t1
5995 INNER JOIN t2 ON t2.id = t1.t2_id
5996 LEFT OUTER JOIN t3 ON t3.id = t2.t3_id
5997 WHERE t1.id = 20;
5998 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
5999 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`t1`.`t2_id` is not null)
6000 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.t2_id 1 100.00 Child of 't1' in pushed join@1
6001 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 22 test.t2.t3_id 1 100.00 Child of 't2' in pushed join@1
6002 Warnings:
6003 Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`t2_id` AS `t2_id`,`test`.`t2`.`id` AS `id`,`test`.`t2`.`t3_id` AS `t3_id`,`test`.`t3`.`id` AS `id` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`id` = `test`.`t2`.`t3_id`)) where ((`test`.`t2`.`id` = `test`.`t1`.`t2_id`) and (`test`.`t1`.`id` = 20))
6004 SELECT *
6005 FROM t1
6006 INNER JOIN t2 ON t2.id = t1.t2_id
6007 LEFT OUTER JOIN t3 ON t3.id = t2.t3_id
6008 WHERE t1.id = 20;
6009 id t2_id id t3_id id
6010 EXPLAIN
6011 SELECT *
6012 FROM t1
6013 INNER JOIN t2 ON t2.id = t1.t2_id
6014 LEFT OUTER JOIN t3 ON t3.id = t2.t3_id
6015 WHERE t1.id = 23;
6016 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6017 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`t1`.`t2_id` is not null)
6018 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.t2_id 1 100.00 Child of 't1' in pushed join@1
6019 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 22 test.t2.t3_id 1 100.00 Child of 't2' in pushed join@1
6020 Warnings:
6021 Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`t2_id` AS `t2_id`,`test`.`t2`.`id` AS `id`,`test`.`t2`.`t3_id` AS `t3_id`,`test`.`t3`.`id` AS `id` from `test`.`t1` join `test`.`t2` left join `test`.`t3` on((`test`.`t3`.`id` = `test`.`t2`.`t3_id`)) where ((`test`.`t2`.`id` = `test`.`t1`.`t2_id`) and (`test`.`t1`.`id` = 23))
6022 SELECT *
6023 FROM t1
6024 INNER JOIN t2 ON t2.id = t1.t2_id
6025 LEFT OUTER JOIN t3 ON t3.id = t2.t3_id
6026 WHERE t1.id = 23;
6027 id t2_id id t3_id id
6028 23 24 24 NULL NULL
6029 EXPLAIN
6030 SELECT *
6031 FROM t1
6032 INNER JOIN t2 ON t2.id = t1.t2_id
6033 LEFT OUTER JOIN t4 ON t4.id = t2.t3_id
6034 WHERE t1.id = 23;
6035 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6036 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Parent of 3 pushed join@1; Using pushed condition (`test`.`t1`.`t2_id` is not null)
6037 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.t2_id 1 100.00 Child of 't1' in pushed join@1
6038 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref id id 22 test.t2.t3_id 1 100.00 Child of 't2' in pushed join@1
6039 Warnings:
6040 Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`t2_id` AS `t2_id`,`test`.`t2`.`id` AS `id`,`test`.`t2`.`t3_id` AS `t3_id`,`test`.`t4`.`pk` AS `pk`,`test`.`t4`.`id` AS `id` from `test`.`t1` join `test`.`t2` left join `test`.`t4` on((`test`.`t4`.`id` = `test`.`t2`.`t3_id`)) where ((`test`.`t2`.`id` = `test`.`t1`.`t2_id`) and (`test`.`t1`.`id` = 23))
6041 SELECT *
6042 FROM t1
6043 INNER JOIN t2 ON t2.id = t1.t2_id
6044 LEFT OUTER JOIN t4 ON t4.id = t2.t3_id
6045 WHERE t1.id = 23;
6046 id t2_id id t3_id pk id
6047 23 24 24 NULL NULL NULL
6048 EXPLAIN
6049 SELECT *
6050 FROM t1
6051 LEFT OUTER JOIN t2 ON t2.id = t1.t2_id
6052 LEFT OUTER JOIN t2 as t3 ON t3.id = t1.t2_id;
6053 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6054 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 2 100.00 Parent of 3 pushed join@1
6055 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.t2_id 1 100.00 Child of 't1' in pushed join@1
6056 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.t2_id 1 100.00 Child of 't1' in pushed join@1
6057 Warnings:
6058 Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id`,`test`.`t1`.`t2_id` AS `t2_id`,`test`.`t2`.`id` AS `id`,`test`.`t2`.`t3_id` AS `t3_id`,`test`.`t3`.`id` AS `id`,`test`.`t3`.`t3_id` AS `t3_id` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`id` = `test`.`t1`.`t2_id`)) left join `test`.`t2` `t3` on((`test`.`t3`.`id` = `test`.`t1`.`t2_id`)) where true
6059 SELECT *
6060 FROM t1
6061 LEFT OUTER JOIN t2 ON t2.id = t1.t2_id
6062 LEFT OUTER JOIN t2 as t3 ON t3.id = t1.t2_id;
6063 id t2_id id t3_id id t3_id
6064 20 NULL NULL NULL NULL NULL
6065 23 24 24 NULL 24 NULL
6066 DROP TABLE t1,t2,t3,t4;
6067 CREATE TABLE t1 (
6068 a int NOT NULL,
6069 b int NOT NULL,
6070 c int NOT NULL,
6071 d int,
6072 PRIMARY KEY (`a`,`b`),
6073 unique key(c)
6074 ) ENGINE=ndbcluster
6075 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
6076 insert into t1 values
6077 (1,1,1,1),
6078 (1,2,2,1),
6079 (1,3,3,1),
6080 (1,4,4,1),
6081 (1,5,5,2),
6082 (1,6,6,2),
6083 (1,7,7,2),
6084 (1,8,8,2);
6085 explain select count(*) from t1 as x1
6086 join (t1 as x2
6087 left join (t1 as x3
6088 cross join t1 as x4)
6089 on x2.d=x3.a)
6090 on x2.c is null or x1.a=x4.d;
6091 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6092 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 8 100.00 NULL
6093 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x2.d 1 100.00 NULL
6094 1 SIMPLE x4 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 8 100.00 Parent of 2 pushed join@1; Using where
6095 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x4.d 1 100.00 Child of 'x4' in pushed join@1
6096 Warnings:
6097 Note 1003 Can't push table 'x4' as child, 'type' must be a 'ref' access
6098 Note 1003 Can't push outer joined table 'x3' as child of 'x2', some tables in embedding join-nest(s) are not part of pushed join
6099 Note 1003 Can't push table 'x1' as child of 'x2', column 'x4.d' refers a table which was not pushed
6100 Note 1003 Can't push table 'x1' as child of 'x3', column 'x4.d' refers a table which was not pushed
6101 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`)
6102 select count(*) from t1 as x1
6103 join (t1 as x2
6104 left join (t1 as x3
6105 cross join t1 as x4)
6106 on x2.d=x3.a)
6107 on x2.c is null or x1.a=x4.d;
6108 count(*)
6109 1024
6110 explain select count(*) from t1 as x1
6111 left join (t1 as x2
6112 cross join t1 as x3)
6113 on x1.d=x2.a;
6114 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6115 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 8 100.00 NULL
6116 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x1.d 1 100.00 NULL
6117 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 8 100.00 NULL
6118 Warnings:
6119 Note 1003 Can't push table 'x3' as child, 'type' must be a 'ref' access
6120 Note 1003 Can't push outer joined table 'x2' as child of 'x1', some tables in embedding join-nest(s) are not part of pushed join
6121 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` left join (`test`.`t1` `x2` join `test`.`t1` `x3`) on((`test`.`x2`.`a` = `test`.`x1`.`d`)) where true
6122 select count(*) from t1 as x1
6123 left join (t1 as x2
6124 cross join t1 as x3)
6125 on x1.d=x2.a;
6126 count(*)
6127 260
6128 #################
6129 # Prior to WL#14370 we did 'pending condition' analysis inside the
6130 # join pushdown handler. That code took a too conservative approach
6131 # in identifying such pending conditions, somethimes resulting in pushdown
6132 # to be rejected due to 'table condition can not be fully evaluated...'
6133 # The AccessPath construction code does a much better job of identifying
6134 # these pending condition, and placing them at the correct branch level.
6135 # As this information is now available to us through the AccessPath
6136 # integration, we eliminated our own (incomplete) code for doing such
6137 # analysis and could avoid such false rejections at the same time.
6138 #
6139 # Note the diff in the traditional and tree format explain below:
6140 # The traditional explain says table x4 is 'using where', which was
6141 # incorrectly identified as a trigger condition on join(x2,x4).
6142 # The tree format explain shows that it has been liftet out of that
6143 # join scope as a 'filter' on the entire x1..x4 join - Thus there is
6144 # noting preventing the left-join(x2,x4)
6145 #################
6146 explain select count(*) from t1 as x0
6147 left join (t1 as x1
6148 join (t1 as x2
6149 left join (t1 as x3
6150 join t1 as x4 on x3.d=x4.a)
6151 on x2.d=x3.a)
6152 on x2.c is null or x1.a=x4.d)
6153 on x0.d=x1.a;
6154 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6155 1 SIMPLE x0 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 8 100.00 NULL
6156 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x0.d 1 100.00 NULL
6157 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ALL c NULL NULL NULL 8 100.00 Parent of 3 pushed join@1
6158 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x2.d 1 100.00 Child of 'x2' in pushed join@1
6159 1 SIMPLE x4 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.x3.d 1 100.00 Child of 'x3' in pushed join@1; Using where
6160 Warnings:
6161 Note 1003 Can't push outer joined table 'x1' as child of 'x0', join-nest containing the table has FILTER conditions
6162 Note 1003 Can't push table 'x2' as child, 'type' must be a 'ref' access
6163 Note 1003 Can't push table 'x3' as child of 'x0', column 'x2.d' refers a table which was not pushed
6164 Note 1003 Can't push table 'x4' as child of 'x0', column 'x3.d' refers a table which was not pushed
6165 Note 1003 Can't push table 'x3' as child of 'x1', column 'x2.d' refers a table which was not pushed
6166 Note 1003 Can't push table 'x4' as child of 'x1', column 'x3.d' refers a table which was not pushed
6167 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`.`x4`.`a` = `test`.`x3`.`d`) and (`test`.`x3`.`a` = `test`.`x2`.`d`)))) on(((`test`.`x1`.`a` = `test`.`x0`.`d`) and ((`test`.`x2`.`c` is null) or (`test`.`x4`.`d` = `test`.`x0`.`d`)))) where true
6168 explain format=tree select count(*) from t1 as x0
6169 left join (t1 as x1
6170 join (t1 as x2
6171 left join (t1 as x3
6172 join t1 as x4 on x3.d=x4.a)
6173 on x2.d=x3.a)
6174 on x2.c is null or x1.a=x4.d)
6175 on x0.d=x1.a;
6176 EXPLAIN
6177 -> Aggregate: count(0)
6178 -> Nested loop left join
6179 -> Table scan on x0
6180 -> Filter: ((x2.c is null) or (x4.d = x0.d))
6181 -> Nested loop left join
6182 -> Nested loop inner join
6183 -> Index lookup on x1 using PRIMARY (a=x0.d)
6184 -> Table scan on x2, activating pushed join of 3 tables
6185 -> Nested loop inner join
6186 -> Index lookup on x3 using PRIMARY (a=x2.d), child of x2 in pushed join
6187 -> Index lookup on x4 using PRIMARY (a=x3.d), child of x3 in pushed join
6188
6189 Warnings:
6190 Note 1003 Can't push outer joined table 'x1' as child of 'x0', join-nest containing the table has FILTER conditions
6191 Note 1003 Can't push table 'x2' as child, 'type' must be a 'ref' access
6192 Note 1003 Can't push table 'x3' as child of 'x0', column 'x2.d' refers a table which was not pushed
6193 Note 1003 Can't push table 'x4' as child of 'x0', column 'x3.d' refers a table which was not pushed
6194 Note 1003 Can't push table 'x3' as child of 'x1', column 'x2.d' refers a table which was not pushed
6195 Note 1003 Can't push table 'x4' as child of 'x1', column 'x3.d' refers a table which was not pushed
6196 select count(*) from t1 as x0
6197 left join (t1 as x1
6198 join (t1 as x2
6199 left join (t1 as x3
6200 join t1 as x4 on x3.d=x4.a)
6201 on x2.d=x3.a)
6202 on x2.c is null or x1.a=x4.d)
6203 on x0.d=x1.a;
6204 count(*)
6205 2052
6206 drop table t1;
6207 create table t1 (pk char(10) primary key, u int not null) engine=ndb
6208 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
6209 create table t2 (pk int primary key, u int not null) engine=ndb
6210 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
6211 insert into t1 values ('wh',1);
6212 insert into t1 values ('ik',2);
6213 insert into t1 values ('cu',3);
6214 insert into t1 values ('pw',4);
6215 insert into t1 values ('cq',4);
6216 insert into t2 values (1,2), (2,3), (3,4), (4,5);
6217 explain select * from t1 join t2 on t1.u = t2.pk order by t1.pk;
6218 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6219 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 index NULL PRIMARY 40 NULL 5 100.00 Parent of 2 pushed join@1
6220 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.t1.u 1 100.00 Child of 't1' in pushed join@1
6221 Warnings:
6222 Note 1003 /* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`u` AS `u`,`test`.`t2`.`pk` AS `pk`,`test`.`t2`.`u` AS `u` from `test`.`t1` join `test`.`t2` where (`test`.`t2`.`pk` = `test`.`t1`.`u`) order by `test`.`t1`.`pk`
6223 select * from t1 join t2 on t1.u = t2.pk order by t1.pk;
6224 pk u pk u
6225 cq 4 4 5
6226 cu 3 3 4
6227 ik 2 2 3
6228 pw 4 4 5
6229 wh 1 1 2
6230 drop table t1;
6231 drop table t2;
6232 create table t1 (
6233 a char(10) primary key,
6234 b char(10) not null,
6235 c char(10) not null,
6236 l00 char(255) not null,
6237 l01 char(255) not null,
6238 l02 char(255) not null,
6239 l03 char(255) not null,
6240 l04 char(255) not null,
6241 l05 char(255) not null,
6242 l06 char(255) not null,
6243 l07 char(255) not null,
6244 l08 char(255) not null,
6245 l09 char(255) not null,
6246 l10 char(255) not null,
6247 l11 char(255) not null,
6248 l12 char(255) not null,
6249 l13 char(255) not null,
6250 l14 char(255) not null,
6251 l15 char(255) not null,
6252 l16 char(255) not null,
6253 l17 char(255) not null,
6254 l18 char(255) not null,
6255 l19 char(255) not null,
6256 l20 char(255) not null,
6257 l21 char(255) not null,
6258 l22 char(255) not null,
6259 l23 char(255) not null,
6260 l24 char(255) not null,
6261 l25 char(255) not null,
6262 l26 char(255) not null,
6263 l27 char(255) not null,
6264 l28 char(255) not null,
6265 l29 char(255) not null,
6266 l30 char(255) not null,
6267 l31 char(255) not null,
6268 index(c, b)
6269 ) engine=ndb character set latin1 partition by key(a) partitions 8;
6270 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');
6271 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');
6272 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');
6273 explain select count(*) from t1 as x1 join t1 as x2 on x1.b = x2.c;
6274 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6275 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Parent of 2 pushed join@1
6276 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref c c 10 test.x1.b # # Child of 'x1' in pushed join@1
6277 Warnings:
6278 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` where (`test`.`x2`.`c` = `test`.`x1`.`b`)
6279 select count(*) from t1 as x1 join t1 as x2 on x1.b = x2.c;
6280 count(*)
6281 3
6282 drop table t1;
6283 create table t1
6284 (a int not null,
6285 b int not null,
6286 c int not null,
6287 d int not null,
6288 primary key(a,b,c,d)) engine=ndb
6289 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM"
6290 partition by key (b,c);
6291 insert into t1 values (0x4f, 0x4f, 0x4f, 0x4f);
6292 explain select * from t1 as x1
6293 join t1 as x2 on x1.c=0x4f and x2.a=0+x1.b and x2.b=x1.b
6294 join t1 as x3 on x3.a=x2.d and x3.b=x1.d and x3.c=x2.c;
6295 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6296 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Using pushed condition (`test`.`x1`.`c` = 0x4f)
6297 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 8 func,test.x1.b # # Parent of 2 pushed join@1; Using pushed condition (`test`.`x2`.`a` = (0 + `test`.`x1`.`b`))
6298 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 12 test.x2.d,test.x1.d,test.x2.c # # Child of 'x2' in pushed join@1
6299 Warnings:
6300 Note 1003 Can't push table 'x2' as child, column 'a' does neither 'ref' a column nor a constant
6301 Note 1003 Can't push table 'x3' as child of 'x1', column 'x2.d' refers a table which was not pushed
6302 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` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x2`.`b` = `test`.`x1`.`b`) and (`test`.`x3`.`c` = `test`.`x2`.`c`) and (`test`.`x3`.`b` = `test`.`x1`.`d`) and (`test`.`x3`.`a` = `test`.`x2`.`d`) and (`test`.`x1`.`c` = 0x4f) and (`test`.`x2`.`a` = (0 + `test`.`x1`.`b`)))
6303 select * from t1 as x1
6304 join t1 as x2 on x1.c=0x4f and x2.a=0+x1.b and x2.b=x1.b
6305 join t1 as x3 on x3.a=x2.c and x3.b=x1.d and x3.c=x2.c;
6306 a b c d a b c d a b c d
6307 79 79 79 79 79 79 79 79 79 79 79 79
6308 explain select * from t1 as x1
6309 join t1 as x2 on x1.c=0x4f and x2.a=0+x1.b and x2.b=x1.b
6310 join t1 as x3 on x3.a=x2.d and x3.b=x1.d and x3.c=0x4f;
6311 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6312 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL # # Using pushed condition (`test`.`x1`.`c` = 0x4f)
6313 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 8 func,test.x1.b # # Parent of 2 pushed join@1; Using pushed condition (`test`.`x2`.`a` = (0 + `test`.`x1`.`b`))
6314 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 12 test.x2.d,test.x1.d,const # # Child of 'x2' in pushed join@1
6315 Warnings:
6316 Note 1003 Can't push table 'x2' as child, column 'a' does neither 'ref' a column nor a constant
6317 Note 1003 Can't push table 'x3' as child of 'x1', column 'x2.d' refers a table which was not pushed
6318 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` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x2`.`b` = `test`.`x1`.`b`) and (`test`.`x3`.`b` = `test`.`x1`.`d`) and (`test`.`x3`.`a` = `test`.`x2`.`d`) and (`test`.`x3`.`c` = 0x4f) and (`test`.`x1`.`c` = 0x4f) and (`test`.`x2`.`a` = (0 + `test`.`x1`.`b`)))
6319 select * from t1 as x1
6320 join t1 as x2 on x1.c=0x4f and x2.a=0+x1.b and x2.b=x1.b
6321 join t1 as x3 on x3.a=x2.c and x3.b=x1.d and x3.c=0x4f;
6322 a b c d a b c d a b c d
6323 79 79 79 79 79 79 79 79 79 79 79 79
6324 drop table t1;
6325 create table t1 (
6326 k1 int primary key,
6327 i int,
6328 name varchar(32),
6329 key (name)
6330 )
6331 default charset = utf8
6332 engine = ndb
6333 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
6334 Warnings:
6335 Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
6336 insert into t1 values (1, 1, 'Ole');
6337 insert into t1 values (2, 2, 'Dole');
6338 insert into t1 values (3, 3, 'Doffen');
6339 insert into t1 values (4, 4, 'row# 999');
6340 set @save_range_opt_max = @@session.range_optimizer_max_mem_size;
6341 set range_optimizer_max_mem_size = 64*1024;
6342 ------------------------------------------------------------------
6343
6344 explain select * from t1 x, t1 y where y.k1=x.i and x.name in ('foo', .... 'row# 1999' );
6345 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6346 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL name NULL NULL NULL 4 50.00 Parent of 2 pushed join@1; Using pushed condition ((`test`.`x`.`name` in ('foo', .... 'row# 1999')) and (`test`.`x`.`i` is not null))
6347 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.i 1 100.00 Child of 'x' in pushed join@1
6348 Warnings:
6349 Warning 3170 Memory capacity of 65536 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
6350 Note 1003 /* select#1 */ select `test`.`x`.`k1` AS `k1`,`test`.`x`.`i` AS `i`,`test`.`x`.`name` AS `name`,`test`.`y`.`k1` AS `k1`,`test`.`y`.`i` AS `i`,`test`.`y`.`name` AS `name` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`k1` = `test`.`x`.`i`) and (`test`.`x`.`name` in ('foo', .... 'row# 1999')))
6351 select * from t1 x, t1 y where y.k1=x.i and x.name in ('foo', .... 'row# 1999' );
6352 k1 i name k1 i name
6353 4 4 row# 999 4 4 row# 999
6354 Warnings:
6355 Warning 3170 Memory capacity of 65536 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
6356 ------------------------------------------------------------------
6357
6358 explain select * from t1 x, t1 y where y.k1=x.i and x.name in ('foo', .... 'row# 3999' );
6359 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6360 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL name NULL NULL NULL 4 50.00 Parent of 2 pushed join@1; Using where
6361 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.i 1 100.00 Child of 'x' in pushed join@1
6362 Warnings:
6363 Warning 3170 Memory capacity of 65536 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
6364 Warning 4294 Scan filter is too large, discarded
6365 Note 1003 /* select#1 */ select `test`.`x`.`k1` AS `k1`,`test`.`x`.`i` AS `i`,`test`.`x`.`name` AS `name`,`test`.`y`.`k1` AS `k1`,`test`.`y`.`i` AS `i`,`test`.`y`.`name` AS `name` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`k1` = `test`.`x`.`i`) and (`test`.`x`.`name` in ('foo', .... 'row# 3999')))
6366 select * from t1 x, t1 y where y.k1=x.i and x.name in ('foo', .... 'row# 3999' );
6367 k1 i name k1 i name
6368 4 4 row# 999 4 4 row# 999
6369 Warnings:
6370 Warning 3170 Memory capacity of 65536 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
6371 Warning 4294 Scan filter is too large, discarded
6372 ------------------------------------------------------------------
6373
6374 explain select * from t1 x where x.name in ('foo', .... 'row# 3999' );
6375 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6376 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 ALL name NULL NULL NULL 4 50.00 Using where
6377 Warnings:
6378 Warning 3170 Memory capacity of 65536 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
6379 Warning 4294 Scan filter is too large, discarded
6380 Note 1003 /* select#1 */ select `test`.`x`.`k1` AS `k1`,`test`.`x`.`i` AS `i`,`test`.`x`.`name` AS `name` from `test`.`t1` `x` where (`test`.`x`.`name` in ('foo', .... 'row# 3999'))
6381 select * from t1 x where x.name in ('foo', .... 'row# 3999' );
6382 k1 i name
6383 4 4 row# 999
6384 Warnings:
6385 Warning 3170 Memory capacity of 65536 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
6386 Warning 4294 Scan filter is too large, discarded
6387 insert into t1 values (5, 4, 'row# 1');
6388 insert into t1 values (6, 4, 'row# 2');
6389 insert into t1 values (7, 4, 'row# 3');
6390 insert into t1 values (8, 4, 'row# 4');
6391 ------------------------------------------------------------------
6392
6393 explain select straight_join * from t1 x, t1 y where y.k1=x.i and y.name in ('foo', .... 'row# 999' ) order by x.k1;
6394 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6395 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 index NULL PRIMARY 4 NULL 8 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`i` is not null)
6396 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,name PRIMARY 4 test.x.i 1 50.00 Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`name` in ('foo', .... 'row# 999'))
6397 Warnings:
6398 Warning 3170 Memory capacity of 65536 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
6399 Note 1003 /* select#1 */ select straight_join `test`.`x`.`k1` AS `k1`,`test`.`x`.`i` AS `i`,`test`.`x`.`name` AS `name`,`test`.`y`.`k1` AS `k1`,`test`.`y`.`i` AS `i`,`test`.`y`.`name` AS `name` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`k1` = `test`.`x`.`i`) and (`test`.`y`.`name` in ('foo', .... 'row# 999'))) order by `test`.`x`.`k1`
6400 select straight_join * from t1 x, t1 y where y.k1=x.i and y.name in ('foo', .... 'row# 999' ) order by x.k1;
6401 k1 i name k1 i name
6402 4 4 row# 999 4 4 row# 999
6403 5 4 row# 1 4 4 row# 999
6404 6 4 row# 2 4 4 row# 999
6405 7 4 row# 3 4 4 row# 999
6406 8 4 row# 4 4 4 row# 999
6407 Warnings:
6408 Warning 3170 Memory capacity of 65536 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
6409 ------------------------------------------------------------------
6410
6411 explain select straight_join * from t1 x, t1 y where y.k1=x.i and y.name in ('foo', .... 'row# 3999' ) order by x.k1;
6412 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6413 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 index NULL PRIMARY 4 NULL 8 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`i` is not null)
6414 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,name PRIMARY 4 test.x.i 1 50.00 Child of 'x' in pushed join@1; Using where
6415 Warnings:
6416 Warning 3170 Memory capacity of 65536 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
6417 Warning 4294 Scan filter is too large, discarded
6418 Note 1003 /* select#1 */ select straight_join `test`.`x`.`k1` AS `k1`,`test`.`x`.`i` AS `i`,`test`.`x`.`name` AS `name`,`test`.`y`.`k1` AS `k1`,`test`.`y`.`i` AS `i`,`test`.`y`.`name` AS `name` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`k1` = `test`.`x`.`i`) and (`test`.`y`.`name` in ('foo', .... 'row# 3999'))) order by `test`.`x`.`k1`
6419 select straight_join * from t1 x, t1 y where y.k1=x.i and y.name in ('foo', .... 'row# 3999' ) order by x.k1;
6420 k1 i name k1 i name
6421 4 4 row# 999 4 4 row# 999
6422 5 4 row# 1 4 4 row# 999
6423 6 4 row# 2 4 4 row# 999
6424 7 4 row# 3 4 4 row# 999
6425 8 4 row# 4 4 4 row# 999
6426 Warnings:
6427 Warning 3170 Memory capacity of 65536 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
6428 Warning 4294 Scan filter is too large, discarded
6429 ------------------------------------------------------------------
6430
6431 explain select straight_join * from t1 x, t1 y where y.k1=x.i and y.name in ('foo', .... 'row# 1999' ) order by x.k1;
6432 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6433 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 index NULL PRIMARY 4 NULL 8 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`i` is not null)
6434 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,name PRIMARY 4 test.x.i 1 50.00 Child of 'x' in pushed join@1; Using pushed condition (`test`.`y`.`name` in ('foo', .... 'row# 1999'))
6435 Warnings:
6436 Warning 3170 Memory capacity of 65536 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
6437 Note 1003 /* select#1 */ select straight_join `test`.`x`.`k1` AS `k1`,`test`.`x`.`i` AS `i`,`test`.`x`.`name` AS `name`,`test`.`y`.`k1` AS `k1`,`test`.`y`.`i` AS `i`,`test`.`y`.`name` AS `name` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`k1` = `test`.`x`.`i`) and (`test`.`y`.`name` in ('foo', .... 'row# 1999'))) order by `test`.`x`.`k1`
6438 select straight_join * from t1 x, t1 y where y.k1=x.i and y.name in ('foo', .... 'row# 1999' ) order by x.k1;
6439 k1 i name k1 i name
6440 4 4 row# 999 4 4 row# 999
6441 5 4 row# 1 4 4 row# 999
6442 6 4 row# 2 4 4 row# 999
6443 7 4 row# 3 4 4 row# 999
6444 8 4 row# 4 4 4 row# 999
6445 Warnings:
6446 Warning 3170 Memory capacity of 65536 bytes for 'range_optimizer_max_mem_size' exceeded. Range optimization was not done for this query.
6447 set range_optimizer_max_mem_size = @save_range_opt_max;
6448 drop table t1;
6449 ------------------------------------------------------------------
6450 Bug#35185670 'mysqld crashes on expensive query'
6451 or we may assert, or just hang until timeout...
6452
6453 create table t1 (
6454 k1 varchar(32) not null,
6455 k2 int not null default 0,
6456 primary key(k1,k2),
6457 i int default 0
6458 ) engine = ndbcluster
6459 partition by key() partitions 32;
6460 create table t2 (
6461 k1 int not null primary key
6462 ) engine = ndbcluster
6463 partition by key() partitions 32;
6464
6465 Inserting 2000 rows in table t1
6466 Table Op Msg_type Msg_text
6467 test.t1 analyze status OK
6468 Table Op Msg_type Msg_text
6469 test.t2 analyze status OK
6470
6471 Expect query and IN-condition to be pushed
6472 (If join_pushdown is enabled)
6473 explain select * from t1 left join t2 on t2.k1=t1.i where t1.k1 in ('foo', .... 'row# 1999' ) order by t1.k1, t1.k2;
6474 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6475 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31 range PRIMARY PRIMARY 130 NULL 2001 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`t1`.`k1` in ('foo', .... 'row# 1999')); Using MRR
6476 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31 eq_ref PRIMARY PRIMARY 4 test.t1.i 1 100.00 Child of 't1' in pushed join@1
6477 Warnings:
6478 Note 1003 /* select#1 */ select `test`.`t1`.`k1` AS `k1`,`test`.`t1`.`k2` AS `k2`,`test`.`t1`.`i` AS `i`,`test`.`t2`.`k1` AS `k1` from `test`.`t1` left join `test`.`t2` on((`test`.`t2`.`k1` = `test`.`t1`.`i`)) where (`test`.`t1`.`k1` in ('foo', .... 'row# 1999')) order by `test`.`t1`.`k1`,`test`.`t1`.`k2`
6479 select * from t1 left join t2 on t2.k1=t1.i where t1.k1 in ('foo', .... 'row# 1999' ) order by t1.k1, t1.k2;
6480 drop table t1;
6481 drop table t2;
6482 create table t(
6483 pk int primary key auto_increment,
6484 i int,
6485 j int,
6486 k int,
6487 index(i,j),
6488 index(i),
6489 index(j),
6490 index(k)
6491 ) engine = ndb
6492 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
6493 insert into t(i,j,k) values
6494 (1,1,1), (1,1,1), (1,1,1),
6495 (2,2,2), (2,2,2), (2,2,2);
6496 set global debug='+d,max_4rows_in_spj_batches';
6497 explain
6498 select straight_join count(*) from
6499 t as t1
6500 join t as t2 on t2.i = t1.i
6501 join (t as t3 join t as t4 on t4.k=t3.k join t as t5 on t5.i=t4.i and t5.j=t3.j) on t3.pk=t1.j
6502 join t as t6 on t6.k = t1.k
6503 where t1.i < 2;
6504 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6505 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 range i,i_2,j,k i 5 NULL # # Parent of 6 pushed join@1; Using pushed condition ((`test`.`t1`.`i` < 2) and (`test`.`t1`.`i` is not null) and (`test`.`t1`.`j` is not null) and (`test`.`t1`.`k` is not null)); Using MRR
6506 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref i,i_2 i 5 test.t1.i # # Child of 't1' in pushed join@1
6507 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,j,k PRIMARY 4 test.t1.j # # Child of 't1' in pushed join@1; Using pushed condition ((`test`.`t3`.`k` is not null) and (`test`.`t3`.`j` is not null))
6508 1 SIMPLE t4 p0,p1,p2,p3,p4,p5,p6,p7 ref i,i_2,k k 5 test.t3.k # # Child of 't3' in pushed join@1; Using pushed condition (`test`.`t4`.`i` is not null)
6509 1 SIMPLE t5 p0,p1,p2,p3,p4,p5,p6,p7 ref i,i_2,j i 10 test.t4.i,test.t3.j # # Child of 't4' in pushed join@1
6510 1 SIMPLE t6 p0,p1,p2,p3,p4,p5,p6,p7 ref k k 5 test.t1.k # # Child of 't1' in pushed join@1
6511 Warnings:
6512 Note 1003 /* select#1 */ select straight_join count(0) AS `count(*)` from `test`.`t` `t1` join `test`.`t` `t2` join `test`.`t` `t3` join `test`.`t` `t4` join `test`.`t` `t5` join `test`.`t` `t6` where ((`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t4`.`k` = `test`.`t3`.`k`) and (`test`.`t5`.`j` = `test`.`t3`.`j`) and (`test`.`t5`.`i` = `test`.`t4`.`i`) and (`test`.`t3`.`pk` = `test`.`t1`.`j`) and (`test`.`t6`.`k` = `test`.`t1`.`k`) and (`test`.`t1`.`i` < 2))
6513 select straight_join count(*) from
6514 t as t1
6515 join t as t2 on t2.i = t1.i
6516 join (t as t3 join t as t4 on t4.k=t3.k join t as t5 on t5.i=t4.i and t5.j=t3.j) on t3.pk=t1.j
6517 join t as t6 on t6.k = t1.k
6518 where t1.i < 2;
6519 count(*)
6520 243
6521 set global debug=@save_debug;
6522 drop table t;
6523 create table t1 (a int primary key, b int, c int, index(b,c)) engine = ndb
6524 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
6525 insert into t1 values (4,null, 2);
6526 explain
6527 select x.a from t1 as x join t1 as y on y.a = x.b where x.a=4;
6528 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6529 1 SIMPLE x p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY,b PRIMARY 4 const 1 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`x`.`b` is not null)
6530 1 SIMPLE y p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.x.b 1 100.00 Child of 'x' in pushed join@1
6531 Warnings:
6532 Note 1003 /* select#1 */ select `test`.`x`.`a` AS `a` from `test`.`t1` `x` join `test`.`t1` `y` where ((`test`.`y`.`a` = `test`.`x`.`b`) and (`test`.`x`.`a` = 4))
6533 select x.a from t1 as x join t1 as y on y.a = x.b where x.a=4;
6534 a
6535 drop table t1;
6536 CREATE TABLE t1 (
6537 a int NOT NULL,
6538 b int DEFAULT NULL,
6539 c int NOT NULL,
6540 d int NOT NULL,
6541 PRIMARY KEY (`a`)
6542 ) ENGINE=ndbcluster
6543 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
6544 create unique index ix1 on t1(b,c) using hash;
6545 Warnings:
6546 Warning 1121 Ndb does not support unique index on NULL valued attributes, index access with NULL value will become full table scan
6547 insert into t1 values (1,NULL,1,1);
6548 explain select * from t1 as x1 left join (t1 as x2 join t1 as x3 on x2.d=x3.c) on x1.b=x3.b;
6549 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6550 1 SIMPLE x1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 2 100.00 NULL
6551 1 SIMPLE x2 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 2 100.00 Parent of 2 pushed join@1
6552 1 SIMPLE x3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref ix1 ix1 9 test.x1.b,test.x2.d 1 100.00 Child of 'x2' in pushed join@1
6553 Warnings:
6554 Note 1003 Can't push table 'x2' as child, 'type' must be a 'ref' access
6555 Note 1003 Can't push table 'x3' as child of 'x1', column 'x2.d' refers a table which was not pushed
6556 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` from `test`.`t1` `x1` left join (`test`.`t1` `x2` join `test`.`t1` `x3`) on(((`test`.`x3`.`c` = `test`.`x2`.`d`) and (`test`.`x3`.`b` = `test`.`x1`.`b`))) where true
6557 create temporary table scan_count
6558 select * from performance_schema.global_status
6559 where variable_name = 'Ndb_scan_count';
6560 select * from t1 as x1 left join (t1 as x2 join t1 as x3 on x2.d=x3.c) on x1.b=x3.b;
6561 a b c d a b c d a b c d
6562 1 NULL 1 1 NULL NULL NULL NULL NULL NULL NULL NULL
6563 Warnings:
6564 Warning 1296 Prepared pushed join could not be executed, a paramValue was NULL
6565 select scan_count.VARIABLE_NAME,
6566 old.VARIABLE_VALUE - scan_count.VARIABLE_VALUE
6567 from scan_count, performance_schema.global_status as old
6568 where old.variable_name = 'Ndb_scan_count';
6569 VARIABLE_NAME old.VARIABLE_VALUE - scan_count.VARIABLE_VALUE
6570 Ndb_scan_count 2
6571 drop table scan_count;
6572 drop table t1;
6573 CREATE TABLE table1 (
6574 col_int_unique int(11),
6575 PRIMARY KEY (col_int_unique)
6576 ) ENGINE=ndbcluster
6577 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
6578 Warnings:
6579 Warning 1681 Integer display width is deprecated and will be removed in a future release.
6580 CREATE TABLE table3 (
6581 col_int int(11) NOT NULL DEFAULT '0',
6582 KEY (col_int)
6583 ) ENGINE=ndbcluster
6584 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
6585 Warnings:
6586 Warning 1681 Integer display width is deprecated and will be removed in a future release.
6587 CREATE TABLE table4 (
6588 col_int int(11) DEFAULT NULL,
6589 pk int(11) NOT NULL,
6590 PRIMARY KEY (pk)
6591 ) ENGINE=ndbcluster
6592 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
6593 Warnings:
6594 Warning 1681 Integer display width is deprecated and will be removed in a future release.
6595 Warning 1681 Integer display width is deprecated and will be removed in a future release.
6596 CREATE TABLE table6 (
6597 col_int int(11) DEFAULT NULL,
6598 col_int_unique int(11) DEFAULT NULL
6599 ) ENGINE=ndbcluster
6600 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
6601 Warnings:
6602 Warning 1681 Integer display width is deprecated and will be removed in a future release.
6603 Warning 1681 Integer display width is deprecated and will be removed in a future release.
6604 insert into table6 values
6605 (2,NULL),
6606 (2,NULL),
6607 (2,NULL),
6608 (2,NULL),
6609 (2,NULL),
6610 (2,NULL),
6611 (2,NULL),
6612 (2,NULL);
6613 set global debug='+d,max_4rows_in_spj_batches';
6614 EXPLAIN
6615 SELECT * FROM
6616 table1 RIGHT JOIN
6617 table3 LEFT JOIN table4 ON table3.col_int = table4.col_int
6618 JOIN
6619 table6 ON table4.pk = table6.col_int_unique
6620 ON table1.col_int_unique = table6.col_int;
6621 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6622 1 SIMPLE table6 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 8 100.00 Parent of 4 pushed join@1
6623 1 SIMPLE table4 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.table6.col_int_unique 1 100.00 Child of 'table6' in pushed join@1; Using pushed condition (`test`.`table4`.`col_int` is not null)
6624 1 SIMPLE table1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.table6.col_int 1 100.00 Child of 'table6' in pushed join@1
6625 1 SIMPLE table3 p0,p1,p2,p3,p4,p5,p6,p7 ref col_int col_int 4 test.table4.col_int 2 100.00 Child of 'table4' in pushed join@1
6626 Warnings:
6627 Note 1003 /* select#1 */ select `test`.`table1`.`col_int_unique` AS `col_int_unique`,`test`.`table3`.`col_int` AS `col_int`,`test`.`table4`.`col_int` AS `col_int`,`test`.`table4`.`pk` AS `pk`,`test`.`table6`.`col_int` AS `col_int`,`test`.`table6`.`col_int_unique` AS `col_int_unique` from `test`.`table3` join `test`.`table4` join `test`.`table6` left join `test`.`table1` on((`test`.`table1`.`col_int_unique` = `test`.`table6`.`col_int`)) where ((`test`.`table3`.`col_int` = `test`.`table4`.`col_int`) and (`test`.`table4`.`pk` = `test`.`table6`.`col_int_unique`))
6628 SELECT * FROM
6629 table1 RIGHT JOIN
6630 table3 LEFT JOIN table4 ON table3.col_int = table4.col_int
6631 JOIN
6632 table6 ON table4.pk = table6.col_int_unique
6633 ON table1.col_int_unique = table6.col_int;
6634 col_int_unique col_int col_int pk col_int col_int_unique
6635 set global debug=@save_debug;
6636 drop table table6;
6637 drop table table4;
6638 drop table table3;
6639 drop table table1;
6640 5.6 tests
6641 create table t1 (
6642 a int not null,
6643 b int not null,
6644 c int not null,
6645 d int not null,
6646 primary key (`a`,`b`),
6647 key(c), key(d)
6648 ) engine=ndbcluster
6649 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
6650 insert into t1 values
6651 (1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4),
6652 (1,2,5,1), (1,3,1,2), (1,4,2,3),
6653 (2,1,3,4), (2,3,4,5), (2,4,5,1),
6654 (3,1,1,2), (3,2,2,3), (3,4,3,4),
6655 (4,1,4,5), (4,2,5,1), (4,3,1,2);
6656 set global debug='+d,max_4rows_in_spj_batches';
6657 set @save_optimizer_switch = @@optimizer_switch;
6658 set optimizer_switch='materialization=off';
6659 explain
6660 select count(*) from t1 where
6661 t1.c in (select c from t1 as subq);
6662 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6663 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL c NULL NULL NULL 16 100.00 Parent of 2 pushed join@1
6664 1 SIMPLE subq p0,p1,p2,p3,p4,p5,p6,p7 ref c c 4 test.t1.c 2 100.00 Child of 't1' in pushed join@1; FirstMatch(t1)
6665 Warnings:
6666 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` semi join (`test`.`t1` `subq`) where (`test`.`subq`.`c` = `test`.`t1`.`c`)
6667 select count(*) from t1 where
6668 t1.c in (select c from t1 as subq);
6669 count(*)
6670 16
6671 explain
6672 select count(*) from t1 where
6673 t1.c in (select c from t1 as subq1) and
6674 t1.d in (select d from t1 as subq2);
6675 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6676 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL c,d NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
6677 1 SIMPLE subq1 p0,p1,p2,p3,p4,p5,p6,p7 ref c c 4 test.t1.c 2 100.00 Child of 't1' in pushed join@1; FirstMatch(t1)
6678 1 SIMPLE subq2 p0,p1,p2,p3,p4,p5,p6,p7 ref d d 4 test.t1.d 2 100.00 Child of 't1' in pushed join@1; FirstMatch(subq1)
6679 Warnings:
6680 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` semi join (`test`.`t1` `subq1`) semi join (`test`.`t1` `subq2`) where ((`test`.`subq2`.`d` = `test`.`t1`.`d`) and (`test`.`subq1`.`c` = `test`.`t1`.`c`))
6681 select count(*) from t1 where
6682 t1.c in (select c from t1 as subq1) and
6683 t1.d in (select d from t1 as subq2);
6684 count(*)
6685 16
6686 explain
6687 select count(*) from t1 where
6688 t1.c in (select c from t1 as subq1 where
6689 subq1.c in (select c from t1 as subq2));
6690 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6691 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL c NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
6692 1 SIMPLE subq1 p0,p1,p2,p3,p4,p5,p6,p7 ref c c 4 test.t1.c 2 100.00 Child of 't1' in pushed join@1
6693 1 SIMPLE subq2 p0,p1,p2,p3,p4,p5,p6,p7 ref c c 4 test.t1.c 2 100.00 Child of 't1' in pushed join@1; FirstMatch(t1)
6694 Warnings:
6695 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` semi join (`test`.`t1` `subq1` join `test`.`t1` `subq2`) where ((`test`.`subq1`.`c` = `test`.`t1`.`c`) and (`test`.`subq2`.`c` = `test`.`t1`.`c`))
6696 select count(*) from t1 where
6697 t1.c in (select c from t1 as subq1 where
6698 subq1.c in (select c from t1 as subq2));
6699 count(*)
6700 16
6701 explain
6702 select count(*) from t1 where
6703 t1.c in (select subq1.c from t1 as subq1 straight_join t1 as subq2 on subq1.a = subq2.c);
6704 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6705 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL c NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
6706 1 SIMPLE subq1 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY,c c 4 test.t1.c 2 100.00 Child of 't1' in pushed join@1
6707 1 SIMPLE subq2 p0,p1,p2,p3,p4,p5,p6,p7 ref c c 4 test.subq1.a 2 100.00 Child of 'subq1' in pushed join@1; FirstMatch(t1)
6708 Warnings:
6709 Note 1003 /* select#1 */ select count(0) AS `count(*)` from `test`.`t1` semi join (`test`.`t1` `subq1` straight_join `test`.`t1` `subq2`) where ((`test`.`subq2`.`c` = `test`.`subq1`.`a`) and (`test`.`subq1`.`c` = `test`.`t1`.`c`))
6710 select count(*) from t1 where
6711 t1.c in (select subq1.c from t1 as subq1 straight_join t1 as subq2 on subq1.a = subq2.c);
6712 count(*)
6713 16
6714 set optimizer_switch=@save_optimizer_switch;
6715 set global debug=@save_debug;
6716 #
6717 # Bug#29860378
6718 # RESULTS NOT SORTED AS SPECIFIED WHEN QUERY IS A 'PUSHED JOIN'
6719 #
6720 set global debug='+d,max_4rows_in_spj_batches';
6721 explain
6722 select straight_join t1.* from
6723 t1 join t1 as t2 on t2.d = t1.a
6724 where t1.a > 0
6725 order by t1.a,t1.b;
6726 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6727 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 range PRIMARY PRIMARY 4 NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`t1`.`a` > 0); Using MRR
6728 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref d d 4 test.t1.a 2 100.00 Child of 't1' in pushed join@1
6729 Warnings:
6730 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` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`d` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 0)) order by `test`.`t1`.`a`,`test`.`t1`.`b`
6731 select straight_join t1.* from
6732 t1 join t1 as t2 on t2.d = t1.a
6733 where t1.a > 0
6734 order by t1.a,t1.b;
6735 a b c d
6736 1 1 1 1
6737 1 1 1 1
6738 1 1 1 1
6739 1 1 1 1
6740 1 2 5 1
6741 1 2 5 1
6742 1 2 5 1
6743 1 2 5 1
6744 1 3 1 2
6745 1 3 1 2
6746 1 3 1 2
6747 1 3 1 2
6748 1 4 2 3
6749 1 4 2 3
6750 1 4 2 3
6751 1 4 2 3
6752 2 1 3 4
6753 2 1 3 4
6754 2 1 3 4
6755 2 1 3 4
6756 2 2 2 2
6757 2 2 2 2
6758 2 2 2 2
6759 2 2 2 2
6760 2 3 4 5
6761 2 3 4 5
6762 2 3 4 5
6763 2 3 4 5
6764 2 4 5 1
6765 2 4 5 1
6766 2 4 5 1
6767 2 4 5 1
6768 3 1 1 2
6769 3 1 1 2
6770 3 1 1 2
6771 3 2 2 3
6772 3 2 2 3
6773 3 2 2 3
6774 3 3 3 3
6775 3 3 3 3
6776 3 3 3 3
6777 3 4 3 4
6778 3 4 3 4
6779 3 4 3 4
6780 4 1 4 5
6781 4 1 4 5
6782 4 1 4 5
6783 4 2 5 1
6784 4 2 5 1
6785 4 2 5 1
6786 4 3 1 2
6787 4 3 1 2
6788 4 3 1 2
6789 4 4 4 4
6790 4 4 4 4
6791 4 4 4 4
6792 explain
6793 select straight_join t1.a,t1.b,count(*) from
6794 t1 join t1 as t2 on t2.d = t1.a
6795 where t1.a > 0
6796 group by t1.a,t1.b;
6797 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6798 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 range PRIMARY PRIMARY 4 NULL 3 100.00 Parent of 2 pushed join@1; Using pushed condition (`test`.`t1`.`a` > 0); Using MRR
6799 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref d d 4 test.t1.a 2 100.00 Child of 't1' in pushed join@1
6800 Warnings:
6801 Note 1003 /* select#1 */ select straight_join `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` where ((`test`.`t2`.`d` = `test`.`t1`.`a`) and (`test`.`t1`.`a` > 0)) group by `test`.`t1`.`a`,`test`.`t1`.`b`
6802 select straight_join t1.a,t1.b,count(*) from
6803 t1 join t1 as t2 on t2.d = t1.a
6804 where t1.a > 0
6805 group by t1.a,t1.b;
6806 a b count(*)
6807 1 1 4
6808 1 2 4
6809 1 3 4
6810 1 4 4
6811 2 1 4
6812 2 2 4
6813 2 3 4
6814 2 4 4
6815 3 1 3
6816 3 2 3
6817 3 3 3
6818 3 4 3
6819 4 1 3
6820 4 2 3
6821 4 3 3
6822 4 4 3
6823 set global debug=@save_debug;
6824 set @save_optimizer_switch = @@optimizer_switch;
6825 set @@optimizer_switch='semijoin=on';
6826 set @@optimizer_switch='loosescan=on';
6827 explain SELECT count(*)
6828 FROM (t1 AS table1 JOIN t1 AS table2 USING(a,b))
6829 WHERE table1.b IN
6830 (SELECT /*+ SEMIJOIN(LOOSESCAN)*/ table1s.c FROM t1 as table1s);
6831 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6832 1 SIMPLE table2 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
6833 1 SIMPLE table1s p0,p1,p2,p3,p4,p5,p6,p7 ref c c 4 test.table2.b 2 100.00 Child of 'table2' in pushed join@1; LooseScan
6834 1 SIMPLE table1 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.table2.a,test.table2.b 1 100.00 Child of 'table2' in pushed join@1
6835 Warnings:
6836 Note 1003 /* select#1 */ select /*+ SEMIJOIN(@`select#2` LOOSESCAN) */ count(0) AS `count(*)` from `test`.`t1` `table1` join `test`.`t1` `table2` semi join (`test`.`t1` `table1s`) where ((`test`.`table1`.`a` = `test`.`table2`.`a`) and (`test`.`table1s`.`c` = `test`.`table2`.`b`) and (`test`.`table1`.`b` = `test`.`table2`.`b`))
6837 SELECT count(*)
6838 FROM (t1 AS table1 JOIN t1 AS table2 USING(a,b))
6839 WHERE table1.b IN
6840 (SELECT /*+ SEMIJOIN(LOOSESCAN)*/ table1s.c FROM t1 as table1s);
6841 count(*)
6842 16
6843 set @@optimizer_switch='firstmatch=on';
6844 explain SELECT count(*)
6845 FROM (t1 AS table1 JOIN t1 AS table2 USING(a,b))
6846 WHERE table1.b IN
6847 (SELECT /*+ SEMIJOIN(FIRSTMATCH)*/ table1s.c FROM t1 as table1s);
6848 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6849 1 SIMPLE table1 p0,p1,p2,p3,p4,p5,p6,p7 ALL PRIMARY NULL NULL NULL 16 100.00 Parent of 3 pushed join@1
6850 1 SIMPLE table2 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.table1.a,test.table1.b 1 100.00 Child of 'table1' in pushed join@1
6851 1 SIMPLE table1s p0,p1,p2,p3,p4,p5,p6,p7 ref c c 4 test.table1.b 2 100.00 Child of 'table1' in pushed join@1; FirstMatch(table2)
6852 Warnings:
6853 Note 1003 /* select#1 */ select /*+ SEMIJOIN(@`select#2` FIRSTMATCH) */ count(0) AS `count(*)` from `test`.`t1` `table1` join `test`.`t1` `table2` semi join (`test`.`t1` `table1s`) where ((`test`.`table2`.`a` = `test`.`table1`.`a`) and (`test`.`table2`.`b` = `test`.`table1`.`b`) and (`test`.`table1s`.`c` = `test`.`table1`.`b`))
6854 SELECT count(*)
6855 FROM (t1 AS table1 JOIN t1 AS table2 USING(a,b))
6856 WHERE table1.b IN
6857 (SELECT /*+ SEMIJOIN(FIRSTMATCH)*/ table1s.c FROM t1 as table1s);
6858 count(*)
6859 16
6860 set optimizer_switch=@save_optimizer_switch;
6861 ####################################################################
6862 # WL#14370: Change EXPLAIN to use 'format=tree'. Traditional explain
6863 # didn't correctly represent the order of tables in MATERIALIZED
6864 # sub queries. That resulted in some confusing 'EXPLAIN_NO_PUSH' diffs
6865 # where the reported root/child order didn't make sense.
6866 # As the tree-format explain will show, the changed output
6867 # make more sense related to the query plan represented by the
6868 # AccessPath tree.
6869 # WL#14370: Materialized semijoin's is not the only SJ-strategi
6870 # where we do no pushdown across main-query -> sub-query border.
6871 # (The sub-query itself may be pushed though)
6872 ###################################################################
6873 set @save_optimizer_switch = @@optimizer_switch;
6874 set @@optimizer_switch='semijoin=on';
6875 set @@optimizer_switch='materialization=on';
6876 explain format=tree select count(*)
6877 from t1
6878 join t1 as t2 on t2.a = t1.b
6879 where t1.c IN (select /*+ SEMIJOIN(MATERIALIZATION)*/ c from t1 as t3);
6880 EXPLAIN
6881 -> Aggregate: count(0)
6882 -> Nested loop inner join
6883 -> Nested loop inner join
6884 -> Table scan on <subquery2>
6885 -> Materialize with deduplication
6886 -> Table scan on t3
6887 -> Index lookup on t1 using c (c=`<subquery2>`.c), activating pushed join of 2 tables
6888 -> Index lookup on t2 using PRIMARY (a=t1.b), child of t1 in pushed join
6889
6890 Warnings:
6891 Note 1003 Can't push table 't1' as child of 't3', it is in a materialized-branch which can't be referred.
6892 Note 1003 Can't push table 't2' as child of 't3', it is in a materialized-branch which can't be referred.
6893 select count(*)
6894 from t1
6895 join t1 as t2 on t2.a = t1.b
6896 where t1.c IN (select /*+ SEMIJOIN(MATERIALIZATION)*/ c from t1 as t3);
6897 count(*)
6898 64
6899 explain format=tree select count(*)
6900 from t1
6901 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
6902 where t1.c IN (select /*+ SEMIJOIN(MATERIALIZATION)*/ c from t1 as t3);
6903 EXPLAIN
6904 -> Aggregate: count(0)
6905 -> Nested loop inner join
6906 -> Nested loop inner join
6907 -> Table scan on <subquery2>
6908 -> Materialize with deduplication
6909 -> Table scan on t3
6910 -> Index lookup on t1 using c (c=`<subquery2>`.c), activating pushed join of 2 tables
6911 -> Single-row index lookup on t2 using PRIMARY (a=t1.b, b=`<subquery2>`.c), child of t1 in pushed join
6912
6913 Warnings:
6914 Note 1003 Can't push table 't1' as child of 't3', it is in a materialized-branch which can't be referred.
6915 Note 1003 Can't push table 't2' as child of 't3', it is in a materialized-branch which can't be referred.
6916 select count(*)
6917 from t1
6918 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
6919 where t1.c IN (select /*+ SEMIJOIN(MATERIALIZATION)*/ c from t1 as t3);
6920 count(*)
6921 13
6922 explain format=tree select count(*)
6923 from (select * from t1 where t1.c IN (select /*+ SEMIJOIN(MATERIALIZATION)*/ c from t1 as t3)) as t1
6924 join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
6925 EXPLAIN
6926 -> Aggregate: count(0)
6927 -> Nested loop inner join
6928 -> Nested loop inner join
6929 -> Table scan on <subquery3>
6930 -> Materialize with deduplication
6931 -> Table scan on t3
6932 -> Index lookup on t1 using c (c=`<subquery3>`.c), activating pushed join of 2 tables
6933 -> Single-row index lookup on t2 using PRIMARY (a=t1.b, b=`<subquery3>`.c), child of t1 in pushed join
6934
6935 Warnings:
6936 Note 1003 Can't push table 't1' as child of 't3', it is in a materialized-branch which can't be referred.
6937 Note 1003 Can't push table 't2' as child of 't3', it is in a materialized-branch which can't be referred.
6938 select count(*)
6939 from (select * from t1 where t1.c IN (select /*+ SEMIJOIN(MATERIALIZATION)*/ c from t1 as t3)) as t1
6940 join t1 as t2 on t2.a = t1.b and t2.b = t1.c;
6941 count(*)
6942 13
6943 explain format=tree select count(*)
6944 from (select * from t1 where t1.c IN (select /*+ SEMIJOIN(MATERIALIZATION)*/ c from t1 as t3)) as t1
6945 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
6946 where t1.c IN (select /*+ SEMIJOIN(MATERIALIZATION)*/ c from t1 as t4);
6947 EXPLAIN
6948 -> Aggregate: count(0)
6949 -> Nested loop inner join
6950 -> Nested loop inner join
6951 -> Nested loop inner join
6952 -> Table scan on <subquery3>
6953 -> Materialize with deduplication
6954 -> Table scan on t3
6955 -> Index lookup on t1 using c (c=`<subquery3>`.c), activating pushed join of 2 tables
6956 -> Single-row index lookup on t2 using PRIMARY (a=t1.b, b=`<subquery3>`.c), child of t1 in pushed join
6957 -> Filter: (`<subquery4>`.c = `<subquery3>`.c)
6958 -> Single-row index lookup on <subquery4> using <auto_distinct_key> (c=t1.c)
6959 -> Materialize with deduplication
6960 -> Table scan on t4
6961
6962 Warnings:
6963 Note 1003 Can't push table 't1' as child of 't3', it is in a materialized-branch which can't be referred.
6964 Note 1003 Can't push table 't2' as child of 't3', it is in a materialized-branch which can't be referred.
6965 Note 1003 Can't push table 't4' as child, 'type' must be a 'ref' access
6966 select count(*)
6967 from (select * from t1 where t1.c IN (select /*+ SEMIJOIN(MATERIALIZATION)*/ c from t1 as t3)) as t1
6968 join t1 as t2 on t2.a = t1.b and t2.b = t1.c
6969 where t1.c IN (select /*+ SEMIJOIN(MATERIALIZATION)*/ c from t1 as t4);
6970 count(*)
6971 13
6972 set optimizer_switch='block_nested_loop=off';
6973 explain format=tree select count(*)
6974 from t1 cross join t1 as t2
6975 where t2.c IN (select /*+ SEMIJOIN(MATERIALIZATION)*/ t4s.c
6976 from t1 as t3s join t1 as t4s on t4s.a = t3s.b);
6977 EXPLAIN
6978 -> Aggregate: count(0)
6979 -> Nested loop inner join
6980 -> Nested loop inner join
6981 -> Table scan on t1
6982 -> Table scan on <subquery2>
6983 -> Materialize with deduplication
6984 -> Nested loop inner join
6985 -> Table scan on t3s, activating pushed join of 2 tables
6986 -> Index lookup on t4s using PRIMARY (a=t3s.b), child of t3s in pushed join
6987 -> Index lookup on t2 using c (c=`<subquery2>`.c)
6988
6989 Warnings:
6990 Note 1003 Can't push table 't3s' as child, 'type' must be a 'ref' access
6991 Note 1003 Can't push table 't4s' as child of 't1', it is in a aggregated-branch which can't be referred.
6992 Note 1003 Can't push table 't2' as child of 't1', column '<subquery2>.c' is in a subquery-branch which can't be referred
6993 Note 1003 Can't push table 't2' as child of 't3s', it is in a materialized-branch which can't be referred.
6994 select count(*)
6995 from t1 cross join t1 as t2
6996 where t2.c IN (select /*+ SEMIJOIN(MATERIALIZATION)*/ t4s.c
6997 from t1 as t3s join t1 as t4s on t4s.a = t3s.b);
6998 count(*)
6999 256
7000 set optimizer_switch=@save_optimizer_switch;
7001 set global debug='+d,max_4rows_in_spj_batches';
7002 set @save_optimizer_switch = @@optimizer_switch;
7003 set @@optimizer_switch='semijoin=on';
7004 explain
7005 select count(*)
7006 from t1
7007 join t1 as t2 on t2.a = t1.b
7008 where t1.c IN (
7009 select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t3s.c from t1 as t3s
7010 join t1 as t4s on t4s.a = t3s.b);
7011 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
7012 1 SIMPLE t3s p0,p1,p2,p3,p4,p5,p6,p7 ALL c NULL NULL NULL 16 100.00 Parent of 3 pushed join@1; Start temporary
7013 1 SIMPLE t4s p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t3s.b 1 100.00 Child of 't3s' in pushed join@1
7014 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ref c c 4 test.t3s.c 2 100.00 Child of 't3s' in pushed join@1; End temporary
7015 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 NULL
7016 Warnings:
7017 Note 1003 Can't push table 't2' as child of 't3s', it is in a duplicate-weedout-branch which can't be referred.
7018 Note 1003 /* select#1 */ select /*+ SEMIJOIN(@`select#2` DUPSWEEDOUT) */ count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` semi join (`test`.`t1` `t3s` join `test`.`t1` `t4s`) where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t4s`.`a` = `test`.`t3s`.`b`) and (`test`.`t1`.`c` = `test`.`t3s`.`c`))
7019 select count(*)
7020 from t1
7021 join t1 as t2 on t2.a = t1.b
7022 where t1.c IN (
7023 select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t3s.c from t1 as t3s
7024 join t1 as t4s on t4s.a = t3s.b);
7025 count(*)
7026 64
7027 explain
7028 select count(*)
7029 from t1
7030 join t1 as t2 on t2.a = t1.b
7031 where t2.c IN (
7032 select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t3s.c from t1 as t3s
7033 join t1 as t4s on t4s.a = t3s.b);
7034 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
7035 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 4 pushed join@1
7036 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY,c PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1
7037 1 SIMPLE t3s p0,p1,p2,p3,p4,p5,p6,p7 ref c c 4 test.t2.c 2 100.00 Child of 't2' in pushed join@1; Start temporary
7038 1 SIMPLE t4s p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t3s.b 1 100.00 Child of 't3s' in pushed join@1; End temporary
7039 Warnings:
7040 Note 1003 /* select#1 */ select /*+ SEMIJOIN(@`select#2` DUPSWEEDOUT) */ count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` semi join (`test`.`t1` `t3s` join `test`.`t1` `t4s`) where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t4s`.`a` = `test`.`t3s`.`b`) and (`test`.`t3s`.`c` = `test`.`t2`.`c`))
7041 select count(*)
7042 from t1
7043 join t1 as t2 on t2.a = t1.b
7044 where t2.c IN (
7045 select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t3s.c from t1 as t3s
7046 join t1 as t4s on t4s.a = t3s.b);
7047 count(*)
7048 64
7049 explain
7050 select count(*)
7051 from t1
7052 join t1 as t2 on t2.a = t1.b
7053 join t1 as t3 on t3.a = t2.b
7054 where t1.c IN (
7055 select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
7056 join t1 as t5s on t5s.a = t4s.b
7057 join t1 as t6s on t6s.a = t5s.b
7058 );
7059 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
7060 1 SIMPLE t4s p0,p1,p2,p3,p4,p5,p6,p7 ALL c NULL NULL NULL 16 100.00 Parent of 4 pushed join@1; Start temporary
7061 1 SIMPLE t5s p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t4s.b 1 100.00 Child of 't4s' in pushed join@1
7062 1 SIMPLE t6s p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t5s.b 1 100.00 Child of 't5s' in pushed join@1
7063 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ref c c 4 test.t4s.c 2 100.00 Child of 't4s' in pushed join@1; End temporary
7064 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Parent of 2 pushed join@2
7065 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 Child of 't2' in pushed join@2
7066 Warnings:
7067 Note 1003 Can't push table 't2' as child of 't4s', it is in a duplicate-weedout-branch which can't be referred.
7068 Note 1003 Can't push table 't3' as child of 't4s', it is in a duplicate-weedout-branch which can't be referred.
7069 Note 1003 /* select#1 */ select /*+ SEMIJOIN(@`select#2` DUPSWEEDOUT) */ count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` semi join (`test`.`t1` `t4s` join `test`.`t1` `t5s` join `test`.`t1` `t6s`) where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t2`.`b`) and (`test`.`t5s`.`a` = `test`.`t4s`.`b`) and (`test`.`t6s`.`a` = `test`.`t5s`.`b`) and (`test`.`t1`.`c` = `test`.`t4s`.`c`))
7070 select count(*)
7071 from t1
7072 join t1 as t2 on t2.a = t1.b
7073 join t1 as t3 on t3.a = t2.b
7074 where t1.c IN (
7075 select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
7076 join t1 as t5s on t5s.a = t4s.b
7077 join t1 as t6s on t6s.a = t5s.b
7078 );
7079 count(*)
7080 256
7081 explain
7082 select count(*)
7083 from t1
7084 join t1 as t2 on t2.a = t1.b
7085 join t1 as t3 on t3.a = t2.b
7086 where t2.c IN (
7087 select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
7088 join t1 as t5s on t5s.a = t4s.b
7089 join t1 as t6s on t6s.a = t5s.b
7090 );
7091 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
7092 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 6 pushed join@1
7093 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY,c PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1
7094 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t2.b 1 100.00 Child of 't2' in pushed join@1
7095 1 SIMPLE t4s p0,p1,p2,p3,p4,p5,p6,p7 ref c c 4 test.t2.c 2 100.00 Child of 't2' in pushed join@1; Start temporary
7096 1 SIMPLE t5s p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t4s.b 1 100.00 Child of 't4s' in pushed join@1
7097 1 SIMPLE t6s p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t5s.b 1 100.00 Child of 't5s' in pushed join@1; End temporary
7098 Warnings:
7099 Note 1003 /* select#1 */ select /*+ SEMIJOIN(@`select#2` DUPSWEEDOUT) */ count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` semi join (`test`.`t1` `t4s` join `test`.`t1` `t5s` join `test`.`t1` `t6s`) where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t2`.`b`) and (`test`.`t5s`.`a` = `test`.`t4s`.`b`) and (`test`.`t6s`.`a` = `test`.`t5s`.`b`) and (`test`.`t4s`.`c` = `test`.`t2`.`c`))
7100 select count(*)
7101 from t1
7102 join t1 as t2 on t2.a = t1.b
7103 join t1 as t3 on t3.a = t2.b
7104 where t2.c IN (
7105 select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
7106 join t1 as t5s on t5s.a = t4s.b
7107 join t1 as t6s on t6s.a = t5s.b
7108 );
7109 count(*)
7110 256
7111 explain
7112 select count(*)
7113 from t1
7114 join t1 as t2 on t2.a = t1.b
7115 join t1 as t3 on t3.a = t2.b
7116 where t3.c IN (
7117 select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
7118 join t1 as t5s on t5s.a = t4s.b
7119 join t1 as t6s on t6s.a = t5s.b
7120 );
7121 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
7122 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL NULL NULL NULL NULL 16 100.00 Parent of 6 pushed join@1
7123 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Child of 't1' in pushed join@1
7124 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY,c PRIMARY 4 test.t2.b 1 100.00 Child of 't2' in pushed join@1
7125 1 SIMPLE t4s p0,p1,p2,p3,p4,p5,p6,p7 ref c c 4 test.t3.c 2 100.00 Child of 't3' in pushed join@1; Start temporary
7126 1 SIMPLE t5s p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t4s.b 1 100.00 Child of 't4s' in pushed join@1
7127 1 SIMPLE t6s p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t5s.b 1 100.00 Child of 't5s' in pushed join@1; End temporary
7128 Warnings:
7129 Note 1003 /* select#1 */ select /*+ SEMIJOIN(@`select#2` DUPSWEEDOUT) */ count(0) AS `count(*)` from `test`.`t1` join `test`.`t1` `t2` join `test`.`t1` `t3` semi join (`test`.`t1` `t4s` join `test`.`t1` `t5s` join `test`.`t1` `t6s`) where ((`test`.`t2`.`a` = `test`.`t1`.`b`) and (`test`.`t3`.`a` = `test`.`t2`.`b`) and (`test`.`t5s`.`a` = `test`.`t4s`.`b`) and (`test`.`t6s`.`a` = `test`.`t5s`.`b`) and (`test`.`t4s`.`c` = `test`.`t3`.`c`))
7130 select count(*)
7131 from t1
7132 join t1 as t2 on t2.a = t1.b
7133 join t1 as t3 on t3.a = t2.b
7134 where t3.c IN (
7135 select /*+ SEMIJOIN(DUPSWEEDOUT)*/ t4s.c from t1 as t4s
7136 join t1 as t5s on t5s.a = t4s.b
7137 join t1 as t6s on t6s.a = t5s.b
7138 );
7139 count(*)
7140 256
7141 set global debug=@save_debug;
7142 set optimizer_switch=@save_optimizer_switch;
7143 ###########
7144 # WL#14370: EXPLAIN need to use 'format=tree as table access order
7145 # in MATERIALIZED execution is not currectly represented by
7146 # the traditional explain.
7147 ###########
7148 explain format=tree select count(*)
7149 from t1
7150 join t1 as t2 on t2.a = t1.b
7151 where t1.c IN (
7152 select /*+ SEMIJOIN(MATERIALIZATION)*/ t3s.c from t1 as t3s
7153 join t1 as t4s on t4s.a = t3s.b);
7154 EXPLAIN
7155 -> Aggregate: count(0)
7156 -> Nested loop inner join
7157 -> Nested loop inner join
7158 -> Table scan on <subquery2>
7159 -> Materialize with deduplication
7160 -> Nested loop inner join
7161 -> Table scan on t3s, activating pushed join of 2 tables
7162 -> Index lookup on t4s using PRIMARY (a=t3s.b), child of t3s in pushed join
7163 -> Index lookup on t1 using c (c=`<subquery2>`.c), activating pushed join of 2 tables
7164 -> Index lookup on t2 using PRIMARY (a=t1.b), child of t1 in pushed join
7165
7166 Warnings:
7167 Note 1003 Can't push table 't1' as child of 't3s', it is in a materialized-branch which can't be referred.
7168 Note 1003 Can't push table 't2' as child of 't3s', it is in a materialized-branch which can't be referred.
7169 select count(*)
7170 from t1
7171 join t1 as t2 on t2.a = t1.b
7172 where t1.c IN (
7173 select /*+ SEMIJOIN(MATERIALIZATION)*/ t3s.c from t1 as t3s
7174 join t1 as t4s on t4s.a = t3s.b);
7175 count(*)
7176 64
7177 explain format=tree select count(*)
7178 from t1
7179 join t1 as t2 on t2.a = t1.b
7180 where t1.c IN(
7181 select /*+ SEMIJOIN(MATERIALIZATION)*/ t3s1.c from t1 as t3s1
7182 join t1 as t4s1 on t4s1.a = t3s1.b
7183 )
7184 and t1.d IN (
7185 select /*+ SEMIJOIN(MATERIALIZATION)*/ t3s2.c from t1 as t3s2
7186 join t1 as t4s2 on t4s2.a = t3s2.b
7187 );
7188 EXPLAIN
7189 -> Aggregate: count(0)
7190 -> Nested loop inner join
7191 -> Nested loop inner join
7192 -> Nested loop inner join
7193 -> Table scan on <subquery2>
7194 -> Materialize with deduplication
7195 -> Nested loop inner join
7196 -> Table scan on t3s1, activating pushed join of 2 tables
7197 -> Index lookup on t4s1 using PRIMARY (a=t3s1.b), child of t3s1 in pushed join
7198 -> Index lookup on t1 using c (c=`<subquery2>`.c), activating pushed join of 2 tables
7199 -> Index lookup on t2 using PRIMARY (a=t1.b), child of t1 in pushed join
7200 -> Single-row index lookup on <subquery3> using <auto_distinct_key> (c=t1.d)
7201 -> Materialize with deduplication
7202 -> Nested loop inner join
7203 -> Table scan on t3s2, activating pushed join of 2 tables
7204 -> Index lookup on t4s2 using PRIMARY (a=t3s2.b), child of t3s2 in pushed join
7205
7206 Warnings:
7207 Note 1003 Can't push table 't1' as child of 't3s1', it is in a materialized-branch which can't be referred.
7208 Note 1003 Can't push table 't2' as child of 't3s1', it is in a materialized-branch which can't be referred.
7209 Note 1003 Can't push table 't3s2' as child, 'type' must be a 'ref' access
7210 Note 1003 Can't push table 't4s2' as child of 't3s1', it is in a materialized-branch which can't be referred.
7211 Note 1003 Can't push table 't4s2' as child of 't1', it is in a aggregated-branch which can't be referred.
7212 select count(*)
7213 from t1
7214 join t1 as t2 on t2.a = t1.b
7215 where t1.c IN(
7216 select /*+ SEMIJOIN(MATERIALIZATION)*/ t3s1.c from t1 as t3s1
7217 join t1 as t4s1 on t4s1.a = t3s1.b
7218 )
7219 and t1.d IN (
7220 select /*+ SEMIJOIN(MATERIALIZATION)*/ t3s2.c from t1 as t3s2
7221 join t1 as t4s2 on t4s2.a = t3s2.b
7222 );
7223 count(*)
7224 64
7225 explain
7226 select /*+ BKA(t2) NO_BKA(t3) */ t1.a, t2.a, t3.a
7227 from t1
7228 straight_join t1 as t2 on t2.a = t1.c
7229 straight_join t1 as t3 on t3.a = t2.c and t3.b=t2.d;
7230 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
7231 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL c NULL NULL NULL 16 100.00 NULL
7232 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY,c,d PRIMARY 4 test.t1.c 1 100.00 Parent of 2 pushed join@1; Using join buffer (Batched Key Access)
7233 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t2.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
7234 Warnings:
7235 Note 1003 Can't push table 't2' as child, access type 'Batched-key' not implemented
7236 Note 1003 Can't push table 't3' as child of 't1', it is in a batched-keys-branch which can't be referred.
7237 Note 1003 /* select#1 */ select /*+ BKA(`t2`@`select#1`) NO_BKA(`t3`@`select#1`) */ `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a` from `test`.`t1` straight_join `test`.`t1` `t2` straight_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`))
7238 select /*+ BKA(t2) NO_BKA(t3) */ t1.a, t2.a, t3.a
7239 from t1
7240 straight_join t1 as t2 on t2.a = t1.c
7241 straight_join t1 as t3 on t3.a = t2.c and t3.b=t2.d;
7242 a a a
7243 1 1 1
7244 1 1 1
7245 1 1 1
7246 1 1 1
7247 1 1 2
7248 1 1 2
7249 1 2 2
7250 1 2 3
7251 2 2 2
7252 2 2 3
7253 2 3 1
7254 2 3 2
7255 2 3 3
7256 2 3 3
7257 2 4 1
7258 2 4 4
7259 3 1 1
7260 3 1 1
7261 3 1 2
7262 3 2 2
7263 3 2 3
7264 3 3 1
7265 3 3 1
7266 3 3 2
7267 3 3 2
7268 3 3 3
7269 3 3 3
7270 3 3 3
7271 3 3 3
7272 4 1 1
7273 4 1 1
7274 4 1 2
7275 4 4 1
7276 4 4 1
7277 4 4 4
7278 4 4 4
7279 explain
7280 select /*+ BKA(t2) NO_BKA(t3) */ t1.a, t2.a, t3.a
7281 from t1
7282 straight_join t1 as t2 on t2.a = t1.c
7283 straight_join t1 as t3 on t3.a = t1.c and t3.b=t2.d;
7284 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
7285 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 ALL c NULL NULL NULL 16 100.00 NULL
7286 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY,d PRIMARY 4 test.t1.c 1 100.00 Parent of 2 pushed join@1; Using join buffer (Batched Key Access)
7287 1 SIMPLE t3 p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 8 test.t1.c,test.t2.d 1 100.00 Child of 't2' in pushed join@1
7288 Warnings:
7289 Note 1003 Can't push table 't2' as child, access type 'Batched-key' not implemented
7290 Note 1003 Can't push table 't3' as child of 't1', it is in a batched-keys-branch which can't be referred.
7291 Note 1003 /* select#1 */ select /*+ BKA(`t2`@`select#1`) NO_BKA(`t3`@`select#1`) */ `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a` from `test`.`t1` straight_join `test`.`t1` `t2` straight_join `test`.`t1` `t3` where ((`test`.`t3`.`b` = `test`.`t2`.`d`) and (`test`.`t2`.`a` = `test`.`t1`.`c`) and (`test`.`t3`.`a` = `test`.`t1`.`c`))
7292 select /*+ BKA(t2) NO_BKA(t3) */ t1.a, t2.a, t3.a
7293 from t1
7294 straight_join t1 as t2 on t2.a = t1.c
7295 straight_join t1 as t3 on t3.a = t1.c and t3.b=t2.d;
7296 a a a
7297 1 1 1
7298 1 1 1
7299 1 1 1
7300 1 1 1
7301 1 1 1
7302 1 1 1
7303 1 1 1
7304 1 1 1
7305 1 2 2
7306 1 2 2
7307 1 2 2
7308 2 2 2
7309 2 2 2
7310 2 2 2
7311 2 3 3
7312 2 3 3
7313 2 3 3
7314 2 3 3
7315 2 4 4
7316 2 4 4
7317 2 4 4
7318 3 1 1
7319 3 1 1
7320 3 1 1
7321 3 1 1
7322 3 2 2
7323 3 2 2
7324 3 2 2
7325 3 3 3
7326 3 3 3
7327 3 3 3
7328 3 3 3
7329 3 3 3
7330 3 3 3
7331 3 3 3
7332 3 3 3
7333 4 1 1
7334 4 1 1
7335 4 1 1
7336 4 1 1
7337 4 4 4
7338 4 4 4
7339 4 4 4
7340 4 4 4
7341 4 4 4
7342 4 4 4
7343 drop table t1;
7344 CREATE TABLE ndb_order_test (
7345 node_id int(10) unsigned NOT NULL,
7346 user_id int(10) unsigned NOT NULL,
7347 sort_number int(10) unsigned NOT NULL,
7348 KEY node_id (node_id,sort_number)
7349 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8
7350 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
7351 Warnings:
7352 Warning 1681 Integer display width is deprecated and will be removed in a future release.
7353 Warning 1681 Integer display width is deprecated and will be removed in a future release.
7354 Warning 1681 Integer display width is deprecated and will be removed in a future release.
7355 Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
7356 CREATE TABLE ndb_user_test (
7357 user_id int(10) unsigned NOT NULL AUTO_INCREMENT,
7358 name varchar(20) NOT NULL,
7359 PRIMARY KEY (user_id)
7360 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8 AUTO_INCREMENT=2
7361 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
7362 Warnings:
7363 Warning 1681 Integer display width is deprecated and will be removed in a future release.
7364 Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
7365 INSERT INTO ndb_order_test (node_id, user_id, sort_number) VALUES
7366 (68, 1, 1398029),
7367 (68, 1, 549053);
7368 INSERT INTO ndb_user_test (user_id, name) VALUES
7369 (1, 'Shawn');
7370 EXPLAIN
7371 SELECT *
7372 FROM ndb_order_test JOIN ndb_user_test USING (user_id)
7373 WHERE node_id = 68
7374 ORDER BY sort_number DESC;
7375 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
7376 1 SIMPLE ndb_order_test p0,p1,p2,p3,p4,p5,p6,p7 ref node_id node_id 4 const 2 100.00 Parent of 2 pushed join@1; Backward index scan
7377 1 SIMPLE ndb_user_test p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.ndb_order_test.user_id 1 100.00 Child of 'ndb_order_test' in pushed join@1
7378 Warnings:
7379 Note 1003 /* select#1 */ select `test`.`ndb_order_test`.`user_id` AS `user_id`,`test`.`ndb_order_test`.`node_id` AS `node_id`,`test`.`ndb_order_test`.`sort_number` AS `sort_number`,`test`.`ndb_user_test`.`name` AS `name` from `test`.`ndb_order_test` join `test`.`ndb_user_test` where ((`test`.`ndb_user_test`.`user_id` = `test`.`ndb_order_test`.`user_id`) and (`test`.`ndb_order_test`.`node_id` = 68)) order by `test`.`ndb_order_test`.`sort_number` desc
7380 SELECT *
7381 FROM ndb_order_test JOIN ndb_user_test USING (user_id)
7382 WHERE node_id = 68
7383 ORDER BY sort_number DESC;
7384 user_id node_id sort_number name
7385 1 68 1398029 Shawn
7386 1 68 549053 Shawn
7387 EXPLAIN
7388 SELECT *
7389 FROM ndb_order_test JOIN ndb_user_test USING (user_id)
7390 WHERE node_id = 68
7391 ORDER BY sort_number ASC;
7392 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
7393 1 SIMPLE ndb_order_test p0,p1,p2,p3,p4,p5,p6,p7 ref node_id node_id 4 const 2 100.00 Parent of 2 pushed join@1
7394 1 SIMPLE ndb_user_test p0,p1,p2,p3,p4,p5,p6,p7 eq_ref PRIMARY PRIMARY 4 test.ndb_order_test.user_id 1 100.00 Child of 'ndb_order_test' in pushed join@1
7395 Warnings:
7396 Note 1003 /* select#1 */ select `test`.`ndb_order_test`.`user_id` AS `user_id`,`test`.`ndb_order_test`.`node_id` AS `node_id`,`test`.`ndb_order_test`.`sort_number` AS `sort_number`,`test`.`ndb_user_test`.`name` AS `name` from `test`.`ndb_order_test` join `test`.`ndb_user_test` where ((`test`.`ndb_user_test`.`user_id` = `test`.`ndb_order_test`.`user_id`) and (`test`.`ndb_order_test`.`node_id` = 68)) order by `test`.`ndb_order_test`.`sort_number`
7397 SELECT *
7398 FROM ndb_order_test JOIN ndb_user_test USING (user_id)
7399 WHERE node_id = 68
7400 ORDER BY sort_number ASC;
7401 user_id node_id sort_number name
7402 1 68 549053 Shawn
7403 1 68 1398029 Shawn
7404 DROP TABLE ndb_order_test, ndb_user_test;
7405 ##################
7406 #
7407 # Bug #29501263 CRASH IN SPJ BLOCK, ILLEGAL ACCESS
7408 # TO ARRAYPOOL<T>::GETPTR
7409 #
7410 ##################
7411 create table t1 (
7412 pk int primary key,
7413 i1 int
7414 ) engine = ndb;
7415 insert into t1 values (1,1),(2,2),(3,3);
7416 alter table t1 add column (i2 int, i3 int, i4 int, i5 int);
7417 Warnings:
7418 Warning 1478 Converted FIXED field 'i2' to DYNAMIC to enable online ADD COLUMN
7419 Warning 1478 Converted FIXED field 'i3' to DYNAMIC to enable online ADD COLUMN
7420 Warning 1478 Converted FIXED field 'i4' to DYNAMIC to enable online ADD COLUMN
7421 Warning 1478 Converted FIXED field 'i5' to DYNAMIC to enable online ADD COLUMN
7422 update t1 set i2=i1, i3=i1, i4=i1, i5=i1;
7423 alter table t1 add index ix1(i1);
7424 alter table t1 add index ix2(i2);
7425 alter table t1 add index ix3(i3);
7426 alter table t1 add index ix4(i4);
7427 alter table t1 add index ix5(i5);
7428 alter table t1 add unique index uix(i4,i5);
7429 select straight_join * from
7430 t1
7431 join t1 as t2 on t2.i1 = t1.i1
7432 join t1 as t3 on t3.pk = t2.i2
7433 left join t1 as t4 on t4.pk = t3.i3
7434 left join t1 as t5 on t5.i4 = t2.i4 and t5.i5 = t1.i5;
7435 pk i1 i2 i3 i4 i5 pk i1 i2 i3 i4 i5 pk i1 i2 i3 i4 i5 pk i1 i2 i3 i4 i5 pk i1 i2 i3 i4 i5
7436 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 1 1 1 1 1
7437 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 2 2 2 2 2
7438 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 3 3 3 3
7439 drop table t1;
7440 ##################
7441 #
7442 # Bug#32203548 REQUIRE_FAILED WHEN COMPARE_NDBRECORD()
7443 # SORT-MERGE SPJ RESULTS FROM INDEX
7444 #
7445 ##################
7446 create table t1 (
7447 a int not null,
7448 b int not null,
7449 c varchar(1) not null,
7450 d varchar(1) not null,
7451 primary key (a,b),
7452 index ix2 (d,c)
7453 ) engine=ndbcluster;
7454 insert into t1 values
7455 (1,1,"1","1"), (2,2,"2","1"), (3,3,"3","1"), (4,4,"4","1"),
7456 (1,2,"5","1"), (1,3,"1","1"), (1,4,"2","1"),
7457 (2,1,"3","1"), (2,3,"4","1"), (2,4,"5","1");
7458 explain
7459 select t1.d from t1 FORCE INDEX FOR ORDER BY (ix2)
7460 straight_join t1 as t2 on t2.a = t1.a
7461 order by t1.d;
7462 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
7463 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7 index PRIMARY ix2 12 NULL 10 100.00 Parent of 2 pushed join@1
7464 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7 ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Child of 't1' in pushed join@1
7465 Warnings:
7466 Note 1003 /* select#1 */ select `test`.`t1`.`d` AS `d` from `test`.`t1` FORCE INDEX FOR ORDER BY (`ix2`) straight_join `test`.`t1` `t2` where (`test`.`t2`.`a` = `test`.`t1`.`a`) order by `test`.`t1`.`d`
7467 select t1.d from t1 FORCE INDEX FOR ORDER BY (ix2)
7468 straight_join t1 as t2 on t2.a = t1.a
7469 order by t1.d;
7470 d
7471 1
7472 1
7473 1
7474 1
7475 1
7476 1
7477 1
7478 1
7479 1
7480 1
7481 1
7482 1
7483 1
7484 1
7485 1
7486 1
7487 1
7488 1
7489 1
7490 1
7491 1
7492 1
7493 1
7494 1
7495 1
7496 1
7497 1
7498 1
7499 1
7500 1
7501 1
7502 1
7503 1
7504 1
7505 drop table t1;
7506 ##################
7507 #
7508 # Specific WL-14370, 'AccessPath' tests
7509 # (Unknown if/how this worked pre-wl-14370)
7510 #
7511 ##################
7512 Testcase for AccessPath::NESTED_LOOP_SEMIJOIN_WITH_DUPLICATE_REMOVAL
7513 Expect explain: 'Nested loop semijoin with duplicate removal on...'
7514 (Hardly ever used unless forced to...)
7515 Testcase for AccessPath::WINDOWING
7516 create table t2(a int) engine=ndbcluster;
7517 insert into t2 values(1), (2);
7518 create table t3(a int, b int) engine=ndbcluster;
7519 insert into t3 values(1, 3), (2, 3);
7520 explain format=tree select a,
7521 (select sum(a) over w from t2 window w as(order by t3.a) limit 1)
7522 from t3;
7523 EXPLAIN
7524 -> Table scan on t3
7525 -> Select #2 (subquery in projection; dependent)
7526 -> Limit: 1 row(s)
7527 -> Window aggregate with buffering: sum(t2.a) OVER w
7528 -> Sort: t3.a
7529 -> Table scan on t2
7530
7531 Warnings:
7532 Note 1276 Field or reference 'test.t3.a' of SELECT #2 was resolved in SELECT #1
7533 select a,
7534 (select sum(a) over w from t2 window w as(order by t3.a) limit 1)
7535 from t3;
7536 a (select sum(a) over w from t2 window w as(order by t3.a) limit 1)
7537 1 3
7538 2 3
7539 drop table t2,t3;
7540 create table t1 (
7541 a int not null,
7542 b int not null,
7543 c int not null,
7544 d int not null,
7545 primary key (`a`,`b`)
7546 ) engine=ndbcluster
7547 partition by key() partitions 8;
7548 insert into t1 values
7549 (1,1,1,1), (2,2,2,2), (3,3,3,3), (4,4,4,4),
7550 (1,2,5,1), (1,3,1,2), (1,4,2,3),
7551 (2,1,3,4), (2,3,4,5), (2,4,5,1),
7552 (3,1,1,2), (3,2,2,3), (3,4,3,4),
7553 (4,1,4,5), (4,2,5,1), (4,3,1,2);
7554 explain format=tree select *
7555 from t1
7556 straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
7557 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b
7558 where t1.a=1 and t1.d=1 union all select *
7559 from t1
7560 straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
7561 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b
7562 where t1.a=1 and t1.d=1;
7563 EXPLAIN
7564 -> Append
7565 -> Stream results
7566 -> Nested loop inner join
7567 -> Nested loop inner join
7568 -> Index lookup on t1 using PRIMARY (a=1), activating pushed join of 2 tables, with pushed condition: (t1.d = 1)
7569 -> Filter: (t2.a = (t1.b + 0))
7570 -> Single-row index lookup on t2 using PRIMARY (a=(t1.b + 0), b=t1.c)
7571 -> Single-row index lookup on t3 using PRIMARY (a=t1.b, b=t1.c), child of t1 in pushed join
7572 -> Stream results
7573 -> Nested loop inner join
7574 -> Nested loop inner join
7575 -> Index lookup on t1 using PRIMARY (a=1), activating pushed join of 2 tables, with pushed condition: (t1.d = 1)
7576 -> Filter: (t2.a = (t1.b + 0))
7577 -> Single-row index lookup on t2 using PRIMARY (a=(t1.b + 0), b=t1.c)
7578 -> Single-row index lookup on t3 using PRIMARY (a=t1.b, b=t1.c), child of t1 in pushed join
7579
7580 Warnings:
7581 Note 1003 Can't push table 't2' as child, column 'a' does neither 'ref' a column nor a constant
7582 Note 1003 Can't push table 't2' as child, column 'a' does neither 'ref' a column nor a constant
7583 select *
7584 from t1
7585 straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
7586 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b
7587 where t1.a=1 and t1.d=1 union all select *
7588 from t1
7589 straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
7590 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b
7591 where t1.a=1 and t1.d=1;
7592 a b c d a b c d a b c d
7593 1 1 1 1 1 1 1 1 1 1 1 1
7594 1 1 1 1 1 1 1 1 1 1 1 1
7595 explain format=tree select *
7596 from t1
7597 straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
7598 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b
7599 where t1.a=1 and t1.d=1 union select *
7600 from t1
7601 straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
7602 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b
7603 where t1.a=1 and t1.d=1;
7604 EXPLAIN
7605 -> Table scan on <union temporary>
7606 -> Union materialize with deduplication
7607 -> Nested loop inner join
7608 -> Nested loop inner join
7609 -> Index lookup on t1 using PRIMARY (a=1), activating pushed join of 2 tables, with pushed condition: (t1.d = 1)
7610 -> Filter: (t2.a = (t1.b + 0))
7611 -> Single-row index lookup on t2 using PRIMARY (a=(t1.b + 0), b=t1.c)
7612 -> Single-row index lookup on t3 using PRIMARY (a=t1.b, b=t1.c), child of t1 in pushed join
7613 -> Nested loop inner join
7614 -> Nested loop inner join
7615 -> Index lookup on t1 using PRIMARY (a=1), activating pushed join of 2 tables, with pushed condition: (t1.d = 1)
7616 -> Filter: (t2.a = (t1.b + 0))
7617 -> Single-row index lookup on t2 using PRIMARY (a=(t1.b + 0), b=t1.c)
7618 -> Single-row index lookup on t3 using PRIMARY (a=t1.b, b=t1.c), child of t1 in pushed join
7619
7620 Warnings:
7621 Note 1003 Can't push table 't2' as child, column 'a' does neither 'ref' a column nor a constant
7622 Note 1003 Can't push table 't2' as child, column 'a' does neither 'ref' a column nor a constant
7623 select *
7624 from t1
7625 straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
7626 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b
7627 where t1.a=1 and t1.d=1 union select *
7628 from t1
7629 straight_join t1 as t2 on t2.a = t1.b+0 and t2.b = t1.c
7630 straight_join t1 as t3 on t3.a = t1.b and t3.b = t2.b
7631 where t1.a=1 and t1.d=1;
7632 a b c d a b c d a b c d
7633 1 1 1 1 1 1 1 1 1 1 1 1
7634 drop table t1;
7635 ##################
7636 #
7637 # Bug#33669039 Stale rows returned from SPJ API,
7638 # hit assert(key_cmp_if_same(...)) in debug build
7639 #
7640 ##################
7641 create table t (
7642 pk int primary key,
7643 a int,
7644 b int,
7645 c int,
7646 d int
7647 ) engine = ndbcluster;
7648 insert into t values (0,0,0,0,0);
7649 insert into t values (1,1,1,1,1);
7650 insert into t values (2,2,2,2,2);
7651 insert into t values (3,3,3,3,3);
7652 insert into t values (4,4,4,4,4);
7653 insert into t values (5,5,5,5,5);
7654 insert into t values (6,6,6,6,6);
7655 insert into t values (7,-1,7,7,7);
7656 insert into t values (8,8,8,8,8);
7657 insert into t values (9,9,9,9,9);
7658 insert into t values (10,10,10,10,10);
7659 insert into t values (11,11,11,11,11);
7660 insert into t values (12,12,12,12,12);
7661 insert into t values (13,13,13,13,13);
7662 insert into t values (14,14,14,14,14);
7663 insert into t values (15,15,15,15,15);
7664 explain format=tree select t1.pk, t2.pk, t3.pk, t4.pk, t5.pk
7665 from t as t1
7666 left join (
7667 t as t2
7668 straight_join t as t3 on t3.pk = t2.b
7669 ) on t2.pk = t1.a
7670 left join (
7671 t as t4
7672 straight_join t as t5
7673 ) on t4.pk = t1.c and t5.pk = t3.d;
7674 EXPLAIN
7675 -> Nested loop left join
7676 -> Nested loop left join
7677 -> Table scan on t1, activating pushed join of 5 tables
7678 -> Nested loop inner join
7679 -> Single-row index lookup on t2 using PRIMARY (pk=t1.a), child of t1 in pushed join
7680 -> Single-row index lookup on t3 using PRIMARY (pk=t2.b), child of t2 in pushed join
7681 -> Nested loop inner join
7682 -> Single-row index lookup on t4 using PRIMARY (pk=t1.c), child of t3 in pushed join
7683 -> Single-row index lookup on t5 using PRIMARY (pk=t3.d), child of t3 in pushed join
7684
7685 select t1.pk, t2.pk, t3.pk, t4.pk, t5.pk
7686 from t as t1
7687 left join (
7688 t as t2
7689 straight_join t as t3 on t3.pk = t2.b
7690 ) on t2.pk = t1.a
7691 left join (
7692 t as t4
7693 straight_join t as t5
7694 ) on t4.pk = t1.c and t5.pk = t3.d;
7695 pk pk pk pk pk
7696 0 0 0 0 0
7697 1 1 1 1 1
7698 10 10 10 10 10
7699 11 11 11 11 11
7700 12 12 12 12 12
7701 13 13 13 13 13
7702 14 14 14 14 14
7703 15 15 15 15 15
7704 2 2 2 2 2
7705 3 3 3 3 3
7706 4 4 4 4 4
7707 5 5 5 5 5
7708 6 6 6 6 6
7709 7 NULL NULL NULL NULL
7710 8 8 8 8 8
7711 9 9 9 9 9
7712 drop table t;
7713 ##################
7714 #
7715 # Bug#34482783 NDB: mysqld crash in ::is_pushable_within_nest()
7716 #
7717 ##################
7718 create table t (
7719 pk int primary key,
7720 col_int_key int not null,
7721 col_int int not null,
7722 key(col_int_key)
7723 ) engine = ndbcluster;
7724 explain format=tree SELECT *
7725 FROM t AS table1
7726 LEFT JOIN t AS table2
7727 JOIN t AS table3 ON table2.col_int IS NULL # <- 'zero rows'
7728 ON table1.col_int = table2.col_int AND
7729 table1.col_int_key = table2.col_int_key AND
7730 table1.pk = table3.pk;
7731 EXPLAIN
7732 -> Nested loop left join
7733 -> Table scan on table1
7734 -> Nested loop inner join
7735 -> Zero rows (Impossible filter)
7736 -> Index lookup on table2 using col_int_key (col_int_key=table1.col_int_key), with pushed condition: (table2.col_int = table1.col_int)
7737
7738 Warnings:
7739 Note 1003 Can't push outer joined table 'table2' as child of 'table1', a table in its dependant join-nest(s) is not part of the pushed join
7740 SELECT *
7741 FROM t AS table1
7742 LEFT JOIN t AS table2
7743 JOIN t AS table3 ON table2.col_int IS NULL # <- 'zero rows'
7744 ON table1.col_int = table2.col_int AND
7745 table1.col_int_key = table2.col_int_key AND
7746 table1.pk = table3.pk;
7747 pk col_int_key col_int pk col_int_key col_int pk col_int_key col_int
7748 drop table t;
7749 ##################
7750 #
7751 # Bug#34723413 A 'pushed join' should not start with a scan-table
7752 # returning very few rows .
7753 #
7754 ##################
7755 create table t10 (
7756 k int not null auto_increment,
7757 i int,
7758 primary key(k),
7759 key(i)
7760 ) engine = ndbcluster;
7761 insert into t10(i) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(0);
7762 create table t100 like t10;
7763 insert into t100(i)
7764 select x.i from t10 as x, t10 as y;
7765 create table t1000 like t10;
7766 insert into t1000(i)
7767 select x.i from t10 as x, t10 as y, t10 as z;
7768 delete from t10 where i > 2;
7769 update t100 set i = i/3;
7770 update t1000 set i = i/3;
7771 analyze table t10,t100,t1000;
7772 Table Op Msg_type Msg_text
7773 test.t10 analyze status OK
7774 test.t100 analyze status OK
7775 test.t1000 analyze status OK
7776 explain format=tree
7777 select *
7778 from t10
7779 straight_join t1000 on t1000.i = t10.i
7780 straight_join t100 on t100.k = t1000.k;
7781 EXPLAIN
7782 -> Nested loop inner join
7783 -> Nested loop inner join
7784 -> Table scan on t10, with pushed condition: (t10.i is not null)
7785 -> Index lookup on t1000 using i (i=t10.i), activating pushed join of 2 tables
7786 -> Single-row index lookup on t100 using PRIMARY (k=t1000.k), child of t1000 in pushed join
7787
7788 Warnings:
7789 Note 1003 Didn't push table 't10' as root, too few rows to enable full parallelism
7790 explain format=tree select *
7791 from t10
7792 straight_join t1000 on t1000.i = t10.i
7793 straight_join t100 on t100.k = t10.k;
7794 EXPLAIN
7795 -> Nested loop inner join
7796 -> Nested loop inner join
7797 -> Table scan on t10, activating pushed join of 3 tables, with pushed condition: (t10.i is not null)
7798 -> Index lookup on t1000 using i (i=t10.i), child of t10 in pushed join
7799 -> Single-row index lookup on t100 using PRIMARY (k=t10.k), child of t10 in pushed join
7800
7801 drop table t10,t100,t1000;
7802 ##################
7803 #
7804 # Bug#34782276:
7805 # Improve SPJ-internal execution plan, evaluate inner-joins first
7806 #
7807 ##################
7808 create table t (
7809 k int,
7810 a int,
7811 key ix1(k),
7812 key ix2(a)
7813 ) engine = ndb;
7814 insert into t values
7815 (0,0), (1,1), (2,2),
7816 (3,0), (4,1), (5,2),
7817 (6,0), (7,1), (8,2);
7818 explain format=tree select straight_join *
7819 from t as t1
7820 inner join t as t2 on t2.a = t1.k
7821 inner join t as t3 on t3.k = t1.k;
7822 EXPLAIN
7823 -> Nested loop inner join
7824 -> Nested loop inner join
7825 -> Table scan on t1, activating pushed join of 3 tables, with pushed condition: (t1.k is not null)
7826 -> Index lookup on t2 using ix2 (a=t1.k), child of t1 in pushed join
7827 -> Index lookup on t3 using ix1 (k=t1.k), child of t1 in pushed join
7828
7829 select straight_join *
7830 from t as t1
7831 inner join t as t2 on t2.a = t1.k
7832 inner join t as t3 on t3.k = t1.k;
7833 ############
7834 # Verify the expect 21 rows were returned from SPJ:
7835 # - 2 x 9 rows from t1 inner join t2
7836 # - 3 rows from t1 join t3
7837 # -> 21 rows (0 *SPJ* rows when not join-pushed (BKA))
7838 #
7839 SPJ_rows_returned
7840 21
7841 explain format=tree select straight_join *
7842 from t as t1
7843 inner join t as t2 on t2.a = t1.k
7844 left join t as t3 on t3.k = t1.k;
7845 EXPLAIN
7846 -> Nested loop left join
7847 -> Nested loop inner join
7848 -> Table scan on t1, activating pushed join of 3 tables, with pushed condition: (t1.k is not null)
7849 -> Index lookup on t2 using ix2 (a=t1.k), child of t1 in pushed join
7850 -> Index lookup on t3 using ix1 (k=t1.k), child of t1 in pushed join
7851
7852 select straight_join *
7853 from t as t1
7854 inner join t as t2 on t2.a = t1.k
7855 left join t as t3 on t3.k = t1.k;
7856 ############
7857 # As above, t1 inner join t2 is evaluated first
7858 # - 2 x 9 rows from join(t1,t2)
7859 # - Only the 3 matching t1 rows are requested from t3!
7860 # -> still 21 rows (and still 0 *SPJ* rows when not join-pushed (BKA))
7861 #
7862 SPJ_rows_returned
7863 21
7864 explain format=tree select straight_join *
7865 from t as t1
7866 left join t as t2 on t2.a = t1.k
7867 inner join t as t3 on t3.k = t1.k;
7868 EXPLAIN
7869 -> Nested loop inner join
7870 -> Nested loop left join
7871 -> Table scan on t1, activating pushed join of 3 tables, with pushed condition: (t1.k is not null)
7872 -> Index lookup on t2 using ix2 (a=t1.k), child of t1 in pushed join
7873 -> Index lookup on t3 using ix1 (k=t1.k), child of t1 in pushed join
7874
7875 select straight_join *
7876 from t as t1
7877 left join t as t2 on t2.a = t1.k
7878 inner join t as t3 on t3.k = t1.k;
7879 ############
7880 # Verify that all 3 x 9 rows were returned from SPJ:
7881 # - 2 x 9 rows from t1 outer join t2
7882 # (No t1-match elimination in an outer-join)
7883 # - 9 rows from t1 inner join t3
7884 # -> 27 rows
7885 #
7886 SPJ_rows_returned
7887 27
7888 drop table t;
7889 select new.variable_name, new.variable_value - old.variable_value
7890 from server_counts_at_startup as old,
7891 performance_schema.global_status as new
7892 where new.variable_name = old.variable_name
7893 order by new.variable_name;
7894 variable_name new.variable_value - old.variable_value
7895 Ndb_pruned_scan_count 8
7896 Ndb_pushed_queries_defined 511
7897 Ndb_pushed_queries_dropped 5
7898 Ndb_sorted_scan_count 15
7899 drop table server_counts_at_startup;
7900 set ndb_join_pushdown = @save_ndb_join_pushdown;