mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +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:
@@ -6724,6 +6724,7 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
|
||||
{
|
||||
/* create (part1val, ..., part{n-1}val) tuple. */
|
||||
ha_rows records;
|
||||
page_range pages;
|
||||
if (!tuple_arg)
|
||||
{
|
||||
tuple_arg= scan->sel_arg;
|
||||
@@ -6741,7 +6742,7 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
|
||||
min_range.length= max_range.length= (uint) (key_ptr - key_val);
|
||||
min_range.keypart_map= max_range.keypart_map= keypart_map;
|
||||
records= (info->param->table->file->
|
||||
records_in_range(scan->keynr, &min_range, &max_range));
|
||||
records_in_range(scan->keynr, &min_range, &max_range, &pages));
|
||||
if (cur_covered)
|
||||
{
|
||||
/* uncovered -> covered */
|
||||
|
Reference in New Issue
Block a user