| 1 |
create table t1(c1 int not null, c2 double not null, c3 char(255) not null) engine=archive charset=latin1; |
| 2 |
insert t1 select seq, seq+0.7, concat('row with c1 = ', seq) from seq_1_to_10; |
| 3 |
explain partitions select c1,c3 from t1 order by c2; |
| 4 |
id select_type table partitions type possible_keys key key_len ref rows Extra |
| 5 |
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using filesort |
| 6 |
set max_length_for_sort_data = 4; |
| 7 |
explain partitions select c1,c3 from t1 order by c2; |
| 8 |
id select_type table partitions type possible_keys key key_len ref rows Extra |
| 9 |
1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using temporary; Using filesort |
| 10 |
flush status; |
| 11 |
select c1,c3 from t1 order by c2; |
| 12 |
c1 c3 |
| 13 |
1 row with c1 = 1 |
| 14 |
2 row with c1 = 2 |
| 15 |
3 row with c1 = 3 |
| 16 |
4 row with c1 = 4 |
| 17 |
5 row with c1 = 5 |
| 18 |
6 row with c1 = 6 |
| 19 |
7 row with c1 = 7 |
| 20 |
8 row with c1 = 8 |
| 21 |
9 row with c1 = 9 |
| 22 |
10 row with c1 = 10 |
| 23 |
set max_length_for_sort_data = default; |
| 24 |
show status where variable_name like '%tmp%' and value != 0; |
| 25 |
Variable_name Value |
| 26 |
Created_tmp_tables 1 |
| 27 |
Handler_tmp_write 10 |
| 28 |
Rows_tmp_read 20 |
| 29 |
alter table t1 partition by hash (c1) partitions 3; |
| 30 |
explain partitions select c1,c3 from t1 order by c2; |
| 31 |
id select_type table partitions type possible_keys key key_len ref rows Extra |
| 32 |
1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 10 Using filesort |
| 33 |
set max_length_for_sort_data = 4; |
| 34 |
explain partitions select c1,c3 from t1 order by c2; |
| 35 |
id select_type table partitions type possible_keys key key_len ref rows Extra |
| 36 |
1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort |
| 37 |
flush status; |
| 38 |
select c1,c3 from t1 order by c2; |
| 39 |
c1 c3 |
| 40 |
1 row with c1 = 1 |
| 41 |
2 row with c1 = 2 |
| 42 |
3 row with c1 = 3 |
| 43 |
4 row with c1 = 4 |
| 44 |
5 row with c1 = 5 |
| 45 |
6 row with c1 = 6 |
| 46 |
7 row with c1 = 7 |
| 47 |
8 row with c1 = 8 |
| 48 |
9 row with c1 = 9 |
| 49 |
10 row with c1 = 10 |
| 50 |
set max_length_for_sort_data = default; |
| 51 |
show status where variable_name like '%tmp%' and value != 0; |
| 52 |
Variable_name Value |
| 53 |
Created_tmp_tables 1 |
| 54 |
Handler_tmp_write 10 |
| 55 |
Rows_tmp_read 20 |
| 56 |
drop table t1; |