diff options
author | igor@olga.mysql.com <> | 2007-08-02 12:45:56 -0700 |
---|---|---|
committer | igor@olga.mysql.com <> | 2007-08-02 12:45:56 -0700 |
commit | cf39429295846cf944e3fd1a327c554ebd08942d (patch) | |
tree | cb69ff6598e568046e57c591baf10d4a49f2d5b7 /mysql-test/r/distinct.result | |
parent | 642b0c00ed99334a5540839c0e6598d7a26c8ac7 (diff) | |
download | mariadb-git-cf39429295846cf944e3fd1a327c554ebd08942d.tar.gz |
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.
Diffstat (limited to 'mysql-test/r/distinct.result')
-rw-r--r-- | mysql-test/r/distinct.result | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 002dbc6ccb5..795d8956a08 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -209,16 +209,16 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index explain SELECT distinct t1.a from t1 order by a desc limit 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index +1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index explain SELECT distinct a from t3 order by a desc limit 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index NULL a 5 NULL 204 Using index +1 SIMPLE t3 index NULL a 5 NULL 40 Using index explain SELECT distinct a,b from t3 order by a+1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort -explain SELECT distinct a,b from t3 order by a limit 10; +explain SELECT distinct a,b from t3 order by a limit 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index NULL a 5 NULL 204 Using temporary +1 SIMPLE t3 index NULL a 5 NULL 2 Using temporary explain SELECT a,b from t3 group by a,b order by a+1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort |