mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Bug #31094: Forcing index-based sort doesn't work anymore if joins are done
A rule was introduced by the 5.1 part of the fix for bug 27531 to prefer filesort over indexed ORDER BY when accessing all of the rows of a table (because it's faster). This new rule was not accounting for the presence of a LIMIT clause. Fixed the condition for this rule so it will prefer filesort over indexed ORDER BY only if no LIMIT. mysql-test/r/compress.result: Bug #31094: LIMIT is not considered a full index scan mysql-test/r/join.result: Bug #31094: test case mysql-test/r/select.result: Bug #31094: LIMIT is not considered a full index scan mysql-test/r/ssl.result: Bug #31094: LIMIT is not considered a full index scan mysql-test/r/ssl_compress.result: Bug #31094: LIMIT is not considered a full index scan mysql-test/t/join.test: Bug #31094: test case sql/sql_select.cc: Bug #31094: prefer filesort over indexed ORDER BY only if no LIMIT
This commit is contained in:
@@ -611,11 +611,11 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 ALL period NULL NULL NULL 41810 Using filesort
|
||||
1 SIMPLE t3 index period period 4 NULL 1
|
||||
1 SIMPLE t1 ref period period 4 test.t3.period 4181
|
||||
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using filesort
|
||||
1 SIMPLE t1 index period period 4 NULL 1
|
||||
1 SIMPLE t3 ref period period 4 test.t1.period 4181
|
||||
select period from t1;
|
||||
period
|
||||
|
||||
Reference in New Issue
Block a user