~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/greedy_optimizer.test

  • Committer: Lee
  • Date: 2008-10-30 22:02:01 UTC
  • mto: (572.1.2 devel)
  • mto: This revision was merged to the branch mainline in revision 573.
  • Revision ID: lbieber@lbieber-desktop-20081030220201-elb6qprbzpn7c5a4
add my name to the AUTHORS file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# A simple test of the greedy query optimization algorithm and the switches that
3
 
# control the optimizationprocess.
4
 
#
5
 
 
6
 
#
7
 
# Schema
8
 
#
9
 
--disable_warnings
10
 
drop table if exists t1,t2,t3,t4,t5,t6,t7;
11
 
--enable_warnings
12
 
 
13
 
create table t1 (
14
 
  c11 integer,c12 integer,c13 integer,c14 integer,c15 integer,c16 integer,
15
 
  primary key (c11)
16
 
);
17
 
create table t2 (
18
 
  c21 integer,c22 integer,c23 integer,c24 integer,c25 integer,c26 integer
19
 
);
20
 
create table t3 (
21
 
  c31 integer,c32 integer,c33 integer,c34 integer,c35 integer,c36 integer,
22
 
  primary key (c31)
23
 
);
24
 
create table t4 (
25
 
  c41 integer,c42 integer,c43 integer,c44 integer,c45 integer,c46 integer
26
 
);
27
 
create table t5 (
28
 
  c51 integer,c52 integer,c53 integer,c54 integer,c55 integer,c56 integer,
29
 
  primary key (c51)
30
 
);
31
 
create table t6 (
32
 
  c61 integer,c62 integer,c63 integer,c64 integer,c65 integer,c66 integer
33
 
);
34
 
create table t7 (
35
 
  c71 integer,c72 integer,c73 integer,c74 integer,c75 integer,c76 integer,
36
 
  primary key (c71)
37
 
);
38
 
 
39
 
#
40
 
# Data
41
 
# cardinality(Ti) = cardinality(T(i-1)) + 3
42
 
#
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);
46
 
 
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);
53
 
 
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);
63
 
 
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);
76
 
 
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);
92
 
 
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);
111
 
 
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);
133
 
 
134
 
#
135
 
# The actual test begins here
136
 
#
137
 
 
138
 
# Check the default values for the optimizer paramters
139
 
 
140
 
select @@optimizer_search_depth;
141
 
select @@optimizer_prune_level;
142
 
 
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)
145
 
#
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):
148
 
# 3:
149
 
# set optimizer_search_depth=0;  - automatic
150
 
# set optimizer_search_depth=1;  - min
151
 
# set optimizer_search_depth=62; - max (default)
152
 
# 2:
153
 
# set optimizer_prune_level=0 - exhaustive;
154
 
# set optimizer_prune_level=1 - heuristic; # default
155
 
 
156
 
 
157
 
#
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.
164
 
#
165
 
 
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.
169
 
 
170
 
set optimizer_search_depth=63;
171
 
select @@optimizer_search_depth;
172
 
 
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;
175
 
--replace_column 2 #
176
 
--sorted_result
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;
179
 
--replace_column 2 #
180
 
--sorted_result
181
 
show status like 'Last_query_cost';
182
 
# 6-table join, star
183
 
--sorted_result
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;
185
 
--replace_column 2 #
186
 
show status like 'Last_query_cost';
187
 
--sorted_result
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;
189
 
--replace_column 2 #
190
 
show status like 'Last_query_cost';
191
 
# 6-table join, clique
192
 
--sorted_result
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;
194
 
--replace_column 2 #
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;
197
 
--replace_column 2 #
198
 
show status like 'Last_query_cost';
199
 
 
200
 
 
201
 
# Test the new optimization procedures
202
 
 
203
 
set optimizer_prune_level=0;
204
 
select @@optimizer_prune_level;
205
 
 
206
 
set optimizer_search_depth=0;
207
 
select @@optimizer_search_depth;
208
 
 
209
 
# 6-table join, chain
210
 
--sorted_result
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;
212
 
