2
# A simple test of the greedy query optimization algorithm and the switches that
3
# control the optimizationprocess.
10
drop table if exists t1,t2,t3,t4,t5,t6,t7;
14
c11 integer,c12 integer,c13 integer,c14 integer,c15 integer,c16 integer,
18
c21 integer,c22 integer,c23 integer,c24 integer,c25 integer,c26 integer
21
c31 integer,c32 integer,c33 integer,c34 integer,c35 integer,c36 integer,
25
c41 integer,c42 integer,c43 integer,c44 integer,c45 integer,c46 integer
28
c51 integer,c52 integer,c53 integer,c54 integer,c55 integer,c56 integer,
32
c61 integer,c62 integer,c63 integer,c64 integer,c65 integer,c66 integer
35
c71 integer,c72 integer,c73 integer,c74 integer,c75 integer,c76 integer,
41
# cardinality(Ti) = cardinality(T(i-1)) + 3
43
insert into t1 values (1,2,3,4,5,6);
44
insert into t1 values (2,2,3,4,5,6);
45
insert into t1 values (3,2,3,4,5,6);
47
insert into t2 values (1,2,3,4,5,6);
48
insert into t2 values (2,2,3,4,5,6);
49
insert into t2 values (3,2,3,4,5,6);
50
insert into t2 values (4,2,3,4,5,6);
51
insert into t2 values (5,2,3,4,5,6);
52
insert into t2 values (6,2,3,4,5,6);
54
insert into t3 values (1,2,3,4,5,6);
55
insert into t3 values (2,2,3,4,5,6);
56
insert into t3 values (3,2,3,4,5,6);
57
insert into t3 values (4,2,3,4,5,6);
58
insert into t3 values (5,2,3,4,5,6);
59
insert into t3 values (6,2,3,4,5,6);
60
insert into t3 values (7,2,3,4,5,6);
61
insert into t3 values (8,2,3,4,5,6);
62
insert into t3 values (9,2,3,4,5,6);
64
insert into t4 values (1,2,3,4,5,6);
65
insert into t4 values (2,2,3,4,5,6);
66
insert into t4 values (3,2,3,4,5,6);
67
insert into t4 values (4,2,3,4,5,6);
68
insert into t4 values (5,2,3,4,5,6);
69
insert into t4 values (6,2,3,4,5,6);
70
insert into t4 values (7,2,3,4,5,6);
71
insert into t4 values (8,2,3,4,5,6);
72
insert into t4 values (9,2,3,4,5,6);
73
insert into t4 values (10,2,3,4,5,6);
74
insert into t4 values (11,2,3,4,5,6);
75
insert into t4 values (12,2,3,4,5,6);
77
insert into t5 values (1,2,3,4,5,6);
78
insert into t5 values (2,2,3,4,5,6);
79
insert into t5 values (3,2,3,4,5,6);
80
insert into t5 values (4,2,3,4,5,6);
81
insert into t5 values (5,2,3,4,5,6);
82
insert into t5 values (6,2,3,4,5,6);
83
insert into t5 values (7,2,3,4,5,6);
84
insert into t5 values (8,2,3,4,5,6);
85
insert into t5 values (9,2,3,4,5,6);
86
insert into t5 values (10,2,3,4,5,6);
87
insert into t5 values (11,2,3,4,5,6);
88
insert into t5 values (12,2,3,4,5,6);
89
insert into t5 values (13,2,3,4,5,6);
90
insert into t5 values (14,2,3,4,5,6);
91
insert into t5 values (15,2,3,4,5,6);
93
insert into t6 values (1,2,3,4,5,6);
94
insert into t6 values (2,2,3,4,5,6);
95
insert into t6 values (3,2,3,4,5,6);
96
insert into t6 values (4,2,3,4,5,6);
97
insert into t6 values (5,2,3,4,5,6);
98
insert into t6 values (6,2,3,4,5,6);
99
insert into t6 values (7,2,3,4,5,6);
100
insert into t6 values (8,2,3,4,5,6);
101
insert into t6 values (9,2,3,4,5,6);
102
insert into t6 values (10,2,3,4,5,6);
103
insert into t6 values (11,2,3,4,5,6);
104
insert into t6 values (12,2,3,4,5,6);
105
insert into t6 values (13,2,3,4,5,6);
106
insert into t6 values (14,2,3,4,5,6);
107
insert into t6 values (15,2,3,4,5,6);
108
insert into t6 values (16,2,3,4,5,6);
109
insert into t6 values (17,2,3,4,5,6);
110
insert into t6 values (18,2,3,4,5,6);
112
insert into t7 values (1,2,3,4,5,6);
113
insert into t7 values (2,2,3,4,5,6);
114
insert into t7 values (3,2,3,4,5,6);
115
insert into t7 values (4,2,3,4,5,6);
116
insert into t7 values (5,2,3,4,5,6);
117
insert into t7 values (6,2,3,4,5,6);
118
insert into t7 values (7,2,3,4,5,6);
119
insert into t7 values (8,2,3,4,5,6);
120
insert into t7 values (9,2,3,4,5,6);
121
insert into t7 values (10,2,3,4,5,6);
122
insert into t7 values (11,2,3,4,5,6);
123
insert into t7 values (12,2,3,4,5,6);
124
insert into t7 values (13,2,3,4,5,6);
125
insert into t7 values (14,2,3,4,5,6);
126
insert into t7 values (15,2,3,4,5,6);
127
insert into t7 values (16,2,3,4,5,6);
128
insert into t7 values (17,2,3,4,5,6);
129
insert into t7 values (18,2,3,4,5,6);
130
insert into t7 values (19,2,3,4,5,6);
131
insert into t7 values (20,2,3,4,5,6);
132
insert into t7 values (21,2,3,4,5,6);
135
# The actual test begins here
138
# Check the default values for the optimizer paramters
140
select @@optimizer_search_depth;
141
select @@optimizer_prune_level;
143
# This value swithes back to the old implementation of 'find_best()'
144
# set optimizer_search_depth=63; - old (independent of the optimizer_prune_level)
146
# These are the values for the parameters that control the greedy optimizer
147
# (total 6 combinations - 3 for optimizer_search_depth, 2 for optimizer_prune_level):
149
# set optimizer_search_depth=0; - automatic
150
# set optimizer_search_depth=1; - min
151
# set optimizer_search_depth=62; - max (default)
153
# set optimizer_prune_level=0 - exhaustive;
154
# set optimizer_prune_level=1 - heuristic; # default
158
# Compile several queries with all combinations of the query
159
# optimizer parameters. Each test query has two variants, where
160
# in the second variant the tables in the FROM clause are in
161
# inverse order to the tables in the first variant.
162
# Due to pre-sorting of tables before compilation, there should
163
# be no difference in the plans for each two such query variants.
166
# First, for reference compile the test queries with the 'old' optimization
167
# procedure 'find_best'. Notice that 'find_best' does not depend on the
168
# choice of heuristic.
170
set optimizer_search_depth=63;
171
select @@optimizer_search_depth;
173
# 6-table join, chain
174
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
177
show status like 'Last_query_cost';
178
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
181
show status like 'Last_query_cost';
184
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
186
show status like 'Last_query_cost';
188
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
190
show status like 'Last_query_cost';
191
# 6-table join, clique
193
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
195
show status like 'Last_query_cost';
196
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
198
show status like 'Last_query_cost';
201
# Test the new optimization procedures
203
set optimizer_prune_level=0;
204
select @@optimizer_prune_level;
206
set optimizer_search_depth=0;
207
select @@optimizer_search_depth;
209
# 6-table join, chain
211
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
213
show status like 'Last_query_cost';
214
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
216
show status like 'Last_query_cost';
220
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
222
show status like 'Last_query_cost';
224
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
226
show status like 'Last_query_cost';
228
# 6-table join, clique
229
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
232
show status like 'Last_query_cost';
233
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
235
show status like 'Last_query_cost';
237
set optimizer_search_depth=1;
238
select @@optimizer_search_depth;
240
# 6-table join, chain
242
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
245
show status like 'Last_query_cost';
246
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
249
show status like 'Last_query_cost';
252
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
255
show status like 'Last_query_cost';
256
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
259
show status like 'Last_query_cost';
260
# 6-table join, clique
262
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
265
show status like 'Last_query_cost';
266
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
268
show status like 'Last_query_cost';
270
set optimizer_search_depth=62;
271
select @@optimizer_search_depth;
273
# 6-table join, chain
274
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
276
show status like 'Last_query_cost';
277
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
279
show status like 'Last_query_cost';
282
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
284
show status like 'Last_query_cost';
286
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
288
show status like 'Last_query_cost';
289
# 6-table join, clique
291
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
293
show status like 'Last_query_cost';
295
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
297
show status like 'Last_query_cost';
300
set optimizer_prune_level=1;
301
select @@optimizer_prune_level;
303
set optimizer_search_depth=0;
304
select @@optimizer_search_depth;
306
# 6-table join, chain
307
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
309
show status like 'Last_query_cost';
310
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
312
show status like 'Last_query_cost';
315
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
318
show status like 'Last_query_cost';
319
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
322
show status like 'Last_query_cost';
323
# 6-table join, clique
324
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
326
show status like 'Last_query_cost';
327
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
329
show status like 'Last_query_cost';
331
set optimizer_search_depth=1;
332
select @@optimizer_search_depth;
334
# 6-table join, chain
335
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
337
show status like 'Last_query_cost';
338
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
340
show status like 'Last_query_cost';
342
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
344
show status like 'Last_query_cost';
345
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
347
show status like 'Last_query_cost';
348
# 6-table join, clique
349
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
351
show status like 'Last_query_cost';
352
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
354
show status like 'Last_query_cost';
356
set optimizer_search_depth=62;
357
select @@optimizer_search_depth;
359
# 6-table join, chain
360
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
362
show status like 'Last_query_cost';
363
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
365
show status like 'Last_query_cost';
367
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
369
show status like 'Last_query_cost';
370
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
372
show status like 'Last_query_cost';
373
# 6-table join, clique
374
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
376
show status like 'Last_query_cost';
377
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
379
show status like 'Last_query_cost';
381
drop table t1,t2,t3,t4,t5,t6,t7;