This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 21ea0055fc [improvement](scanner) use batch size of session instead of 
limit to improve performance of reading (#22240)
21ea0055fc is described below

commit 21ea0055fc303896b39c8d57b755e7afeaec8817
Author: TengJianPing <[email protected]>
AuthorDate: Wed Jul 26 18:57:42 2023 +0800

    [improvement](scanner) use batch size of session instead of limit to 
improve performance of reading (#22240)
---
 be/src/vec/exec/scan/new_olap_scanner.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/be/src/vec/exec/scan/new_olap_scanner.cpp 
b/be/src/vec/exec/scan/new_olap_scanner.cpp
index decf12ee91..702d94c5f3 100644
--- a/be/src/vec/exec/scan/new_olap_scanner.cpp
+++ b/be/src/vec/exec/scan/new_olap_scanner.cpp
@@ -127,10 +127,11 @@ Status NewOlapScanner::init() {
 
     // set limit to reduce end of rowset and segment mem use
     _tablet_reader = std::make_unique<BlockReader>();
-    _tablet_reader->set_batch_size(
-            _parent->limit() == -1
-                    ? _state->batch_size()
-                    : std::min(static_cast<int64_t>(_state->batch_size()), 
_parent->limit()));
+    // batch size is passed down to segment iterator, use _state->batch_size()
+    // instead of _parent->limit(), because if _parent->limit() is a very small
+    // value (e.g. select a from t where a .. and b ... limit 1),
+    // it will be very slow when reading data in segment iterator
+    _tablet_reader->set_batch_size(_state->batch_size());
 
     // Get olap table
     TTabletId tablet_id = _scan_range.tablet_id;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to