mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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.
This commit is contained in:
@ -194,6 +194,12 @@ typedef struct st_join_table {
|
||||
enum join_type type;
|
||||
bool cached_eq_ref_table,eq_ref_table,not_used_in_distinct;
|
||||
bool sorted;
|
||||
/*
|
||||
If it's not 0 the number stored this field indicates that the index
|
||||
scan has been chosen to access the table data and we expect to scan
|
||||
this number of rows for the table.
|
||||
*/
|
||||
ha_rows limit;
|
||||
TABLE_REF ref;
|
||||
JOIN_CACHE cache;
|
||||
JOIN *join;
|
||||
|
Reference in New Issue
Block a user