--replace_column 2 #
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;
215
 
--replace_column 2 #
216
 
show status like 'Last_query_cost';
217
 
# 6-table join, star
218
 
--replace_column 2 #
219
 
--sorted_result
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;
221
 
--replace_column 2 #
222
 
show status like 'Last_query_cost';
223
 
--sorted_result
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;
225
 
--replace_column 2 #
226
 
show status like 'Last_query_cost';
227
 
--sorted_result
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;
230
 
--replace_column 2 #
231
 
--sorted_result
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;
234
 
--replace_column 2 #
235
 
show status like 'Last_query_cost';
236
 
 
237
 
set optimizer_search_depth=1;
238
 
select @@optimizer_search_depth;
239
 
 
240
 
# 6-table join, chain
241
 
--sorted_result
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;
243
 
--replace_column 2 #
244
 
--sorted_result
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;
247
 
--replace_column 2 #
248
 
--sorted_result
249
 
show status like 'Last_query_cost';
250
 
# 6-table join, star
251
 
--sorted_result
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;
253
 
--replace_column 2 #
254
 
--sorted_result
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;
257
 
--replace_column 2 #
258
 
--sorted_result
259
 
show status like 'Last_query_cost';
260
 
# 6-table join, clique
261
 
--sorted_result
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;
263
 
--replace_column 2 #
264
 
--sorted_result
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;
267
 
--replace_column 2 #
268
 
show status like 'Last_query_cost';
269
 
 
270
 
set optimizer_search_depth=62;
271
 
select @@optimizer_search_depth;
272
 
 
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;
275
 
--replace_column 2 #
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;
278
 
--replace_column 2 #
279
 
show status like 'Last_query_cost';
280
 
# 6-table join, star
281
 
--sorted_result
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;
283
 
--replace_column 2 #
284
 
show status like 'Last_query_cost';
285
 
--sorted_result
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;
287
 
--replace_column 2 #
288
 
show status like 'Last_query_cost';
289
 
# 6-table join, clique
290
 
--sorted_result
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;
292
 
--replace_column 2 #
293
 
show status like 'Last_query_cost';
294
 
--sorted_result
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;
296
 
--replace_column 2 #
297
 
show status like 'Last_query_cost';
298
 
 
299
 
 
300
 
set optimizer_prune_level=1;
301
 
select @@optimizer_prune_level;
302
 
 
303
 
set optimizer_search_depth=0;
304
 
select @@optimizer_search_depth;
305
 
 
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;
308
 
--replace_column 2 #
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;
311
 
--replace_column 2 #
312
 
show status like 'Last_query_cost';
313
 
# 6-table join, star
314
 
--sorted_result
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;
316
 
--replace_column 2 #
317
 
--sorted_result
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;
320
 
--replace_column 2 #
321
 
--sorted_result
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;
325
 
--replace_column 2 #
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;
328
 
--replace_column 2 #
329
 
show status like 'Last_query_cost';
330
 
 
331
 
set optimizer_search_depth=1;
332
 
select @@optimizer_search_depth;
333
 
 
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;
336
 
--replace_column 2 #
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;
339
 
--replace_column 2 #
340
 
show status like 'Last_query_cost';
341
 
# 6-table join, star
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;
343
 
--replace_column 2 #
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;
346
 
--replace_column 2 #
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;
350
 
--replace_column 2 #
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;
353
 
--replace_column 2 #
354
 
show status like 'Last_query_cost';
355
 
 
356
 
set optimizer_search_depth=62;
357
 
select @@optimizer_search_depth;
358
 
 
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;
361
 
--replace_column 2 #
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;
364
 
--replace_column 2 #
365
 
show status like 'Last_query_cost';
366
 
# 6-table join, star
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;
368
 
--replace_column 2 #
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;
371
 
--replace_column 2 #
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;
375
 
--replace_column 2 #
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;
378
 
--replace_column 2 #
379
 
show status like 'Last_query_cost';
380
 
 
381
 
drop table t1,t2,t3,t4,t5,t6,t7;