Please sign in to comment.
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.
- Loading branch information...
Showing with 357 additions and 103 deletions.
- +4 −4 mysql-test/r/distinct.result
- +1 −1 mysql-test/r/endspace.result
- +1 −1 mysql-test/r/group_by.result
- +5 −5 mysql-test/r/group_min_max.result
- +1 −1 mysql-test/r/innodb.result
- +11 −11 mysql-test/r/innodb_mysql.result
- +1 −1 mysql-test/r/merge.result
- +55 −0 mysql-test/r/order_by.result
- +1 −1 mysql-test/r/select_found.result
- +1 −1 mysql-test/r/subselect.result
- +1 −1 mysql-test/t/distinct.test
- +37 −0 mysql-test/t/order_by.test
- +232 −76 sql/sql_select.cc
- +6 −0 sql/sql_select.h
Oops, something went wrong.