130
130
create index idx_t3_2 on t3 (a1,a2,b);
131
131
analyze table t3;
132
132
Table Op Msg_type Msg_text
133
test.t3 analyze status Table is already up to date
133
test.t3 analyze note The storage engine for the table doesn't support analyze
134
134
explain select a1, min(a2) from t1 group by a1;
135
135
id select_type table type possible_keys key key_len ref rows Extra
136
1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by
136
1 SIMPLE t1 range NULL idx_t1_1 518 NULL 5 Using index for group-by
137
137
explain select a1, max(a2) from t1 group by a1;
138
138
id select_type table type possible_keys key key_len ref rows Extra
139
1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-by
139
1 SIMPLE t1 range NULL idx_t1_1 259 NULL 5 Using index for group-by
140
140
explain select a1, min(a2), max(a2) from t1 group by a1;
141
141
id select_type table type possible_keys key key_len ref rows Extra
142
1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by
142
1 SIMPLE t1 range NULL idx_t1_1 518 NULL 5 Using index for group-by
143
143
explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;
144
144
id select_type table type possible_keys key key_len ref rows Extra
145
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
145
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
146
146
explain select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b;
147
147
id select_type table type possible_keys key key_len ref rows Extra
148
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
148
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
149
149
explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;
150
150
id select_type table type possible_keys key key_len ref rows Extra
151
1 SIMPLE t2 range NULL idx_t2_1 # NULL # Using index for group-by
151
1 SIMPLE t2 index NULL idx_t2_1 # NULL # Using index
152
152
explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;
153
153
id select_type table type possible_keys key key_len ref rows Extra
154
1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by
154
1 SIMPLE t1 range NULL idx_t1_1 518 NULL 5 Using index for group-by
155
155
explain select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b;
156
156
id select_type table type possible_keys key key_len ref rows Extra
157
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
157
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
158
158
explain select min(a2) from t1 group by a1;
159
159
id select_type table type possible_keys key key_len ref rows Extra
160
1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-by
160
1 SIMPLE t1 range NULL idx_t1_1 518 NULL 5 Using index for group-by
161
161
explain select a2, min(c), max(c) from t1 group by a1,a2,b;
162
162
id select_type table type possible_keys key key_len ref rows Extra
163
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
163
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
164
164
select a1, min(a2) from t1 group by a1;
288
288
explain select a1,a2,b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
289
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 147 NULL 10 Using where; Using index for group-by
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
291
explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;
292
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 147 NULL 14 Using where; Using index for group-by
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
294
explain select a1,a2,b, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
295
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 147 NULL 14 Using where; Using index for group-by
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
297
explain select a1, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
298
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 147 NULL 14 Using where; Using index for group-by
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
300
explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
301
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 147 NULL 17 Using where; Using index for group-by
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
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
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 147 NULL 10 Using where; Using index for group-by
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
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
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 147 NULL 10 Using where; Using index for group-by
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
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
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 147 NULL 10 Using where; Using index for group-by
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
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
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 147 NULL 10 Using where; Using index for group-by
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
315
explain select a1,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;
316
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 147 NULL 14 Using where; Using index for group-by
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
318
explain select a1, max(c) from t1 where a1 in ('a','b','d') group by a1,a2,b;
319
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 147 NULL 14 Using where; Using index for group-by
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
321
explain select a1,a2,b, max(c) from t2 where a1 < 'd' group by a1,a2,b;
322
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 146 NULL # Using where; Using index for group-by
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
324
explain select a1,a2,b,min(c),max(c) from t2 where a1 < 'd' group by a1,a2,b;
325
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 163 NULL # Using where; Using index for group-by
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
327
explain select a1,a2,b,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;
328
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 163 NULL # Using where; Using index for group-by
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
330
explain select a1,a2,b, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
331
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 146 NULL # Using where; Using index for group-by
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
333
explain select a1, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
334
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 146 NULL # Using where; Using index for group-by
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
336
explain select a1,a2,b,min(c),max(c) from t2 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
337
337
id select_type table type possible_keys key key_len ref rows Extra
338
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by
338
1 SIMPLE t2 index idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index
339
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
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 146 NULL # Using where; Using index for group-by
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
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
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 163 NULL # Using where; Using index for group-by
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
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
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 146 NULL # Using where; Using index for group-by
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
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
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 163 NULL # Using where; Using index for group-by
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
351
explain select a1,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;
352
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 163 NULL # Using where; Using index for group-by
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
354
explain select a1, max(c) from t2 where a1 in ('a','b','d') group by a1,a2,b;
355
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 146 NULL # Using where; Using index for group-by
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
357
select a1,a2,b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
358
358
a1 a2 b min(c) max(c)
670
670
explain select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
671
671
id select_type table type possible_keys key key_len ref rows Extra
672
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 5 Using where; Using index for group-by
672
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 5 Using where; Using index for group-by
673
673
explain select a1,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
674
674
id select_type table type possible_keys key key_len ref rows Extra
675
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 5 Using where; Using index for group-by
675
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 5 Using where; Using index for group-by
676
676
explain select a1,a2,b, max(c) from t1 where (b = 'b') group by a1,a2;
677
677
id select_type table type possible_keys key key_len ref rows Extra
678
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-by
678
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 9 Using where; Using index for group-by
679
679
explain select a1,a2,b,min(c),max(c) from t1 where (b = 'b') group by a1,a2;
680
680
id select_type table type possible_keys key key_len ref rows Extra
681
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-by
681
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 9 Using where; Using index for group-by
682
682
explain select a1,a2, max(c) from t1 where (b = 'b') group by a1,a2;
683
683
id select_type table type possible_keys key key_len ref rows Extra
684
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-by
684
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 9 Using where; Using index for group-by
685
685
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
686
686
id select_type table type possible_keys key key_len ref rows Extra
687
1 SIMPLE t2 range NULL idx_t2_1 163 NULL 5 Using where; Using index for group-by
687
1 SIMPLE t2 range NULL idx_t2_1 651 NULL 5 Using where; Using index for group-by
688
688
explain select a1,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
689
689
id select_type table type possible_keys key key_len ref rows Extra
690
1 SIMPLE t2 range NULL idx_t2_1 163 NULL 5 Using where; Using index for group-by
690
1 SIMPLE t2 range NULL idx_t2_1 651 NULL 5 Using where; Using index for group-by
691
691
explain select a1,a2,b, max(c) from t2 where (b = 'b') group by a1,a2;
692
692
id select_type table type possible_keys key key_len ref rows Extra
693
1 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by
693
1 SIMPLE t2 range NULL idx_t2_1 584 NULL 10 Using where; Using index for group-by
694
694
explain select a1,a2,b,min(c),max(c) from t2 where (b = 'b') group by a1,a2;
695
695
id select_type table type possible_keys key key_len ref rows Extra
696
1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by
696
1 SIMPLE t2 range NULL idx_t2_1 651 NULL 10 Using where; Using index for group-by
697
697
explain select a1,a2, max(c) from t2 where (b = 'b') group by a1,a2;
698
698
id select_type table type possible_keys key key_len ref rows Extra
699
1 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by
699
1 SIMPLE t2 range NULL idx_t2_1 584 NULL 10 Using where; Using index for group-by
700
700
explain select a1,a2,b,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
701
701
id select_type table type possible_keys key key_len ref rows Extra
702
1 SIMPLE t3 range NULL idx_t3_1 6 NULL 4 Using where; Using index for group-by
702
1 SIMPLE t3 range NULL idx_t3_1 21 NULL 4 Using where; Using index for group-by
703
703
explain select a1,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
704
704
id select_type table type possible_keys key key_len ref rows Extra
705
1 SIMPLE t3 range NULL idx_t3_1 6 NULL 4 Using where; Using index for group-by
705
1 SIMPLE t3 range NULL idx_t3_1 21 NULL 4 Using where; Using index for group-by
706
706
select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
707
707
a1 a2 b max(c) min(c)
805
805
explain select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
806
806
id select_type table type possible_keys key key_len ref rows Extra
807
1 SIMPLE t2 range NULL idx_t2_1 163 NULL 5 Using where; Using index for group-by
807
1 SIMPLE t2 range NULL idx_t2_1 651 NULL 5 Using where; Using index for group-by
808
808
explain select a1,a2,b,max(c) from t2 where (a2 = 'a') and b is NULL group by a1;
809
809
id select_type table type possible_keys key key_len ref rows Extra
810
1 SIMPLE t2 range NULL idx_t2_1 146 NULL 5 Using where; Using index for group-by
810
1 SIMPLE t2 range NULL idx_t2_1 584 NULL 5 Using where; Using index for group-by
811
811
explain select a1,a2,b,min(c) from t2 where b is NULL group by a1,a2;
812
812
id select_type table type possible_keys key key_len ref rows Extra
813
1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by
813
1 SIMPLE t2 range NULL idx_t2_1 651 NULL 10 Using where; Using index for group-by
814
814
explain select a1,a2,b,max(c) from t2 where b is NULL group by a1,a2;
815
815
id select_type table type possible_keys key key_len ref rows Extra
816
1 SIMPLE t2 range NULL idx_t2_1 146 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 163 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 163 NULL 10 Using where; Using index for group-by
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
823
select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
846
846
c a NULL c777 c999
847
847
explain select a1,a2,b, max(c) from t1 where (c > 'b1') group by a1,a2,b;
848
848
id select_type table type possible_keys key key_len ref rows Extra
849
1 SIMPLE t1 range NULL idx_t1_1 147 NULL # Using where; Using index for group-by
849
1 SIMPLE t1 range NULL idx_t1_1 585 NULL # Using where; Using index for group-by
850
850
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') group by a1,a2,b;
851
851
id select_type table type possible_keys key key_len ref rows Extra
852
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
852
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
853
853
explain select a1,a2,b, max(c) from t1 where (c > 'f123') group by a1,a2,b;
854
854
id select_type table type possible_keys key key_len ref rows Extra
855
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
855
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
856
856
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'f123') group by a1,a2,b;
857
857
id select_type table type possible_keys key key_len ref rows Extra
858
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
858
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
859
859
explain select a1,a2,b, max(c) from t1 where (c < 'a0') group by a1,a2,b;
860
860
id select_type table type possible_keys key key_len ref rows Extra
861
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
861
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
862
862
explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') group by a1,a2,b;
863
863
id select_type table type possible_keys key key_len ref rows Extra
864
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
864
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
865
865
explain select a1,a2,b, max(c) from t1 where (c < 'k321') group by a1,a2,b;
866
866
id select_type table type possible_keys key key_len ref rows Extra
867
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
867
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
868
868
explain select a1,a2,b,min(c),max(c) from t1 where (c < 'k321') group by a1,a2,b;
869
869
id select_type table type possible_keys key key_len ref rows Extra
870
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
870
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
871
871
explain select a1,a2,b, max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
872
872
id select_type table type possible_keys key key_len ref rows Extra
873
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
873
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
874
874
explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
875
875
id select_type table type possible_keys key key_len ref rows Extra
876
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
876
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
877
877
explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
878
878
id select_type table type possible_keys key key_len ref rows Extra
879
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
879
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
880
880
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
881
881
id select_type table type possible_keys key key_len ref rows Extra
882
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
882
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
883
883
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
884
884
id select_type table type possible_keys key key_len ref rows Extra
885
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
885
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
886
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
887
id select_type table type possible_keys key key_len ref rows Extra
888
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
888
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
889
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
890
id select_type table type possible_keys key key_len ref rows Extra
891
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
891
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
892
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
893
id select_type table type possible_keys key key_len ref rows Extra
894
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
894
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
895
895
explain select a1,a2,b, max(c) from t2 where (c > 'b1') group by a1,a2,b;
896
896
id select_type table type possible_keys key key_len ref rows Extra
897
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
897
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
898
898
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') group by a1,a2,b;
899
899
id select_type table type possible_keys key key_len ref rows Extra
900
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
900
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
901
901
explain select a1,a2,b, max(c) from t2 where (c > 'f123') group by a1,a2,b;
902
902
id select_type table type possible_keys key key_len ref rows Extra
903
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
903
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
904
904
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'f123') group by a1,a2,b;
905
905
id select_type table type possible_keys key key_len ref rows Extra
906
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
906
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
907
907
explain select a1,a2,b, max(c) from t2 where (c < 'a0') group by a1,a2,b;
908
908
id select_type table type possible_keys key key_len ref rows Extra
909
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
909
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
910
910
explain select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') group by a1,a2,b;
911
911
id select_type table type possible_keys key key_len ref rows Extra
912
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
912
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
913
913
explain select a1,a2,b, max(c) from t2 where (c < 'k321') group by a1,a2,b;
914
914
id select_type table type possible_keys key key_len ref rows Extra
915
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
915
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
916
916
explain select a1,a2,b,min(c),max(c) from t2 where (c < 'k321') group by a1,a2,b;
917
917
id select_type table type possible_keys key key_len ref rows Extra
918
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
918
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
919
919
explain select a1,a2,b, max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
920
920
id select_type table type possible_keys key key_len ref rows Extra
921
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
921
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
922
922
explain select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
923
923
id select_type table type possible_keys key key_len ref rows Extra
924
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
924
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
925
925
explain select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
926
926
id select_type table type possible_keys key key_len ref rows Extra
927
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
927
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
928
928
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
929
929
id select_type table type possible_keys key key_len ref rows Extra
930
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
930
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
931
931
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
932
932
id select_type table type possible_keys key key_len ref rows Extra
933
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
933
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
934
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
935
id select_type table type possible_keys key key_len ref rows Extra
936
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
936
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
937
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
938
id select_type table type possible_keys key key_len ref rows Extra
939
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
939
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
940
940
select a1,a2,b, max(c) from t1 where (c > 'b1') group by a1,a2,b;
1358
1308
where exists ( select * from t2 where t2.c = t1.c )
1359
1309
group by a1,a2,b;
1360
1310
id select_type table type possible_keys key key_len ref rows Extra
1361
1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
1362
2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
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
1363
1313
explain select a1,a2,b,min(c),max(c) from t1
1364
1314
where exists ( select * from t2 where t2.c > 'b1' )
1365
1315
group by a1,a2,b;
1366
1316
id select_type table type possible_keys key key_len ref rows Extra
1367
1 PRIMARY t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
1368
2 SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
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
1369
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;
1370
1320
id select_type table type possible_keys key key_len ref rows Extra
1371
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
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
1372
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;
1373
1323
id select_type table type possible_keys key key_len ref rows Extra
1374
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 17 Using where; Using index for group-by
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
1375
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;
1376
1326
id select_type table type possible_keys key key_len ref rows Extra
1377
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
1327
1 SIMPLE t1 range NULL idx_t1_1 651 NULL 17 Using where; Using index for group-by
1378
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;
1379
1329
id select_type table type possible_keys key key_len ref rows Extra
1380
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 14 Using where; Using index for group-by
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
1381
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;
1382
1332
id select_type table type possible_keys key key_len ref rows Extra
1383
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 14 Using where; Using index for group-by
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
1384
1334
explain select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1385
1335
id select_type table type possible_keys key key_len ref rows Extra
1386
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-by
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
1387
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;
1388
1338
id select_type table type possible_keys key key_len ref rows Extra
1389
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
1339
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
1390
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;
1391
1341
id select_type table type possible_keys key key_len ref rows Extra
1392
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by
1342
1 SIMPLE t2 index idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index
1393
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;
1394
1344
id select_type table type possible_keys key key_len ref rows Extra
1395
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by
1345
1 SIMPLE t2 index idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 651 NULL # Using where; Using index
1396
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;
1397
1347
id select_type table type possible_keys key key_len ref rows Extra
1398
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
1348
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
1399
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;
1400
1350
id select_type table type possible_keys key key_len ref rows Extra
1401
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by
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
1402
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;
1403
1353
id select_type table type possible_keys key key_len ref rows Extra
1404
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by
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
1405
1355
explain select a1,a2,b,min(c) from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1406
1356
id select_type table type possible_keys key key_len ref rows Extra
1407
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by
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
1408
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;
1409
1359
a1 a2 b min(c) max(c)
1410
1360
a a b e112 h112
1492
1422
explain select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1493
1423
id select_type table type possible_keys key key_len ref rows Extra
1494
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-by
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
1495
1425
explain select a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1496
1426
id select_type table type possible_keys key key_len ref rows Extra
1497
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
1427
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
1498
1428
explain select a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1499
1429
id select_type table type possible_keys key key_len ref rows Extra
1500
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
1430
1 SIMPLE t1 index NULL idx_t1_1 651 NULL 128 Using where; Using index
1501
1431
explain select a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1502
1432
id select_type table type possible_keys key key_len ref rows Extra
1503
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-by
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
1504
1434
explain select a1,a2,b from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1505
1435
id select_type table type possible_keys key key_len ref rows Extra
1506
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by
1436
1 SIMPLE t2 index idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_2 584 NULL # Using where; Using index
1507
1437
explain select a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1508
1438
id select_type table type possible_keys key key_len ref rows Extra
1509
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
1439
1 SIMPLE t2 index NULL idx_t2_2 584 NULL # Using where; Using index
1510
1440
explain select a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1511
1441
id select_type table type possible_keys key key_len ref rows Extra
1512
1 SIMPLE t2 index NULL idx_t2_1 163 NULL # Using where; Using index
1442
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
1513
1443
explain select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1514
1444
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 146 NULL # Using where; Using index for group-by
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
1516
1446
select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
1555
1485
explain select distinct a1,a2,b from t1;
1556
1486
id select_type table type possible_keys key key_len ref rows Extra
1557
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
1487
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
1558
1488
explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a');
1559
1489
id select_type table type possible_keys key key_len ref rows Extra
1560
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
1490
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
1561
1491
explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
1562
1492
id select_type table type possible_keys key key_len ref rows filtered Extra
1563
1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 50.78 Using where; Using index
1493
1 SIMPLE t1 index NULL idx_t1_1 651 NULL 128 50.78 Using where; Using index
1565
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"."c" = 'i121') and ("test"."t1"."b" = 'a') and ("test"."t1"."a2" >= 'b'))
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'))
1566
1496
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
1567
1497
id select_type table type possible_keys key key_len ref rows Extra
1568
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-by
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
1569
1499
explain select distinct b from t1 where (a2 >= 'b') and (b = 'a');
1570
1500
id select_type table type possible_keys key key_len ref rows Extra
1571
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
1501
1 SIMPLE t1 index NULL idx_t1_2 585 NULL 128 Using where; Using index
1572
1502
explain select distinct a1,a2,b from t2;
1573
1503
id select_type table type possible_keys key key_len ref rows Extra
1574
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using index for group-by
1504
1 SIMPLE t2 index NULL idx_t2_2 584 NULL # Using index
1575
1505
explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a');
1576
1506
id select_type table type possible_keys key key_len ref rows Extra
1577
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
1507
1 SIMPLE t2 index NULL idx_t2_2 584 NULL # Using where; Using index
1578
1508
explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
1579
1509
id select_type table type possible_keys key key_len ref rows filtered Extra
1580
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 50.61 Using where; Using index
1510
1 SIMPLE t2 index NULL idx_t2_1 651 NULL 164 50.61 Using where; Using index
1582
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"."c" = 'i121') and ("test"."t2"."b" = 'a') and ("test"."t2"."a2" >= 'b'))
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'))
1583
1513
explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
1584
1514
id select_type table type possible_keys key key_len ref rows Extra
1585
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by
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
1586
1516
explain select distinct b from t2 where (a2 >= 'b') and (b = 'a');
1587
1517
id select_type table type possible_keys key key_len ref rows Extra
1588
1 SIMPLE t2 index NULL idx_t2_2 146 NULL 164 Using where; Using index
1518
1 SIMPLE t2 index NULL idx_t2_2 584 NULL 164 Using where; Using index
1589
1519
select distinct a1,a2,b from t1;
1703
1633
explain select distinct a1,a2,b from t1;
1704
1634
id select_type table type possible_keys key key_len ref rows Extra
1705
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by
1635
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using index for group-by
1706
1636
explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1707
1637
id select_type table type possible_keys key key_len ref rows Extra
1708
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
1638
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by
1709
1639
explain select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1710
1640
id select_type table type possible_keys key key_len ref rows Extra
1711
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
1641
1 SIMPLE t1 index NULL idx_t1_1 651 NULL 128 Using where; Using index
1712
1642
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1713
1643
id select_type table type possible_keys key key_len ref rows Extra
1714
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-by
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
1715
1645
explain select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1716
1646
id select_type table type possible_keys key key_len ref rows Extra
1717
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by; Using temporary; Using filesort
1647
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 17 Using where; Using index for group-by; Using temporary; Using filesort
1718
1648
explain select distinct a1,a2,b from t2;
1719
1649
id select_type table type possible_keys key key_len ref rows Extra
1720
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using index for group-by
1650
1 SIMPLE t2 index NULL idx_t2_2 584 NULL # Using index
1721
1651
explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1722
1652
id select_type table type possible_keys key key_len ref rows Extra
1723
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
1653
1 SIMPLE t2 index NULL idx_t2_2 584 NULL # Using where; Using index
1724
1654
explain select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
1725
1655
id select_type table type possible_keys key key_len ref rows Extra
1726
1 SIMPLE t2 index NULL idx_t2_1 163 NULL # Using where; Using index
1656
1 SIMPLE t2 index NULL idx_t2_1 651 NULL # Using where; Using index
1727
1657
explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
1728
1658
id select_type table type possible_keys key key_len ref rows Extra
1729
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by
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
1730
1660
explain select distinct b from t2 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
1731
1661
id select_type table type possible_keys key key_len ref rows Extra
1732
1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by; Using temporary; Using filesort
1662
1 SIMPLE t2 index NULL idx_t2_2 584 NULL # Using where; Using index; Using temporary; Using filesort
1733
1663
select distinct a1,a2,b from t1;
1801
1731
explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
1802
1732
id select_type table type possible_keys key key_len ref rows Extra
1803
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
1733
1 SIMPLE t1 index NULL idx_t1_2 585 NULL 128 Using where; Using index
1804
1734
explain select count(distinct a1,a2,b,c) from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
1805
1735
id select_type table type possible_keys key key_len ref rows Extra
1806
1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
1736
1 SIMPLE t1 index NULL idx_t1_1 651 NULL 128 Using where; Using index
1807
1737
explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
1808
1738
id select_type table type possible_keys key key_len ref rows filtered Extra
1809
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
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
1811
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"."b" = 'c') and ("test"."t1"."a1" > 'a') and ("test"."t1"."a2" > 'a'))
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'))
1812
1742
explain select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a');
1813
1743
id select_type table type possible_keys key key_len ref rows Extra
1814
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
1744
1 SIMPLE t1 index NULL idx_t1_2 585 NULL 128 Using where; Using index
1815
1745
explain extended select ord(a1) + count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a');
1816
1746
id select_type table type possible_keys key key_len ref rows filtered Extra
1817
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
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
1819
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'))
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'))
1820
1750
select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
1821
1751
count(distinct a1,a2,b)
1835
1765
explain select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b;
1836
1766
id select_type table type possible_keys key key_len ref rows Extra
1837
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-by
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
1838
1768
explain select concat(a1,min(c)),b from t1 where a1 < 'd' group by a1,a2,b;
1839
1769
id select_type table type possible_keys key key_len ref rows Extra
1840
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-by
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
1841
1771
explain select concat(a1,min(c)),b,max(c) from t1 where a1 < 'd' group by a1,a2,b;
1842
1772
id select_type table type possible_keys key key_len ref rows Extra
1843
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-by
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
1844
1774
explain select concat(a1,a2),b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;
1845
1775
id select_type table type possible_keys key key_len ref rows Extra
1846
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-by
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
1847
1777
explain select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2;
1848
1778
id select_type table type possible_keys key key_len ref rows Extra
1849
1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using index for group-by
1779
1 SIMPLE t1 range NULL idx_t1_1 585 NULL 9 Using index for group-by
1850
1780
select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b;
1851
1781
a1 a2 b concat(min(c), max(c))
1922
1852
explain extended select a1,a2,min(b),max(b) from t1
1923
1853
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2;
1924
1854
id select_type table type possible_keys key key_len ref rows filtered Extra
1925
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index
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
1927
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"
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`
1928
1858
explain extended select a1,a2,b,min(c),max(c) from t1
1929
1859
where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b;
1930
1860
id select_type table type possible_keys key key_len ref rows filtered Extra
1931
1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort
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
1933
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"
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`
1934
1864
explain extended select a1,a2,b,c from t1
1935
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;
1936
1866
id select_type table type possible_keys key key_len ref rows filtered Extra
1937
1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort
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
1939
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"
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`
1940
1870
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1;
1941
1871
id select_type table type possible_keys key key_len ref rows Extra
1942
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
1872
1 SIMPLE t2 index NULL idx_t2_1 651 NULL 164 Using where; Using index
1943
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;
1944
1874
id select_type table type possible_keys key key_len ref rows filtered Extra
1945
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index
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
1947
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"
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`
1948
1878
explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1;
1949
1879
id select_type table type possible_keys key key_len ref rows Extra
1950
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
1880
1 SIMPLE t2 index NULL idx_t2_1 651 NULL 164 Using where; Using index
1951
1881
select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1;
1954
1884
explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b = 'a') group by a1;
1955
1885
id select_type table type possible_keys key key_len ref rows Extra
1956
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
1886
1 SIMPLE t2 index NULL idx_t2_1 651 NULL 164 Using where; Using index
1957
1887
explain select a1,a2,b,min(c),max(c) from t2
1958
1888
where (c > 'a000') and (c <= 'd999') and (c like '_8__') group by a1,a2,b;
1959
1889
id select_type table type possible_keys key key_len ref rows Extra
1960
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
1890
1 SIMPLE t2 index NULL idx_t2_1 651 NULL 164 Using where; Using index
1961
1891
explain select a1, a2, b, c, min(d), max(d) from t1 group by a1,a2,b,c;
1962
1892
id select_type table type possible_keys key key_len ref rows Extra
1963
1893
1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using temporary; Using filesort
1964
1894
explain select a1,a2,count(a2) from t1 group by a1,a2,b;
1965
1895
id select_type table type possible_keys key key_len ref rows Extra
1966
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using index
1896
1 SIMPLE t1 index NULL idx_t1_2 585 NULL 128 Using index
1967
1897
explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b;
1968
1898
id select_type table type possible_keys key key_len ref rows filtered Extra
1969
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
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
1971
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"
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`
1972
1902
explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
1973
1903
id select_type table type possible_keys key key_len ref rows filtered Extra
1974
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index
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
1976
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"
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`
1977
1907
explain select distinct(a1) from t1 where ord(a2) = 98;
1978
1908
id select_type table type possible_keys key key_len ref rows Extra
1979
1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index
1909
1 SIMPLE t1 index NULL idx_t1_2 585 NULL 128 Using where; Using index
1980
1910
select distinct(a1) from t1 where ord(a2) = 98;