mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Better optimization for InnoDB and BDB tables for ORDER BY
Build-tools/Do-compile: Merge with 4.0 Docs/manual.texi: Changelog mysql-test/r/innodb.result: New tests cases for ORDER BY mysql-test/r/myisam.result: New tests cases for ORDER BY mysql-test/t/innodb.test: New tests cases for ORDER BY mysql-test/t/myisam.test: New tests cases for ORDER BY
This commit is contained in:
@ -483,3 +483,19 @@ id name value uid
|
||||
1 one one value 101
|
||||
3 three three value 103
|
||||
6 two other value 102
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 index NULL PRIMARY 4 NULL 4
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 index NULL b 4 NULL 4
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ALL NULL NULL NULL NULL 4 Using filesort
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 index NULL PRIMARY 4 NULL 4 Using index
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 index NULL b 4 NULL 4 Using index
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 index NULL b 4 NULL 4 Using index
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 index NULL b 4 NULL 4 Using index
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ALL NULL NULL NULL NULL 4
|
||||
|
@ -20,3 +20,19 @@ test.t1 optimize status Table is already up to date
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment
|
||||
t1 0 PRIMARY 1 a A 5 NULL NULL
|
||||
t1 1 b 1 b A 1 NULL NULL
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ALL NULL NULL NULL NULL 4 Using filesort
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ALL NULL NULL NULL NULL 4 Using filesort
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ALL NULL NULL NULL NULL 4 Using filesort
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 index NULL PRIMARY 4 NULL 4 Using index
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 index NULL b 4 NULL 4 Using index
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ALL NULL NULL NULL NULL 4 Using filesort
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ALL NULL NULL NULL NULL 4
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 ALL NULL NULL NULL NULL 4
|
||||
|
@ -513,3 +513,19 @@ set insert_id=6;
|
||||
replace into t1 (value,name,uid) values ('other value','two',102);
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test of how ORDER BY works when doing it on the whole table
|
||||
#
|
||||
|
||||
create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=innodb;
|
||||
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
|
||||
explain select * from t1 order by a;
|
||||
explain select * from t1 order by b;
|
||||
explain select * from t1 order by c;
|
||||
explain select a from t1 order by a;
|
||||
explain select b from t1 order by b;
|
||||
explain select a,b from t1 order by b;
|
||||
explain select a,b from t1;
|
||||
explain select a,b,c from t1;
|
||||
drop table t1;
|
||||
|
@ -48,3 +48,19 @@ show index from t1;
|
||||
optimize table t1;
|
||||
show index from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test of how ORDER BY works when doing it on the whole table
|
||||
#
|
||||
|
||||
create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=myisam;
|
||||
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
|
||||
explain select * from t1 order by a;
|
||||
explain select * from t1 order by b;
|
||||
explain select * from t1 order by c;
|
||||
explain select a from t1 order by a;
|
||||
explain select b from t1 order by b;
|
||||
explain select a,b from t1 order by b;
|
||||
explain select a,b from t1;
|
||||
explain select a,b,c from t1;
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user