From f36ca142f7fa59598e34e842b60372b963067766 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 27 Feb 2020 19:12:27 +0200 Subject: 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. --- storage/federated/ha_federated.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'storage/federated/ha_federated.cc') diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index b87c5c39c37..00168791d35 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -1603,8 +1603,10 @@ static int free_share(FEDERATED_SHARE *share) } -ha_rows ha_federated::records_in_range(uint inx, key_range *start_key, - key_range *end_key) +ha_rows ha_federated::records_in_range(uint inx, + const key_range *start_key, + const key_range *end_key, + page_range *pages) { /* -- cgit v1.2.1