mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Added page_range to records_in_range() to improve range statistics
Prototype change: - virtual ha_rows records_in_range(uint inx, key_range *min_key, - key_range *max_key) + virtual ha_rows records_in_range(uint inx, const key_range *min_key, + const key_range *max_key, + page_range *res) The handler can ignore the page_range parameter. In the case the handler updates the parameter, the optimizer can deduce the following: - If previous range's last key is on the same block as next range's first key - If the current key range is in one block - We can also assume that the first and last block read are cached! This can be used for a better calculation of IO seeks when we estimate the cost of a range index scan. The parameter is fully implemented for MyISAM, Aria and InnoDB. A separate patch will update handler::multi_range_read_info_const() to take the benefits of this change and also remove the double records_in_range() calls that are not anymore needed.
This commit is contained in:
@ -839,6 +839,10 @@ int ha_example::delete_table(const char *name)
|
||||
@brief
|
||||
Given a starting key and an ending key, estimate the number of rows that
|
||||
will exist between the two keys.
|
||||
The handler can also optionally update the 'pages' parameter with the page
|
||||
number that contains the min and max keys. This will help the optimizer
|
||||
to know if two ranges are partly on the same pages and if the min and
|
||||
max key are on the same page.
|
||||
|
||||
@details
|
||||
end_key may be empty, in which case determine if start_key matches any rows.
|
||||
@ -848,8 +852,10 @@ int ha_example::delete_table(const char *name)
|
||||
@see
|
||||
check_quick_keys() in opt_range.cc
|
||||
*/
|
||||
ha_rows ha_example::records_in_range(uint inx, key_range *min_key,
|
||||
key_range *max_key)
|
||||
ha_rows ha_example::records_in_range(uint inx,
|
||||
const key_range *min_key,
|
||||
const key_range *max_key,
|
||||
page_range *pages)
|
||||
{
|
||||
DBUG_ENTER("ha_example::records_in_range");
|
||||
DBUG_RETURN(10); // low number to force index usage
|
||||
|
Reference in New Issue
Block a user