Commit dcde0edf authored by marko's avatar marko

branches/zip: innodb-index.result: Adapt the results to a patch from MySQL.

Unfortunately, the patch seems to prevent MySQL from utilizing secondary
indexes in the ORDER BY clauses.  Thus, the test no longer checks if newly
created indexes are well-formed.

ChangeSet@1.2528.98.1  2007-08-02 12:45:56-07:00  igor@mysql.com

Fixed bug#28404.
This patch adds cost estimation for the queries with ORDER BY / GROUP BY
and LIMIT. 
If there was a ref/range access to the table whose rows were required
to be ordered in the result set the optimizer always employed this access
though a scan by a different index that was compatible with the required 
order could be cheaper to produce the first L rows of the result set.
Now for such queries the optimizer makes a choice between the cheapest
ref/range accesses not compatible with the given order and index scans
compatible with it.
parent bfc48819
...@@ -17,7 +17,7 @@ t1 CREATE TABLE `t1` ( ...@@ -17,7 +17,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
explain select * from t1 order by d; explain select * from t1 order by d;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL d2 23 NULL 4 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
select * from t1 order by d; select * from t1 order by d;
a b c d a b c d
3 4 ad ad 3 4 ad ad
...@@ -104,7 +104,7 @@ t1 CREATE TABLE `t1` ( ...@@ -104,7 +104,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
explain select * from t1 order by c; explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c 10 NULL 4 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
select * from t1 order by c; select * from t1 order by c;
a b c d a b c d
3 4 ad ad 3 4 ad ad
...@@ -156,13 +156,13 @@ a b c d ...@@ -156,13 +156,13 @@ a b c d
4 4 tr tr 4 4 tr tr
explain select * from t1 order by b; explain select * from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 5 NULL 5 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
explain select * from t1 order by c; explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c 10 NULL 5 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
explain select * from t1 order by d; explain select * from t1 order by d;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL d2 23 NULL 5 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -341,7 +341,7 @@ a b c d ...@@ -341,7 +341,7 @@ a b c d
8 9 fff fff 8 9 fff fff
explain select * from t1 order by b; explain select * from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 16 NULL 5 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
explain select * from t1 order by c; explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
...@@ -394,7 +394,7 @@ a b c d ...@@ -394,7 +394,7 @@ a b c d
11 11 kkk kkk 11 11 kkk kkk
explain select * from t1 order by b; explain select * from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 16 NULL 6 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
explain select * from t1 order by c; explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
...@@ -452,10 +452,10 @@ a b c d ...@@ -452,10 +452,10 @@ a b c d
11 11 kkk kkk 11 11 kkk kkk
explain select * from t1 order by b; explain select * from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 16 NULL 7 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using filesort
explain select * from t1 order by c; explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c 34 NULL 7 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using filesort
explain select * from t1 order by d; explain select * from t1 order by d;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using filesort
...@@ -639,7 +639,7 @@ a b c d ...@@ -639,7 +639,7 @@ a b c d
10 10 kkk iii 10 10 kkk iii
explain select * from t1 order by b; explain select * from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 5 NULL 6 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
explain select * from t1 order by c; explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
...@@ -696,13 +696,13 @@ a b c d ...@@ -696,13 +696,13 @@ a b c d
11 11 aaa mmm 11 11 aaa mmm
explain select * from t1 order by b; explain select * from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 5 NULL 7 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using filesort
explain select * from t1 order by c; explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c 31 NULL 7 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using filesort
explain select * from t1 order by d; explain select * from t1 order by d;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL d 63 NULL 7 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using filesort
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -766,7 +766,7 @@ a b c d ...@@ -766,7 +766,7 @@ a b c d
8 9 fff fff 8 9 fff fff
explain select * from t1 order by b; explain select * from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 5 NULL 5 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
explain select * from t1 order by c; explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
...@@ -819,13 +819,13 @@ a b c d ...@@ -819,13 +819,13 @@ a b c d
10 10 aaa kkk 10 10 aaa kkk
explain select * from t1 order by b; explain select * from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 5 NULL 6 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
explain select * from t1 order by c; explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c 21 NULL 6 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
explain select * from t1 order by d; explain select * from t1 order by d;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL d 43 NULL 6 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -914,13 +914,13 @@ Table Op Msg_type Msg_text ...@@ -914,13 +914,13 @@ Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
explain select * from t1 order by c; explain select * from t1 order by c;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c 5 NULL 9 1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
explain select * from t1 order by a; explain select * from t1 order by a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 9 1 SIMPLE t1 index NULL PRIMARY 4 NULL 9
explain select * from t1 order by b; explain select * from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 4 NULL 9 1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
select * from t1 order by a; select * from t1 order by a;
a b c a b c
1 5 1 1 5 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment