#At file:///home/kgeorge/mysql/work/B36259-5.1-bugteam/ based on revid:gshchepa@stripped
2905 Georgi Kodinov 2009-05-28
Bug #36259 : proof-of-concept fix (not final!).
Don't accept unconditionally (without comparing the cost)
clustered ordering indexes.
modified:
sql/sql_select.cc
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2009-05-15 13:25:29 +0000
+++ b/sql/sql_select.cc 2009-05-28 12:08:19 +0000
@@ -13124,9 +13124,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,OR
if (keys.is_set(nr) &&
(direction= test_if_order_by_key(order, table, nr, &used_key_parts)))
{
- bool is_covering= table->covering_keys.is_set(nr) ||
- nr == table->s->primary_key &&
- table->file->primary_key_is_clustered();
+ bool is_clustered= nr == table->s->primary_key &&
+ table->file->primary_key_is_clustered();
+ bool is_covering= table->covering_keys.is_set(nr) || is_clustered;
/*
Don't use an index scan with ORDER BY without limit.
@@ -13203,7 +13203,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,OR
*/
index_scan_time= select_limit/rec_per_key *
min(rec_per_key, table->file->scan_time());
- if (is_covering ||
+ if ((is_covering && !is_clustered) ||
ref_key < 0 && (group || table->force_index) ||
index_scan_time < read_time)
{
Attachment: [text/bzr-bundle] bzr/joro@sun.com-20090528120819-ob0vormokcut4n84.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (joro:2905) Bug#36259 | Georgi Kodinov | 28 May |