diff options
author | unknown <igor@olga.mysql.com> | 2008-04-24 14:19:44 -0700 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2008-04-24 14:19:44 -0700 |
commit | 2a1ba656b4df9cad33c0ac6ccc80e3a714b30634 (patch) | |
tree | 96290fe1bdb7cb5dfeeb0f7a466fa57d06d76e00 /sql/sql_select.cc | |
parent | 9cb63bfbdd7c1d1e63b0dc2fb5346a500d785de5 (diff) | |
parent | 61f6c60274ac03e2993971d7332fe9d05aaebba5 (diff) | |
download | mariadb-git-2a1ba656b4df9cad33c0ac6ccc80e3a714b30634.tar.gz |
Merge olga.mysql.com:/home/igor/mysql-5.1-bugteam
into olga.mysql.com:/home/igor/dev-opt/mysql-5.1-bug35844
sql/sql_select.cc:
Auto merged
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3353b7c8a80..642544a524d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12967,6 +12967,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, uint tablenr= tab - join->join_tab; ha_rows table_records= table->file->stats.records; bool group= join->group && order == join->group_list; + ha_rows ref_key_quick_rows= HA_POS_ERROR; LINT_INIT(best_key_parts); LINT_INIT(best_key_direction); LINT_INIT(best_records); @@ -13000,6 +13001,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, else keys= usable_keys; + if (ref_key >= 0 && table->covering_keys.is_set(ref_key)) + ref_key_quick_rows= table->quick_rows[ref_key]; + read_time= join->best_positions[tablenr].read_time; for (uint i= tablenr+1; i < join->tables; i++) fanout*= join->best_positions[i].records_read; // fanout is always >= 1 @@ -13094,7 +13098,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, index_scan_time < read_time) { ha_rows quick_records= table_records; - if (is_best_covering && !is_covering) + if (is_best_covering && !is_covering || + is_covering && ref_key_quick_rows < select_limit) continue; if (table->quick_keys.is_set(nr)) quick_records= table->quick_rows[nr]; |