1
0
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.
This commit is contained in:
gkodinov/kgeorge@magare.gmz
2007-10-05 17:28:34 +03:00
parent 0b2f20bb9c
commit 91455690b5
7 changed files with 207 additions and 14 deletions

View File

@@ -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