1
drop table if exists t1;
2
create TEMPORARY table t1 (
3
a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
5
insert into t1 (a1, a2, b, c, d) values
6
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
7
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
8
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
9
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
10
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
11
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
12
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
13
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
14
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
15
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
16
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
17
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
18
('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
19
('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
20
('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
21
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
22
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
23
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
24
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
25
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
26
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
27
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
28
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
29
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
30
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
31
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
32
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
33
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
34
('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
35
('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
36
('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
37
('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
38
create index idx_t1_0 on t1 (a1);
39
create index idx_t1_1 on t1 (a1,a2,b,c);
40
create index idx_t1_2 on t1 (a1,a2,b);
42
Table Op Msg_type Msg_text
43
test.t1 analyze note The storage engine for the table doesn't support analyze
44
drop table if exists t2;
45
create TEMPORARY table t2 (
46
a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' '
48
insert into t2 select * from t1;
49
insert into t2 (a1, a2, b, c, d) values
50
('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),
51
('a','a','a',NULL,'xyz'),
52
('a','a','b',NULL,'xyz'),
53
('a','b','a',NULL,'xyz'),
54
('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),
55
('d','b','b',NULL,'xyz'),
56
('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),
57
('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),
58
('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),
59
('a','a','a',NULL,'xyz'),
60
('a','a','b',NULL,'xyz'),
61
('a','b','a',NULL,'xyz'),
62
('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),
63
('d','b','b',NULL,'xyz'),
64
('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),
65
('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz');
66
create index idx_t2_0 on t2 (a1);
67
create index idx_t2_1 on t2 (a1,a2,b,c);
68
create index idx_t2_2 on t2 (a1,a2,b);
70
Table Op Msg_type Msg_text
71
test.t2 analyze note The storage engine for the table doesn't support analyze
72
drop table if exists t3;
73
create TEMPORARY table t3 (
74
a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' '
76
insert into t3 (a1, a2, b, c, d) values
77
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
78
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
79
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
80
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
81
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
82
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
83
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
84
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
85
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
86
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
87
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
88
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
89
insert into t3 (a1, a2, b, c, d) values
90
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
91
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
92
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
93
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
94
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
95
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
96
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
97
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
98
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
99
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
100
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
101
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
102
insert into t3 (a1, a2, b, c, d) values
103
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
104
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
105
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
106
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
107
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
108
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
109
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
110
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
111
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
112
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
113
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
114
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
115
insert into t3 (a1, a2, b, c, d) values
116
('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
117
('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
118
('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
119
('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
120
('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
121
('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
122
('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
123
('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
124
('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
125
('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
126
('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
127
('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
128
create index idx_t3_0 on t3 (a1);
129
create index idx_t3_1 on t3 (a1,a2,b,c);
130
create index idx_t3_2 on t3 (a1,a2,b);
132
Table Op Msg_type Msg_text
133
test.t3 analyze note The storage engine for the table doesn't support analyze
134
explain select a1, min(a2) from t1 group by a1;
135
id select_type table type possible_keys key key_len ref rows Extra
136
1 SIMPLE t1 range NULL idx_t1_1 518 NULL 5 Using index for group-by
137
explain select a1, max(a2) from t1 group by a1;
138
id select_type table type possible_keys key key_len ref rows Extra
139
1 SIMPLE t1 range NULL idx_t1_1 259 NULL 5 Using index for group-by
140
explain select a1, min(a2), max(a2) from t1 group by a1;
141
id select_type table type possible_keys key key_len ref rows Extra
142
1 SIMPLE t1 range NULL idx_t1_1 518 NULL 5 Using index for group-by
143
explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;
144
id select_type table type possible_keys key key_len ref rows Extra
145
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
146
explain select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b;
147
id select_type table type possible_keys key key_len ref rows Extra
148
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
149
explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;
150
id select_type table type possible_keys key key_len ref rows Extra
151
1 SIMPLE t2 index NULL idx_t2_1 # NULL # Using index
152
explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;
153
id select_type table type possible_keys key key_len ref rows Extra
154
1 SIMPLE t1 range NULL idx_t1_1 518 NULL 5 Using index for group-by
155
explain select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b;
156
id select_type table type possible_keys key key_len ref rows Extra
157
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
158
explain select min(a2) from t1 group by a1;
159
id select_type table type possible_keys key key_len ref rows Extra
160
1 SIMPLE t1 range NULL idx_t1_1 518 NULL 5 Using index for group-by
161
explain select a2, min(c), max(c) from t1 group by a1,a2,b;
162
id select_type table type possible_keys key key_len ref rows Extra
163
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
164
select a1, min(a2) from t1 group by a1;
170
select a1, max(a2) from t1 group by a1;
176
select a1, min(a2), max(a2) from t1 group by a1;
182
select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;
183
a1 a2 b min(c) max(c)
200
select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b;
201
a1 a2 b max(c) min(c)
218
select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;
219
a1 a2 b max(c) min(c)
240
select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;
241
min(a2) a1 max(a2) min(a2) a1
246
select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b;
247
a1 b min(c) a1 max(c) b a2 max(c) max(c)
248
a a a111 a d111 a a d111 d111
249
a b e112 a h112 b a h112 h112
250
a a i121 a l121 a b l121 l121
251
a b m122 a p122 b b p122 p122
252
b a a211 b d211 a a d211 d211
253
b b e212 b h212 b a h212 h212
254
b a i221 b l221 a b l221 l221
255
b b m222 b p222 b b p222 p222
256
c a a311 c d311 a a d311 d311
257
c b e312 c h312 b a h312 h312
258
c a i321 c l321 a b l321 l321
259
c b m322 c p322 b b p322 p322
260
d a a411 d d411 a a d411 d411
261
d b e412 d h412 b a h412 h412
262
d a i421 d l421 a b l421 l421
263
d b m422 d p422 b b p422 p422
264
select min(a2) from t1 group by a1;
270
select a2, min(c), max(c) from t1 group by a1,a2,b;
288
explain select a1,a2,b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
289
id select_type table type possible_keys key key_len ref rows Extra
290
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
291
explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;
292
id select_type table type possible_keys key key_len ref rows Extra
293
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
294
explain select a1,a2,b, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
295
id select_type table type possible_keys key key_len ref rows Extra
296
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
297
explain select a1, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
298
id select_type table type possible_keys key key_len ref rows Extra
299
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
300
explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
301
id select_type table type possible_keys key key_len ref rows Extra
302
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 17 Using where; Using index for group-by
303
explain select a1,a2,b, max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
304
id select_type table type possible_keys key key_len ref rows Extra
305
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 8 Using where; Using index for group-by
306
explain select a1,a2,b,min(c),max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
307
id select_type table type possible_keys key key_len ref rows Extra
308
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 8 Using where; Using index for group-by
309
explain select a1,a2,b, max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
310
id select_type table type possible_keys key key_len ref rows Extra
311
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 8 Using where; Using index for group-by
312
explain select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
313
id select_type table type possible_keys key key_len ref rows Extra
314
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 8 Using where; Using index for group-by
315
explain select a1,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;
316
id select_type table type possible_keys key key_len ref rows Extra
317
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
318
explain select a1, max(c) from t1 where a1 in ('a','b','d') group by a1,a2,b;
319
id select_type table type possible_keys key key_len ref rows Extra
320
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
321
explain select a1,a2,b, max(c) from t2 where a1 < 'd' group by a1,a2,b;
322
id select_type table type possible_keys key key_len ref rows Extra
323
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 584 NULL # Using where; Using index for group-by
324
explain select a1,a2,b,min(c),max(c) from t2 where a1 < 'd' group by a1,a2,b;
325
id select_type table type possible_keys key key_len ref rows Extra
326
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index for group-by
327
explain select a1,a2,b,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;
328
id select_type table type possible_keys key key_len ref rows Extra
329
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index for group-by
330
explain select a1,a2,b, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
331
id select_type table type possible_keys key key_len ref rows Extra
332
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 584 NULL # Using where; Using index for group-by
333
explain select a1, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
334
id select_type table type possible_keys key key_len ref rows Extra
335
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 584 NULL # Using where; Using index for group-by
336
explain select a1,a2,b,min(c),max(c) from t2 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
337
id select_type table type possible_keys key key_len ref rows Extra
338
1 SIMPLE t2 index idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index
339
explain select a1,a2,b, max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
340
id select_type table type possible_keys key key_len ref rows Extra
341
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 584 NULL # Using where; Using index for group-by
342
explain select a1,a2,b,min(c),max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
343
id select_type table type possible_keys key key_len ref rows Extra
344
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index for group-by
345
explain select a1,a2,b, max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
346
id select_type table type possible_keys key key_len ref rows Extra
347
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 584 NULL # Using where; Using index for group-by
348
explain select a1,a2,b,min(c),max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
349
id select_type table type possible_keys key key_len ref rows Extra
350
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index for group-by
351
explain select a1,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;
352
id select_type table type possible_keys key key_len ref rows Extra
353
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index for group-by
354
explain select a1, max(c) from t2 where a1 in ('a','b','d') group by a1,a2,b;
355
id select_type table type possible_keys key key_len ref rows Extra
356
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 584 NULL # Using where; Using index for group-by
357
select a1,a2,b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
358
a1 a2 b min(c) max(c)
371
select a1,a2,b,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;
372
a1 a2 b min(c) max(c)
385
select a1,a2,b, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
399
select a1, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
413
select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
414
a1 a2 b min(c) max(c)
427
select a1,a2,b, max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
437
select a1,a2,b,min(c),max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
438
a1 a2 b min(c) max(c)
447
select a1,a2,b, max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
457
select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
458
a1 a2 b min(c) max(c)
467
select a1,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;
481
select a1, max(c) from t1 where a1 in ('a','b','d') group by a1,a2,b;
495
select a1,a2,b, max(c) from t2 where a1 < 'd' group by a1,a2,b;
511
select a1,a2,b,min(c),max(c) from t2 where a1 < 'd' group by a1,a2,b;
512
a1 a2 b min(c) max(c)
527
select a1,a2,b,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;
528
a1 a2 b min(c) max(c)
544
select a1,a2,b, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
562
select a1, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
580
select a1,a2,b,min(c),max(c) from t2 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
581
a1 a2 b min(c) max(c)
598
select a1,a2,b, max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
608
select a1,a2,b,min(c),max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
609
a1 a2 b min(c) max(c)
618
select a1,a2,b, max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
628
select a1,a2,b,min(c),max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;
629
a1 a2 b min(c) max(c)
638
select a1,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;
655
select a1, max(c) from t2 where a1 in ('a','b','d') group by a1,a2,b;
670
explain select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
671
id select_type table type possible_keys key key_len ref rows Extra
672
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 5 Using where; Using index for group-by
673
explain select a1,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
674
id select_type table type possible_keys key key_len ref rows Extra
675
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 5 Using where; Using index for group-by
676
explain select a1,a2,b, max(c) from t1 where (b = 'b') group by a1,a2;
677
id select_type table type possible_keys key key_len ref rows Extra
678
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 9 Using where; Using index for group-by
679
explain select a1,a2,b,min(c),max(c) from t1 where (b = 'b') group by a1,a2;
680
id select_type table type possible_keys key key_len ref rows Extra
681
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 9 Using where; Using index for group-by
682
explain select a1,a2, max(c) from t1 where (b = 'b') group by a1,a2;
683
id select_type table type possible_keys key key_len ref rows Extra
684
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 9 Using where; Using index for group-by
685
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
686
id select_type table type possible_keys key key_len ref rows Extra
687
1 SIMPLE t2 range NULL idx_t2_1 651 NULL 5 Using where; Using index for group-by
688
explain select a1,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
689
id select_type table type possible_keys key key_len ref rows Extra
690
1 SIMPLE t2 range NULL idx_t2_1 651 NULL 5 Using where; Using index for group-by
691
explain select a1,a2,b, max(c) from t2 where (b = 'b') group by a1,a2;
692
id select_type table type possible_keys key key_len ref rows Extra
693
1 SIMPLE t2 range NULL idx_t2_1 584 NULL 10 Using where; Using index for group-by
694
explain select a1,a2,b,min(c),max(c) from t2 where (b = 'b') group by a1,a2;
695
id select_type table type possible_keys key key_len ref rows Extra
696
1 SIMPLE t2 range NULL idx_t2_1 651 NULL 10 Using where; Using index for group-by
697
explain select a1,a2, max(c) from t2 where (b = 'b') group by a1,a2;
698
id select_type table type possible_keys key key_len ref rows Extra
699
1 SIMPLE t2 range NULL idx_t2_1 584 NULL 10 Using where; Using index for group-by
700
explain select a1,a2,b,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
701
id select_type table type possible_keys key key_len ref rows Extra
702
1 SIMPLE t3 range NULL idx_t3_1 21 NULL 4 Using where; Using index for group-by
703
explain select a1,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
704
id select_type table type possible_keys key key_len ref rows Extra
705
1 SIMPLE t3 range NULL idx_t3_1 21 NULL 4 Using where; Using index for group-by
706
select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
707
a1 a2 b max(c) min(c)
712
select a1,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
718
select a1,a2,b, max(c) from t1 where (b = 'b') group by a1,a2;
728
select a1,a2,b,min(c),max(c) from t1 where (b = 'b') group by a1,a2;
729
a1 a2 b min(c) max(c)
738
select a1,a2, max(c) from t1 where (b = 'b') group by a1,a2;
748
select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
749
a1 a2 b max(c) min(c)
755
select a1,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
762
select a1,a2,b, max(c) from t2 where (b = 'b') group by a1,a2;
773
select a1,a2,b,min(c),max(c) from t2 where (b = 'b') group by a1,a2;
774
a1 a2 b min(c) max(c)
784
select a1,a2, max(c) from t2 where (b = 'b') group by a1,a2;
795
select a1,a2,b,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
796
a1 a2 b max(c) min(c)
800
select a1,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
805
explain select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
806
id select_type table type possible_keys key key_len ref rows Extra
807
1 SIMPLE t2 range NULL idx_t2_1 651 NULL 5 Using where; Using index for group-by
808
explain select a1,a2,b,max(c) from t2 where (a2 = 'a') and b is NULL group by a1;
809
id select_type table type possible_keys key key_len ref rows Extra
810
1 SIMPLE t2 range NULL idx_t2_1 584 NULL 5 Using where; Using index for group-by
811
explain select a1,a2,b,min(c) from t2 where b is NULL group by a1,a2;
812
id select_type table type possible_keys key key_len ref rows Extra
813
1 SIMPLE t2 range NULL idx_t2_1 651 NULL 10 Using where; Using index for group-by
814
explain select a1,a2,b,max(c) from t2 where b is NULL group by a1,a2;
815
id select_type table type possible_keys key key_len ref rows Extra
816
1 SIMPLE t2 range NULL idx_t2_1 584 NULL 10 Using where; Using index for group-by
817
explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
818
id select_type table type possible_keys key key_len ref rows Extra
819
1 SIMPLE t2 range NULL idx_t2_1 651 NULL 10 Using where; Using index for group-by
820
explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
821
id select_type table type possible_keys key key_len ref rows Extra
822
1 SIMPLE t2 range NULL idx_t2_1 651 NULL 10 Using where; Using index for group-by
823
select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
827
select a1,a2,b,max(c) from t2 where (a2 = 'a') and b is NULL group by a1;
831
select a1,a2,b,min(c) from t2 where b is NULL group by a1,a2;
835
select a1,a2,b,max(c) from t2 where b is NULL group by a1,a2;
839
select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
840
a1 a2 b min(c) max(c)
843
select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
844
a1 a2 b min(c) max(c)
847
explain select a1,a2,b, max(c) from t1 where (c > 'b1') group by a1,a2,b;
848
id select_type table type possible_keys key key_len ref rows Extra
849
1 SIMPLE t1 range NULL idx_t1_1 585 NULL # Using where; Using index for group-by
850
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') group by a1,a2,b;
851
id select_type table type possible_keys key key_len ref rows Extra
852
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
853
explain select a1,a2,b, max(c) from t1 where (c > 'f123') group by a1,a2,b;
854
id select_type table type possible_keys key key_len ref rows Extra
855
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
856
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'f123') group by a1,a2,b;
857
id select_type table type possible_keys key key_len ref rows Extra
858
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
859
explain select a1,a2,b, max(c) from t1 where (c < 'a0') group by a1,a2,b;
860
id select_type table type possible_keys key key_len ref rows Extra
861
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
862
explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') group by a1,a2,b;
863
id select_type table type possible_keys key key_len ref rows Extra
864
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
865
explain select a1,a2,b, max(c) from t1 where (c < 'k321') group by a1,a2,b;
866
id select_type table type possible_keys key key_len ref rows Extra
867
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
868
explain select a1,a2,b,min(c),max(c) from t1 where (c < 'k321') group by a1,a2,b;
869
id select_type table type possible_keys key key_len ref rows Extra
870
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
871
explain select a1,a2,b, max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
872
id select_type table type possible_keys key key_len ref rows Extra
873
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
874
explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
875
id select_type table type possible_keys key key_len ref rows Extra
876
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
877
explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
878
id select_type table type possible_keys key key_len ref rows Extra
879
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
880
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
881
id select_type table type possible_keys key key_len ref rows Extra
882
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
883
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
884
id select_type table type possible_keys key key_len ref rows Extra
885
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
886
explain select a1,a2,b,min(c),max(c) from t1 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
887
id select_type table type possible_keys key key_len ref rows Extra
888
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
889
explain select a1,a2,b,min(c),max(c) from t1 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
890
id select_type table type possible_keys key key_len ref rows Extra
891
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
892
explain select a1,a2,b,min(c),max(c) from t1 where (c between 'b111' and 'g112') or (c between 'd000' and 'i110') group by a1,a2,b;
893
id select_type table type possible_keys key key_len ref rows Extra
894
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
895
explain select a1,a2,b, max(c) from t2 where (c > 'b1') group by a1,a2,b;
896
id select_type table type possible_keys key key_len ref rows Extra
897
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
898
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') group by a1,a2,b;
899
id select_type table type possible_keys key key_len ref rows Extra
900
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
901
explain select a1,a2,b, max(c) from t2 where (c > 'f123') group by a1,a2,b;
902
id select_type table type possible_keys key key_len ref rows Extra
903
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
904
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'f123') group by a1,a2,b;
905
id select_type table type possible_keys key key_len ref rows Extra
906
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
907
explain select a1,a2,b, max(c) from t2 where (c < 'a0') group by a1,a2,b;
908
id select_type table type possible_keys key key_len ref rows Extra
909
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
910
explain select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') group by a1,a2,b;
911
id select_type table type possible_keys key key_len ref rows Extra
912
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
913
explain select a1,a2,b, max(c) from t2 where (c < 'k321') group by a1,a2,b;
914
id select_type table type possible_keys key key_len ref rows Extra
915
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
916
explain select a1,a2,b,min(c),max(c) from t2 where (c < 'k321') group by a1,a2,b;
917
id select_type table type possible_keys key key_len ref rows Extra
918
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
919
explain select a1,a2,b, max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
920
id select_type table type possible_keys key key_len ref rows Extra
921
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
922
explain select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
923
id select_type table type possible_keys key key_len ref rows Extra
924
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
925
explain select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
926
id select_type table type possible_keys key key_len ref rows Extra
927
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
928
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
929
id select_type table type possible_keys key key_len ref rows Extra
930
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
931
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
932
id select_type table type possible_keys key key_len ref rows Extra
933
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
934
explain select a1,a2,b,min(c),max(c) from t2 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
935
id select_type table type possible_keys key key_len ref rows Extra
936
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
937
explain select a1,a2,b,min(c),max(c) from t2 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
938
id select_type table type possible_keys key key_len ref rows Extra
939
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
940
select a1,a2,b, max(c) from t1 where (c > 'b1') group by a1,a2,b;
958
select a1,a2,b, max(c) from t1 where (c > 'f123') group by a1,a2,b;
972
select a1,a2,b, max(c) from t1 where (c < 'a0') group by a1,a2,b;
974
select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') group by a1,a2,b;
975
a1 a2 b min(c) max(c)
976
select a1,a2,b, max(c) from t1 where (c < 'k321') group by a1,a2,b;
990
select a1,a2,b,min(c),max(c) from t1 where (c < 'k321') group by a1,a2,b;
991
a1 a2 b min(c) max(c)
1004
select a1,a2,b, max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
1022
select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
1040
select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
1041
a1 a2 b min(c) max(c)
1058
select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
1059
a1 a2 b min(c) max(c)
1068
select a1,a2,b,min(c),max(c) from t1 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
1069
a1 a2 b min(c) max(c)
1076
select a1,a2,b,min(c),max(c) from t1 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
1077
a1 a2 b min(c) max(c)
1086
select a1,a2,b,min(c),max(c) from t1 where (c between 'b111' and 'g112') or (c between 'd000' and 'i110') group by a1,a2,b;
1087
a1 a2 b min(c) max(c)
1096
select a1,a2,b, max(c) from t2 where (c > 'b1') group by a1,a2,b;
1115
select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') group by a1,a2,b;
1116
a1 a2 b min(c) max(c)
1134
select a1,a2,b, max(c) from t2 where (c > 'f123') group by a1,a2,b;
1148
select a1,a2,b,min(c),max(c) from t2 where (c > 'f123') group by a1,a2,b;
1149
a1 a2 b min(c) max(c)
1162
select a1,a2,b, max(c) from t2 where (c < 'a0') group by a1,a2,b;
1164
select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') group by a1,a2,b;
1165
a1 a2 b min(c) max(c)
1166
select a1,a2,b, max(c) from t2 where (c < 'k321') group by a1,a2,b;
1182
select a1,a2,b,min(c),max(c) from t2 where (c < 'k321') group by a1,a2,b;
1183
a1 a2 b min(c) max(c)
1198
select a1,a2,b, max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
1217
select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
1218
a1 a2 b min(c) max(c)
1236
select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
1256
select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
1257
a1 a2 b min(c) max(c)
1276
select a1,a2,b,min(c),max(c) from t2 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
1277
a1 a2 b min(c) max(c)
1287
select a1,a2,b,min(c),max(c) from t2 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
1288
a1 a2 b min(c) max(c)
1296
select a1,a2,b,min(c),max(c) from t2 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
1297
a1 a2 b min(c) max(c)
1307
explain select a1,a2,b,min(c),max(c) from t1
1308
where exists ( select * from t2 where t2.c = t1.c )
1310
id select_type table type possible_keys key key_len ref rows Extra
1311
1 PRIMARY t1 index NULL idx_t1_1 651 NULL 128 Using where; Using index
1312
2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 651 NULL 164 Using where; Using index
1313
explain select a1,a2,b,min(c),max(c) from t1
1314
where exists ( select * from t2 where t2.c > 'b1' )
1316
id select_type table type possible_keys key key_len ref rows Extra
1317
1 PRIMARY t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
1318
2 SUBQUERY t2 index NULL idx_t2_1 651 NULL 164 Using where; Using index
1319
explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1320
id select_type table type possible_keys key key_len ref rows Extra
1321
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 17 Using where; Using index for group-by
1322
explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b;
1323
id select_type table type possible_keys key key_len ref rows Extra
1324
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 651 NULL 17 Using where; Using index for group-by
1325
explain select a1,a2,b,min(c),max(c) from t1 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b;
1326
id select_type table type possible_keys key key_len ref rows Extra
1327
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
1328
explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
1329
id select_type table type possible_keys key key_len ref rows Extra
1330
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 651 NULL 13 Using where; Using index for group-by
1331
explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
1332
id select_type table type possible_keys key key_len ref rows Extra
1333
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 651 NULL 13 Using where; Using index for group-by
1334
explain select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1335
id select_type table type possible_keys key key_len ref rows Extra
1336
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
1337
explain select a1,a2,b,min(c) from t1 where (ord(a1) > 97) and (ord(a2) + ord(a1) > 194) and (b = 'c') group by a1,a2,b;
1338
id select_type table type possible_keys key key_len ref rows Extra
1339
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
1340
explain select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1341
id select_type table type possible_keys key key_len ref rows Extra
1342
1 SIMPLE t2 index idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index
1343
explain select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b;
1344
id select_type table type possible_keys key key_len ref rows Extra
1345
1 SIMPLE t2 index idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index
1346
explain select a1,a2,b,min(c),max(c) from t2 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b;
1347
id select_type table type possible_keys key key_len ref rows Extra
1348
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
1349
explain select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
1350
id select_type table type possible_keys key key_len ref rows Extra
1351
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index for group-by
1352
explain select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
1353
id select_type table type possible_keys key key_len ref rows Extra
1354
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index for group-by
1355
explain select a1,a2,b,min(c) from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1356
id select_type table type possible_keys key key_len ref rows Extra
1357
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index for group-by
1358
select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1359
a1 a2 b min(c) max(c)
1366
select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
1371
select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
1376
select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1378
select a1,a2,b,min(c) from t1 where (ord(a1) > 97) and (ord(a2) + ord(a1) > 194) and (b = 'c') group by a1,a2,b;
1380
select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1381
a1 a2 b min(c) max(c)
1389
select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b;
1390
a1 a2 b min(c) max(c)
1404
select a1,a2,b,min(c),max(c) from t2 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b;
1405
a1 a2 b min(c) max(c)
1410
select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
1415
select a1,a2,b,min(c) from t2 where ((a1 > 'a') or (a1 < '9')) and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
1420
select a1,a2,b,min(c) from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1422
explain select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1423
id select_type table type possible_keys key key_len ref rows Extra
1424
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 17 Using where; Using index for group-by
1425
explain select a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1426
id select_type table type possible_keys key key_len ref rows Extra
1427
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
1428
explain select a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1429
id select_type table type possible_keys key key_len ref rows Extra
1430
1 SIMPLE t1 index NULL idx_t1_1 651 NULL 128 Using where; Using index
1431
explain select a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1432
id select_type table type possible_keys key key_len ref rows Extra
1433
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
1434
explain select a1,a2,b from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1435
id select_type table type possible_keys key key_len ref rows Extra
1436
1 SIMPLE t2 index idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_2 584 NULL # Using where; Using index
1437
explain select a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1438
id select_type table type possible_keys key key_len ref rows Extra
1439
1 SIMPLE t2 index NULL idx_t2_2 584 NULL # Using where; Using index
1440
explain select a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1441
id select_type table type possible_keys key key_len ref rows Extra
1442
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
1443
explain select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1444
id select_type table type possible_keys key key_len ref rows Extra
1445
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 584 NULL # Using where; Using index for group-by
1446
select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1454
select a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1460
select a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1463
select a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1465
select a1,a2,b from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1474
select a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1480
select a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1483
select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1485
explain select distinct a1,a2,b from t1;
1486
id select_type table type possible_keys key key_len ref rows Extra
1487
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
1488
explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a');
1489
id select_type table type possible_keys key key_len ref rows Extra
1490
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
1491
explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
1492
id select_type table type possible_keys key key_len ref rows filtered Extra
1493
1 SIMPLE t1 index NULL idx_t1_1 651 NULL 128 50.78 Using where; Using index
1495
Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`a2` >= 'b') and (`test`.`t1`.`b` = 'a') and (`test`.`t1`.`c` = 'i121'))
1496
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
1497
id select_type table type possible_keys key key_len ref rows Extra
1498
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
1499
explain select distinct b from t1 where (a2 >= 'b') and (b = 'a');
1500
id select_type table type possible_keys key key_len ref rows Extra
1501
1 SIMPLE t1 index NULL idx_t1_2 585 NULL 128 Using where; Using index
1502
explain select distinct a1,a2,b from t2;
1503
id select_type table type possible_keys key key_len ref rows Extra
1504
1 SIMPLE t2 index NULL idx_t2_2 584 NULL # Using index
1505
explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a');
1506
id select_type table type possible_keys key key_len ref rows Extra
1507
1 SIMPLE t2 index NULL idx_t2_2 584 NULL # Using where; Using index
1508
explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
1509
id select_type table type possible_keys key key_len ref rows filtered Extra
1510
1 SIMPLE t2 index NULL idx_t2_1 651 NULL 164 50.61 Using where; Using index
1512
Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`a2` >= 'b') and (`test`.`t2`.`b` = 'a') and (`test`.`t2`.`c` = 'i121'))
1513
explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
1514
id select_type table type possible_keys key key_len ref rows Extra
1515
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 584 NULL # Using where; Using index for group-by
1516
explain select distinct b from t2 where (a2 >= 'b') and (b = 'a');
1517
id select_type table type possible_keys key key_len ref rows Extra
1518
1 SIMPLE t2 index NULL idx_t2_2 584 NULL 164 Using where; Using index
1519
select distinct a1,a2,b from t1;
1537
select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a');
1543
select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
1546
select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
1548
select distinct b from t1 where (a2 >= 'b') and (b = 'a');
1551
select distinct a1,a2,b from t2;
1573
select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a');
1579
select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
1582
select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
1584
select distinct b from t2 where (a2 >= 'b') and (b = 'a');
1587
select distinct t_00.a1
1589
where exists ( select * from t2 where a1 = t_00.a1 );
1595
select distinct a1,a1 from t1;
1601
select distinct a2,a1,a2,a1 from t1;
1611
select distinct t1.a1,t2.a1 from t1,t2;
1633
explain select distinct a1,a2,b from t1;
1634
id select_type table type possible_keys key key_len ref rows Extra
1635
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
1636
explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1637
id select_type table type possible_keys key key_len ref rows Extra
1638
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
1639
explain select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1640
id select_type table type possible_keys key key_len ref rows Extra
1641
1 SIMPLE t1 index NULL idx_t1_1 651 NULL 128 Using where; Using index
1642
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1643
id select_type table type possible_keys key key_len ref rows Extra
1644
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
1645
explain select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1646
id select_type table type possible_keys key key_len ref rows Extra
1647
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by; Using temporary; Using filesort
1648
explain select distinct a1,a2,b from t2;
1649
id select_type table type possible_keys key key_len ref rows Extra
1650
1 SIMPLE t2 index NULL idx_t2_2 584 NULL # Using index
1651
explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1652
id select_type table type possible_keys key key_len ref rows Extra
1653
1 SIMPLE t2 index NULL idx_t2_2 584 NULL # Using where; Using index
1654
explain select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1655
id select_type table type possible_keys key key_len ref rows Extra
1656
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
1657
explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1658
id select_type table type possible_keys key key_len ref rows Extra
1659
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 584 NULL # Using where; Using index for group-by
1660
explain select distinct b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1661
id select_type table type possible_keys key key_len ref rows Extra
1662
1 SIMPLE t2 index NULL idx_t2_2 584 NULL # Using where; Using index; Using temporary; Using filesort
1663
select distinct a1,a2,b from t1;
1681
select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1687
select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1690
select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1692
select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1695
select distinct a1,a2,b from t2;
1717
select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1723
select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1726
select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1728
select distinct b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1731
explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
1732
id select_type table type possible_keys key key_len ref rows Extra
1733
1 SIMPLE t1 index NULL idx_t1_2 585 NULL 128 Using where; Using index
1734
explain select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
1735
id select_type table type possible_keys key key_len ref rows Extra
1736
1 SIMPLE t1 index NULL idx_t1_1 651 NULL 128 Using where; Using index
1737
explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
1738
id select_type table type possible_keys key key_len ref rows filtered Extra
1739
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 585 NULL 128 75.00 Using where; Using index
1741
Note 1003 select count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`a1` > 'a') and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`b` = 'c'))
1742
explain select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a');
1743
id select_type table type possible_keys key key_len ref rows Extra
1744
1 SIMPLE t1 index NULL idx_t1_2 585 NULL 128 Using where; Using index
1745
explain extended select ord(a1) + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a');
1746
id select_type table type possible_keys key key_len ref rows filtered Extra
1747
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 585 NULL 128 75.00 Using where; Using index
1749
Note 1003 select (ord(`test`.`t1`.`a1`) + count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`)) AS `ord(a1) + count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`a1` > 'a') and (`test`.`t1`.`a2` > 'a'))
1750
select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
1751
count(distinct a1,a2,b)
1753
select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
1754
count(distinct a1,a2,b,c)
1756
select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
1757
count(distinct a1,a2,b)
1759
select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a');
1762
select ord(a1) + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a');
1763
ord(a1) + count(distinct a1,a2,b)
1765
explain select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b;
1766
id select_type table type possible_keys key key_len ref rows Extra
1767
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
1768
explain select concat(a1,min(c)),b from t1 where a1 < 'd' group by a1,a2,b;
1769
id select_type table type possible_keys key key_len ref rows Extra
1770
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
1771
explain select concat(a1,min(c)),b,max(c) from t1 where a1 < 'd' group by a1,a2,b;
1772
id select_type table type possible_keys key key_len ref rows Extra
1773
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
1774
explain select concat(a1,a2),b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
1775
id select_type table type possible_keys key key_len ref rows Extra
1776
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 585 NULL 13 Using where; Using index for group-by
1777
explain select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2;
1778
id select_type table type possible_keys key key_len ref rows Extra
1779
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 9 Using index for group-by
1780
select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b;
1781
a1 a2 b concat(min(c), max(c))
1794
select concat(a1,min(c)),b from t1 where a1 < 'd' group by a1,a2,b;
1808
select concat(a1,min(c)),b,max(c) from t1 where a1 < 'd' group by a1,a2,b;
1809
concat(a1,min(c)) b max(c)
1822
select concat(a1,a2),b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
1823
concat(a1,a2) b min(c) max(c)
1836
select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2;
1837
concat(ord(min(b)),ord(max(b))) min(b) max(b)
1846
explain select a1,a2,b,d,min(c),max(c) from t1 group by a1,a2,b;
1847
id select_type table type possible_keys key key_len ref rows Extra
1848
1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using temporary; Using filesort
1849
explain select a1,a2,b,d from t1 group by a1,a2,b;
1850
id select_type table type possible_keys key key_len ref rows Extra
1851
1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using temporary; Using filesort
1852
explain extended select a1,a2,min(b),max(b) from t1
1853
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2;
1854
id select_type table type possible_keys key key_len ref rows filtered Extra
1855
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 651 NULL 128 49.22 Using where; Using index
1857
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`c` > 'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`
1858
explain extended select a1,a2,b,min(c),max(c) from t1
1859
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b;
1860
id select_type table type possible_keys key key_len ref rows filtered Extra
1861
1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 49.22 Using where; Using temporary; Using filesort
1863
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`d` > 'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
1864
explain extended select a1,a2,b,c from t1
1865
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c;
1866
id select_type table type possible_keys key key_len ref rows filtered Extra
1867
1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 49.22 Using where; Using temporary; Using filesort
1869
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`d` > 'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c`
1870
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1;
1871
id select_type table type possible_keys key key_len ref rows Extra
1872
1 SIMPLE t2 index NULL idx_t2_1 651 NULL 164 Using where; Using index
1873
explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2,b;
1874
id select_type table type possible_keys key key_len ref rows filtered Extra
1875
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 651 NULL 128 49.22 Using where; Using index
1877
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`c` > 'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
1878
explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1;
1879
id select_type table type possible_keys key key_len ref rows Extra
1880
1 SIMPLE t2 index NULL idx_t2_1 651 NULL 164 Using where; Using index
1881
select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1;
1884
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b = 'a') group by a1;
1885
id select_type table type possible_keys key key_len ref rows Extra
1886
1 SIMPLE t2 index NULL idx_t2_1 651 NULL 164 Using where; Using index
1887
explain select a1,a2,b,min(c),max(c) from t2
1888
where (c > 'a000') and (c <= 'd999') and (c like '_8__') group by a1,a2,b;
1889
id select_type table type possible_keys key key_len ref rows Extra
1890
1 SIMPLE t2 index NULL idx_t2_1 651 NULL 164 Using where; Using index
1891
explain select a1, a2, b, c, min(d), max(d) from t1 group by a1,a2,b,c;
1892
id select_type table type possible_keys key key_len ref rows Extra
1893
1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using temporary; Using filesort
1894
explain select a1,a2,count(a2) from t1 group by a1,a2,b;
1895
id select_type table type possible_keys key key_len ref rows Extra
1896
1 SIMPLE t1 index NULL idx_t1_2 585 NULL 128 Using index
1897
explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b;
1898
id select_type table type possible_keys key key_len ref rows filtered Extra
1899
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 651 NULL 128 75.00 Using where; Using index
1901
Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where (`test`.`t1`.`a1` > 'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
1902
explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
1903
id select_type table type possible_keys key key_len ref rows filtered Extra
1904
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 651 NULL 128 75.00 Using where; Using index
1906
Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where (`test`.`t1`.`a1` > 'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`
1907
explain select distinct(a1) from t1 where ord(a2) = 98;
1908
id select_type table type possible_keys key key_len ref rows Extra
1909
1 SIMPLE t1 index NULL idx_t1_2 585 NULL 128 Using where; Using index
1910
select distinct(a1) from t1 where ord(a2) = 98;
1916
explain select a1 from t1 where a2 = 'b' group by a1;
1917
id select_type table type possible_keys key key_len ref rows Extra
1918
1 SIMPLE t1 range NULL idx_t1_1 518 NULL 5 Using where; Using index for group-by
1919
select a1 from t1 where a2 = 'b' group by a1;
1925
explain select distinct a1 from t1 where a2 = 'b';
1926
id select_type table type possible_keys key key_len ref rows Extra
1927
1 SIMPLE t1 range NULL idx_t1_1 518 NULL 5 Using where; Using index for group-by
1928
select distinct a1 from t1 where a2 = 'b';
1934
drop table t1,t2,t3;
1935
create TEMPORARY table t1 (c1 int not null,c2 int not null, primary key(c1,c2)) ENGINE=MYISAM;
1936
insert into t1 (c1,c2) values
1937
(10,1),(10,2),(10,3),(20,4),(20,5),(20,6),(30,7),(30,8),(30,9);
1938
select distinct c1, c2 from t1 order by c2;
1949
select c1,min(c2) as c2 from t1 group by c1 order by c2;
1954
select c1,c2 from t1 group by c1,c2 order by c2;
1966
CREATE TABLE t1 (a varchar(5), b int, PRIMARY KEY (a,b));
1967
INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4);
1969
Table Op Msg_type Msg_text
1970
test.t1 optimize status OK
1971
SELECT a FROM t1 WHERE a='AA' GROUP BY a;
1974
SELECT a FROM t1 WHERE a='BB' GROUP BY a;
1977
EXPLAIN SELECT a FROM t1 WHERE a='AA' GROUP BY a;
1978
id select_type table type possible_keys key key_len ref rows Extra
1979
1 SIMPLE t1 ref PRIMARY PRIMARY 22 const 1 Using where; Using index
1980
EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a;
1981
id select_type table type possible_keys key key_len ref rows Extra
1982
1 SIMPLE t1 ref PRIMARY PRIMARY 22 const 1 Using where; Using index
1983
SELECT DISTINCT a FROM t1 WHERE a='BB';
1986
SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%';
1989
SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a;
1993
CREATE TABLE t1 (a varchar(64) NOT NULL default '', PRIMARY KEY(a));
1994
INSERT INTO t1 (a) VALUES
1995
(''), ('CENTRAL'), ('EASTERN'), ('GREATER LONDON'),
1996
('NORTH CENTRAL'), ('NORTH EAST'), ('NORTH WEST'), ('SCOTLAND'),
1997
('SOUTH EAST'), ('SOUTH WEST'), ('WESTERN');
1998
EXPLAIN SELECT DISTINCT a,a FROM t1 ORDER BY a;
1999
id select_type table type possible_keys key key_len ref rows Extra
2000
1 SIMPLE t1 range NULL PRIMARY 258 NULL 12 Using index for group-by
2001
SELECT DISTINCT a,a FROM t1 ORDER BY a;
2006
GREATER LONDON GREATER LONDON
2007
NORTH CENTRAL NORTH CENTRAL
2008
NORTH EAST NORTH EAST
2009
NORTH WEST NORTH WEST
2011
SOUTH EAST SOUTH EAST
2012
SOUTH WEST SOUTH WEST
2015
CREATE TABLE t1 (id1 INT, id2 INT);
2016
CREATE TABLE t2 (id2 INT, id3 INT, id5 INT);
2017
CREATE TABLE t3 (id3 INT, id4 INT);
2018
CREATE TABLE t4 (id4 INT);
2019
CREATE TABLE t5 (id5 INT, id6 INT);
2020
CREATE TABLE t6 (id6 INT);
2021
INSERT INTO t1 VALUES(1,1);
2022
INSERT INTO t2 VALUES(1,1,1);
2023
INSERT INTO t3 VALUES(1,1);
2024
INSERT INTO t4 VALUES(1);
2025
INSERT INTO t5 VALUES(1,1);
2026
INSERT INTO t6 VALUES(1);
2030
(t2 JOIN (t3 NATURAL JOIN t4, t5 NATURAL JOIN t6)
2031
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5));
2032
id2 id1 id3 id5 id4 id3 id6 id5
2037
(((t3 NATURAL JOIN t4) join (t5 NATURAL JOIN t6) on t3.id4 = t5.id5) JOIN t2
2038
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5));
2039
id2 id1 id4 id3 id6 id5 id3 id5
2041
SELECT * FROM t1 NATURAL JOIN ((t3 join (t5 NATURAL JOIN t6)) JOIN t2);
2042
id2 id1 id3 id4 id6 id5 id3 id5
2045
(t2 JOIN (t3 NATURAL JOIN t4, t5 NATURAL JOIN t6)
2046
ON (t3.id3 = t2.id3 AND t5.id5 = t2.id5))
2049
id2 id3 id5 id4 id3 id6 id5 id1
2052
(t2 JOIN ((t3 NATURAL JOIN t4) join (t5 NATURAL JOIN t6)))
2055
id2 id3 id5 id4 id3 id6 id5 id1
2057
DROP TABLE t1,t2,t3,t4,t5,t6;
2058
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b), KEY b (b));
2059
INSERT INTO t1 VALUES (1,1),(1,2),(1,0),(1,3);
2060
explain SELECT MAX(b), a FROM t1 WHERE b < 2 AND a = 1 GROUP BY a;
2061
id select_type table type possible_keys key key_len ref rows Extra
2062
1 SIMPLE t1 range PRIMARY,b PRIMARY 8 NULL 1 Using where; Using index for group-by
2063
SELECT MAX(b), a FROM t1 WHERE b < 2 AND a = 1 GROUP BY a;
2066
SELECT MIN(b), a FROM t1 WHERE b > 1 AND a = 1 GROUP BY a;
2069
CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a,b,c));
2070
INSERT INTO t2 SELECT a,b,b FROM t1;
2071
explain SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a;
2072
id select_type table type possible_keys key key_len ref rows Extra
2073
1 SIMPLE t2 range PRIMARY PRIMARY 12 NULL 1 Using where; Using index for group-by
2074
SELECT MIN(c) FROM t2 WHERE b = 2 and a = 1 and c > 1 GROUP BY a;
2078
CREATE TABLE t1 (a INT, b INT, INDEX (a,b));
2079
INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5),
2080
(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
2081
EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
2082
id select_type table type possible_keys key key_len ref rows Extra
2083
1 SIMPLE t1 index NULL a 10 NULL 15 Using index
2085
SELECT max(b), a FROM t1 GROUP BY a;
2091
SHOW STATUS LIKE 'handler_read__e%';
2095
EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
2096
id select_type table type possible_keys key key_len ref rows Extra
2097
1 SIMPLE t1 index NULL a 10 NULL 15 Using index
2099
CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a;
2100
SHOW STATUS LIKE 'handler_read__e%';
2105
SELECT * FROM (SELECT max(b), a FROM t1 GROUP BY a) b;
2111
SHOW STATUS LIKE 'handler_read__e%';
2116
(SELECT max(b), a FROM t1 GROUP BY a) UNION
2117
(SELECT max(b), a FROM t1 GROUP BY a);
2123
SHOW STATUS LIKE 'handler_read__e%';
2127
EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION
2128
(SELECT max(b), a FROM t1 GROUP BY a);
2129
id select_type table type possible_keys key key_len ref rows Extra
2130
1 PRIMARY t1 index NULL a 10 NULL 15 Using index
2131
2 UNION t1 index NULL a 10 NULL 15 Using index
2132
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
2133
EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
2134
FROM t1 AS t1_outer;
2135
id select_type table type possible_keys key key_len ref rows Extra
2136
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
2137
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2138
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS
2139
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
2140
id select_type table type possible_keys key key_len ref rows Extra
2141
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
2142
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2143
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
2144
(SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
2145
id select_type table type possible_keys key key_len ref rows Extra
2146
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2147
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2148
EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
2149
a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
2150
id select_type table type possible_keys key key_len ref rows Extra
2151
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using where; Using index
2152
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2153
EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING
2154
a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
2155
id select_type table type possible_keys key key_len ref rows Extra
2156
1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index
2157
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2158
EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2
2159
ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2)
2160
AND t1_outer1.b = t1_outer2.b;
2161
id select_type table type possible_keys key key_len ref rows Extra
2162
1 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index
2163
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer
2164
2 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2165
EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
2166
FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
2167
id select_type table type possible_keys key key_len ref rows Extra
2168
1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using index
2169
2 SUBQUERY t1_outer index NULL a 10 NULL 15 Using index
2170
3 SUBQUERY t1 index NULL a 10 NULL 15 Using index
2171
CREATE TABLE t3 LIKE t1;
2173
INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a;
2174
SHOW STATUS LIKE 'handler_read__e%';
2180
INSERT INTO t3 SELECT 1, (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2)
2182
SHOW STATUS LIKE 'handler_read__e%';
2187
DELETE FROM t3 WHERE (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) > 10000;
2188
SHOW STATUS LIKE 'handler_read__e%';
2193
DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x
2195
ERROR 21000: Subquery returns more than 1 row
2196
SHOW STATUS LIKE 'handler_read__e%';
2200
DROP TABLE t1,t2,t3;
2201
CREATE TABLE t1 (a int, INDEX idx(a));
2202
INSERT INTO t1 VALUES
2203
(4), (2), (1), (2), (4), (2), (1), (4),
2204
(4), (2), (1), (2), (2), (4), (1), (4);
2205
EXPLAIN SELECT DISTINCT(a) FROM t1;
2206
id select_type table type possible_keys key key_len ref rows Extra
2207
1 SIMPLE t1 index NULL idx 5 NULL 16 Using index
2208
SELECT DISTINCT(a) FROM t1;
2213
EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
2214
id select_type table type possible_keys key key_len ref rows Extra
2215
1 SIMPLE t1 index NULL idx 5 NULL 16 Using index
2216
SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
2222
CREATE TABLE t1 (a INT, b INT);
2223
INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3);
2224
INSERT INTO t1 SELECT a + 1, b FROM t1;
2225
INSERT INTO t1 SELECT a + 2, b FROM t1;
2227
SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
2228
id select_type table type possible_keys key key_len ref rows Extra
2229
1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using temporary; Using filesort
2230
SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
2236
CREATE INDEX break_it ON t1 (a, b);
2238
SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;
2239
id select_type table type possible_keys key key_len ref rows Extra
2240
1 SIMPLE t1 index NULL break_it 10 NULL 12 Using index
2241
SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;
2248
SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
2249
id select_type table type possible_keys key key_len ref rows Extra
2250
1 SIMPLE t1 index NULL break_it 10 NULL 12 Using index
2251
SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
2258
SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC;
2259
id select_type table type possible_keys key key_len ref rows Extra
2260
1 SIMPLE t1 index NULL break_it 10 NULL 12 Using index
2261
SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC;
2262
a MIN(b) MAX(b) AVG(b)
2268
CREATE TABLE t1 (a int, b int, c int, d int,
2269
KEY foo (c,d,a,b), KEY bar (c,a,b,d));
2270
INSERT INTO t1 VALUES (1, 1, 1, 1), (1, 1, 1, 2), (1, 1, 1, 3), (1, 1, 1, 4);
2271
INSERT INTO t1 SELECT * FROM t1;
2272
INSERT INTO t1 SELECT * FROM t1;
2273
INSERT INTO t1 SELECT a,b,c+1,d FROM t1;
2274
EXPLAIN SELECT DISTINCT c FROM t1 WHERE d=4;
2275
id select_type table type possible_keys key key_len ref rows Extra
2276
1 SIMPLE t1 index NULL foo 20 NULL 32 Using where; Using index
2277
SELECT DISTINCT c FROM t1 WHERE d=4;