Repository navigation
Text index: improve positions layout for phrase search - #125630
Conversation
This commit contains the layout change that stores positions frequencies as a PFor run.
05f6bdd to
10f9489
Compare
|
Workflow [PR], commit [befe2d7] Summary: ✅
AI ReviewSummaryThis PR compresses text-index document frequencies with Findings❌ Blockers
Tests
Missing context / blind spots
Final Verdict❌ Block. Distinguish the incompatible formats, handle existing parts safely, and add the cross-format regression. No new inline comments or thread replies were posted because this issue already has a thread dismissed by the author. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes17 object files changed (+49.50 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 units34 translation units recompiled, 319 s compile time in total, 34 of them have a recent master baseline. |
CurtizJ
left a comment
There was a problem hiding this comment.
Looks good. I've left one suggestion.
…itions Since ClickHouse#125630 `TextIndexBlockedPositionsCodec::Encoder::finishDocument` appended `freq - 1` of every document to a dense per-token array, which `encodeBlock` threw away whenever every document of the block had one position. Each token owns an encoder, so with many distinct tokens this is one heap allocation per token and one store per token occurrence into a buffer far from the previous one (a cache miss for most occurrences). Record `(local rank, freq - 1)` only for documents with more than one position, as the encoder did before ClickHouse#125630, and expand them into a 128-entry stack array in `encodeBlock` only for blocks that have any. The values passed to PFor, and so the written bytes, are unchanged. Analysis and patch by snelheidai in ClickHouse#133439. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This PR contains two main changes for the
positionslayout:freq - 1, prefixed by its size, instead of a list of (local rank, frequency) exceptions. The run is omitted when every document in the block has one position..pos. A phrase with a rare token then skips one.posread per part.The size of the positions is reduced between ~15-35% depending on
text_log(10M rows) andhackernewsdatasets. Also, positions decode time forhasPhraseis 10–30% lower on both datasets.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Reduce the size of the positions index size up to ~30% and make phrase search decodes faster ~10-30%. One major perf improvement is decoding positions of rare tokens is significantly faster.
Workflow [PR]
Sync PR [sync-upstream/pr/125630]
Version info
26.11.1.1275-master(included in26.11and later)