diff --git a/data_substrate b/data_substrate index 3e3d1821bb8..f694e422f1f 160000 --- a/data_substrate +++ b/data_substrate @@ -1 +1 @@ -Subproject commit 3e3d1821bb8323c1962e65f4f7b5e55044e19796 +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