diff options
author | unknown <sergefp@mysql.com> | 2005-04-21 01:55:33 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2005-04-21 01:55:33 +0400 |
commit | a52359e00ccff887f9607c37715f495296c033e5 (patch) | |
tree | e171a6c5adc44eafc57d6943052326006901c0a1 /sql/opt_range.cc | |
parent | 241bedadeb19d6d08976a915c0c958eadd51c5c6 (diff) | |
download | mariadb-git-a52359e00ccff887f9607c37715f495296c033e5.tar.gz |
Fix for BUG#10037
* Add 0.01 to cost of 'range'+'using index' scan to avoid optimizer choice races with
'index' scan.
mysql-test/r/range.result:
Update the test result after the changed cost
sql/opt_range.cc:
Fix for BUG#10037
* Add 0.01 to cost of 'range'+'using index' scan to avoid optimizer choice races with
'index' scan.
* make QUICK_GROUP_MIN_MAX_SELECT handle the case where the source table is empty.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 1cbbaf7c3c4..ac25f15d460 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2257,7 +2257,8 @@ inline double get_index_only_read_time(const PARAM* param, ha_rows records, param->table->file->ref_length) + 1); read_time=((double) (records+keys_per_block-1)/ (double) keys_per_block); - return read_time; + /* Add 0.01 to avoid cost races between 'range' and 'index' */ + return read_time + 0.01; } @@ -7912,6 +7913,8 @@ int QUICK_GROUP_MIN_MAX_SELECT::reset(void) file->extra(HA_EXTRA_KEYREAD); /* We need only the key attributes */ result= file->ha_index_init(index); result= file->index_last(record); + if (result == HA_ERR_END_OF_FILE) + DBUG_RETURN(0); if (result) DBUG_RETURN(result); if (quick_prefix_select && quick_prefix_select->reset()) |