Repository navigation
Use posting list cursors in the trivial count from the text index - #123294
Conversation
…dexCount` The trivial count from the text index materialized the posting lists of the multi-block tokens into Roaring bitmaps, even for compressed (`bitpacking`, `pfor`) postings. In lazy apply mode it now applies the cursors of `MergeTreeIndexTextPostingListCursor` (union or leapfrog / brute-force intersection) window by window to a reusable byte filter over the row range that can contain matches, and counts the set bytes. `lazyUnionPostingLists` and `lazyIntersectPostingLists` now return whether any byte of the filter may be set, so windows without matches skip `countBytesInFilter`. `ReadFromTextIndexCount` also reports the rows of the answered parts as read rows and sets the approximate total rows for progress. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The multi-token counts over `pfor` postings go through the posting-list cursors. Disable `use_text_index_postings_cache` so that every run reads the postings. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Workflow [PR], commit [72520c0] Summary: ❌
AI ReviewSummaryThis PR moves PR Metadata
Findings
Tests
Final Verdict
LLVM Coverage ReportMeasured on commit 72520c0.
Changed lines: Changed C/C++ lines covered: 204/209 (97.61%) · Uncovered code |
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=6 K_base=30 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes6 object files changed (+20.87 KiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units9 translation units recompiled, 38 s compile time in total, 9 of them have a recent master baseline. |
Parts in the test have ~1M rows, so with the default `text_index_posting_list_block_size` every posting list of the `pfor` table fits in a single block and is counted by the bitmap path in both binaries. Lower the block size so the posting-list cursors are exercised. Related: ClickHouse#123294 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
It is moved to a separate branch `text-index-count-read-rows-progress`. Related: ClickHouse#123294 (comment) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`false` guarantees that no row of the window is set, `true` may be a false positive, e.g. in `intersectBruteForce` when no row survives the final pass. Related: ClickHouse#123294 (comment) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`QueryBuilder::addRowsRange` already folds the token row ranges by search mode (hull for `Any`, overlap for `All`) and fails the query on an empty overlap, so the manually computed cursor range is redundant. The check for an empty `All` posting list is also covered by `is_failed`, because `QueryBuilder::addPostings` fails the query as soon as the intersection becomes empty. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # src/Processors/QueryPlan/ReadFromTextIndexCount.cpp
2493c46
…e-lazy-cursors-once Conflicts in `MergeTreeIndexTextPostingListCursor` with ClickHouse#123294: keep the raw-pointer cursors with `LazyPostingsStats` and make the lazy union and intersection return whether any row of the window may be set. `ReadFromTextIndexCount` now sorts its cursors and chooses the intersection algorithm once per part, as `MergeTreeReaderTextIndex` does. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Report `RangesInDataPart::getRowsCount` instead of the rows of the whole part, the same as `ReadFromMergeTree`: the text index may prune granules inside a part at plan time, and then `read_rows` and the `READ_ROWS` quota must count only the rows of the selected granules. Addresses the review comment from ClickHouse#123294 (comment) Renumber the test to 05371 because 05319 is taken on master, and pin the index granularity, since the reported rows now depend on it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`TextIndexCountSource` emits one row per part, so auto progress counted one read row per part. Report the rows of the answered part instead and set the total rows approximation. Extracted from ClickHouse#123294 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

Related: #122555
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Optimized
SELECT count()queries answered from a text index with a compressed posting list codec (bitpacking,pfor).Workflow [PR]
Sync PR [sync-upstream/pr/123294]
Version info
26.10.1.1497-master(included in26.10and later)