You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[improvement](scan) Align scanner split to segments for MATCH
`SegmentIterator::_lazy_init` runs the inverted index query over the whole
segment first and only then intersects the result with `_opts.row_ranges`.
The cost of a MATCH predicate is therefore priced per segment, while
`ParallelScannerBuilder` splits by rows. When a segment ends up shared by two
scanners, its posting lists are walked once per scanner.
Add `_build_scanners_by_match_expr`, which collects whole segments and closes
a split once `_rows_per_scanner` is reached, so split boundaries only fall
between segments. A segment larger than the threshold takes a scanner of its
own. `segment_row_ranges` is left empty so the downstream reader scans whole
segments instead of intersecting a range covering the entire segment.
The path is taken only for DUP/MOW tables in cloud mode when the expressions
pushed down to the storage layer contain MATCH; `_build_scanners_by_rowid` and
`_build_scanners_by_per_segment` are unchanged, and a query without MATCH
behaves exactly as before. The `tablet_hotspot().count()` call shared by all
three strategies is hoisted into `build_scanners()`.
Measured on a cloud cluster, 20M rows in one tablet over 8 segments, cold
query (file cache cleared and BE restarted between runs), 3 runs each:
before after
NumScanners 10 5
InvertedIndexQueryTime 5299ms 2576ms -51%
ScannerCpuTime 5408ms 2796ms -48%
InvertedIndexSearcherOpenTime 144ms 58ms -60%
ScannerGetBlockTime 1529ms 1761ms +15%
Total 931ms 821ms
This trades scan parallelism for total CPU: the number of scanners drops, so
`ScannerGetBlockTime` grows, while the index query work roughly halves.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VgV4Zy5NaEYpUP4Yrh1yWn
0 commit comments