From eb69c7809244bf701675afb05b0818701773a25f Mon Sep 17 00:00:00 2001 From: liunyl Date: Fri, 5 Dec 2025 10:29:56 +0000 Subject: [PATCH 1/2] optimize big size scan reqs --- data_substrate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_substrate b/data_substrate index 3e3d1821bb8..d2a3c097656 160000 --- a/data_substrate +++ b/data_substrate @@ -1 +1 @@ -Subproject commit 3e3d1821bb8323c1962e65f4f7b5e55044e19796 +Subproject commit d2a3c09765666f25384b744849264ea860146c3c From b6ac5cae05e7a8972391abdde80de717e01e7132 Mon Sep 17 00:00:00 2001 From: liunyl Date: Mon, 8 Dec 2025 05:51:42 +0000 Subject: [PATCH 2/2] prefetch more aggresively when end key is specified --- data_substrate | 2 +- storage/eloq/ha_eloq.cc | 4 +++- storage/eloq/ha_eloq.h | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/data_substrate b/data_substrate index d2a3c097656..f694e422f1f 160000 --- a/data_substrate +++ b/data_substrate @@ -1 +1 @@ -Subproject commit d2a3c09765666f25384b744849264ea860146c3c +Subproject commit f694e422f1fe433c27ce92716e20e6b0dd5da74b diff --git a/storage/eloq/ha_eloq.cc b/storage/eloq/ha_eloq.cc index 537a5dc722f..ee00fafe00f 100644 --- a/storage/eloq/ha_eloq.cc +++ b/storage/eloq/ha_eloq.cc @@ -4152,6 +4152,7 @@ int ha_eloq::PkIndexScanOpen(const txservice::TxKey *start_key, bool require_recs= decode_flag_ > 0; bool require_sort= eloq_random_scan_sort || (active_index != MAX_INDEXES && decode_flag_ > 0); + end_specified_= end_key != nullptr; auto [yield_func, resume_func]= my_tx->CoroFunctors(); @@ -4211,6 +4212,7 @@ int ha_eloq::SkIndexScanOpen(const txservice::TxKey *start_index_key, bool is_require_keys= has_hidden_pk(table) || decode_flag_ > 0; bool is_require_recs= is_require_keys; bool is_require_sort= is_require_keys; + end_specified_= end_index_key != nullptr; auto [yield_func, resume_func]= my_tx->CoroFunctors(); @@ -5212,7 +5214,7 @@ int ha_eloq::IndexScanClose() ccm_scan_key_= nullptr; ccm_scan_rec_= nullptr; ccm_scan_rec_status_= txservice::RecordStatus::Unknown; - + end_specified_= false; scan_batch_idx_= UINT64_MAX; if (scan_batch_.size() > DEFAULT_SCAN_TUPLE_SIZE) { diff --git a/storage/eloq/ha_eloq.h b/storage/eloq/ha_eloq.h index 1f8932f1fd8..0e7b38c761c 100644 --- a/storage/eloq/ha_eloq.h +++ b/storage/eloq/ha_eloq.h @@ -717,6 +717,12 @@ class ha_eloq : public handler uint32_t PrefetchSize() { + if (end_specified_) + { + // Prefetch more agressively if end key is specified as the scan + // will not prefetch beyond the end key. + return 256; + } std::array boundaries= {1, 4, 16, 64, 256}; size_t idx= 0; @@ -774,6 +780,7 @@ class ha_eloq : public handler txservice::TxKey search_tx_key_{&search_key_}; EloqKey scan_end_key_; txservice::TxKey scan_end_tx_key_{&scan_end_key_}; + bool end_specified_{false}; uint64_t scan_alias_{UINT64_MAX}; // index currently used if scan is active