diff options
author | Igor Babaev <igor@askmonty.org> | 2012-03-02 15:03:20 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-03-02 15:03:20 -0800 |
commit | 8bc5045ea377f39701f421cc7ae00756f79962d2 (patch) | |
tree | 751d8bbe4d3844ab9dc16d0c07855e40028cbabc /sql/handler.cc | |
parent | 8b469eb5151cb1b7da00cee3a7b42c10bd7ff51e (diff) | |
parent | 2521ac0c7f2450d588fa1704a6eef785da8812a9 (diff) | |
download | mariadb-git-8bc5045ea377f39701f421cc7ae00756f79962d2.tar.gz |
Merge MWL #247 from mariadb 5.3 -> mariadb 5.5.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 57049e87d31..0310180759c 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2191,11 +2191,12 @@ double handler::keyread_time(uint index, uint ranges, ha_rows rows) performs a random seek, thus the cost is proportional to the number of blocks read. This model does not take into account clustered indexes - engines that support that (e.g. InnoDB) may want to overwrite this method. + The model counts in the time to read index entries from cache. */ - double keys_per_block= (stats.block_size/2.0/ - (table->key_info[index].key_length + - ref_length) + 1); - return (rows + keys_per_block - 1)/ keys_per_block; + ulong len= table->key_info[index].key_length + ref_length; + double keys_per_block= (stats.block_size/2.0/len+1); + return (rows + keys_per_block-1)/ keys_per_block + + len*rows/(stats.block_size+1)/TIME_FOR_COMPARE ; } void **handler::ha_data(THD *thd) const |