mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +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:
@@ -154,7 +154,7 @@ teststring
|
||||
teststring
|
||||
explain select * from t1 order by text1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL key1 34 NULL 3
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
|
||||
alter table t1 modify text1 char(32) binary not null;
|
||||
select * from t1 order by text1;
|
||||
text1
|
||||
|
||||
Reference in New Issue
Block a user