summaryrefslogtreecommitdiff
path: root/storage/rocksdb
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-02-27 19:12:27 +0200
committerMonty <monty@mariadb.org>2020-03-27 03:54:45 +0200
commitf36ca142f7fa59598e34e842b60372b963067766 (patch)
tree4b797dcf88e98fd9fe83e3a29bfaabc10b7219c2 /storage/rocksdb
parent9b061990801b5c8309149794145f9c361bb8cfc6 (diff)
downloadmariadb-git-f36ca142f7fa59598e34e842b60372b963067766.tar.gz
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.
Diffstat (limited to 'storage/rocksdb')
-rw-r--r--storage/rocksdb/ha_rocksdb.cc5
-rw-r--r--storage/rocksdb/ha_rocksdb.h6
2 files changed, 7 insertions, 4 deletions
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 3fa13295496..1b7ec9f9473 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -11910,8 +11910,9 @@ int ha_rocksdb::extra(enum ha_extra_function operation) {
Given a starting key and an ending key, estimate the number of rows that
will exist between the two keys.
*/
-ha_rows ha_rocksdb::records_in_range(uint inx, key_range *const min_key,
- key_range *const max_key) {
+ha_rows ha_rocksdb::records_in_range(uint inx, const key_range *const min_key,
+ const key_range *const max_key,
+ page_range *pages) {
DBUG_ENTER_FUNC();
ha_rows ret = THDVAR(ha_thd(), records_in_range);
diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h
index 426aa110597..1820326090f 100644
--- a/storage/rocksdb/ha_rocksdb.h
+++ b/storage/rocksdb/ha_rocksdb.h
@@ -902,8 +902,10 @@ public:
int check(THD *const thd, HA_CHECK_OPT *const check_opt) override
MY_ATTRIBUTE((__warn_unused_result__));
int remove_rows(Rdb_tbl_def *const tbl);
- ha_rows records_in_range(uint inx, key_range *const min_key,
- key_range *const max_key) override
+ ha_rows records_in_range(uint inx,
+ const key_range *const min_key,
+ const key_range *const max_key,
+ page_range *pages) override
MY_ATTRIBUTE((__warn_unused_result__));
int delete_table(Rdb_tbl_def *const tbl);