Skip to content

Text index: introduce new pfor postings codec - #118123

Merged
CurtizJ merged 17 commits into
masterfrom
ahmadov/postings-pfordelta
Sep 19, 2026
Merged

CurtizJ merged 17 commits into
masterfrom
ahmadov/postings-pfordelta

Conversation

@ahmadov

@ahmadov ahmadov commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

The new codec pfor uses the same compression used by the text index positions to compress unsigned integers.

Compare to other posting codecs, it is superior in terms of compression ratio and speed (encode/decode). Performance benchmark will follow up in a separate PR.

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Added the pfor codec for posting lists of the text index. It improves the compression ratio of posting lists and speeds up their decoding. It can be enabled per index with the posting_list_codec = 'pfor' index argument, or for all text indexes of a table with the text_index_posting_list_codec table setting.


Workflow [PR]
Sync PR [sync-upstream/pr/118123]

Version info

  • Merged into: 26.10.1.221-master (included in 26.10 and later)

The new codec `PforDelta` uses the same compressiong used by the
text index positions to compress unsigned integers.

Compare to other pfor based compressions, it is superior in terms of
compression ratio and speed (encode/decode).
@mintlify

mintlify Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
ClickHouse-docs 🟢 Ready View Preview Sep 18, 2026, 7:38 PM

@clickhouse-gh

clickhouse-gh Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0243d20]

Summary: ❌

job_name test_name status info comment
Build profile diff ERROR

AI Review

Summary

This PR adds the new pfor posting-list codec for text indexes, generalizes the segmented posting-list reader to dispatch the per-segment block codec, and adds coverage plus upgrade notes for the new format. The codec plumbing itself looks coherent, but the patch still leaves the claimed encode/decode speedup unproven, and the user-facing docs/metadata are not yet fully aligned with the new downgrade caveat and rename to pfor.

PR Metadata
  • Changelog category: New Feature is correct for this change.
  • Changelog entry: required. The current entry is stale after the rename (PforDelta vs pfor) and still claims a performance improvement that this PR does not measure. Suggested replacement: Add the \pfor` postings codec for text indexes.`
  • The free-form PR description above the template should also be renamed from PforDelta to pfor, and the speed claim should either be backed by numbers there or removed.
Findings

⚠️ Majors

  • [src/Storages/MergeTree/PostingListBlockCodec.cpp:96-137] The new persisted codec is justified in the PR text as better for both compression ratio and encode/decode speed, but the patch still only proves the size side (05060_text_index_posting_list_codec_size.sql). There is no focused throughput benchmark or perf report against bitpacking, so the main motivation for carrying another on-disk codec is only half-proven. Either add before/after encode+decode measurements or drop the speed claim from the PR text and changelog.

💡 Nits

  • [src/Storages/MergeTree/MergeTreeSettings.cpp:721] The hand-written table-engine docs now explain that pfor is not governed by compatibility, but the autogenerated text_index_* settings docs and system.documentation still come from the source doc strings here, where the rolling-upgrade text still advertises a stronger guarantee. Mirror the same warning in the source-level docs for text_index_posting_list_codec / text_index_serialization_version.
Final Verdict

Changes requested. I would not approve until the unsupported speed claim is either measured or removed, and the source-level settings docs describe the same downgrade contract as the table-engine page.

LLVM Coverage Report

Measured on commit 0243d20.

Metric Baseline Current Δ
Lines 88.40% 88.40% +0.00%
Functions 91.80% 91.80% +0.00%
Branches 80.60% 80.60% +0.00%

Changed lines: Changed C/C++ lines covered: 66/74 (89.19%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-feature Pull request with new product feature label Sep 4, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-text-index Full-text search: inverted/text index in MergeTree (tokenizers, posting lists, GIN-style index bu... label Sep 4, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing commit 0243d205891f8c8ad838d488d805fe9b5c1e41da with master failed: RuntimeError: CI logs cluster query failed: SELECT file, library, argMax(dur, time) AS ….

See the job log for details.

@CurtizJ CurtizJ self-assigned this Sep 7, 2026

@CurtizJ CurtizJ left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I've left a few minor comments.

@CurtizJ CurtizJ changed the title Text index: introduce new pfordelta postings codec Text index: introduce new pfor postings codec Sep 19, 2026
@CurtizJ
CurtizJ added this pull request to the merge queue Sep 19, 2026
Merged via the queue into master with commit db93430 Sep 19, 2026
175 of 177 checks passed
@CurtizJ
CurtizJ deleted the ahmadov/postings-pfordelta branch September 19, 2026 20:57
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 19, 2026
CurtizJ added a commit to CurtizJ/ClickHouse that referenced this pull request Sep 19, 2026
Resolves conflicts with the `pfor` posting list codec from
ClickHouse#118123:

- `SegmentedPostingListCodecBase` keeps master's class hierarchy and takes over
  `getSegmentSize`, `createEncoder` and the `decode` overloads bounded by the
  token metadata; `createEncoder` uses the codec's own type, so `pfor` indexes
  are built with a PFor encoder
- `addDocumentsFromMap` from master takes the `PostingListBuildContext`
- the memory accounting of posting list encoders is removed together with the
  granule memory accounting removed in
  ClickHouse#119927

Co-Authored-By: Claude Fable 5.1 <[email protected]>

This branch was successfully deployed

1 active deployment
staging - docs — 0243d205 Deployed Sep 18, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-text-index Full-text search: inverted/text index in MergeTree (tokenizers, posting lists, GIN-style index bu... pr-feature Pull request with new product feature pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants