Skip to content

Add SstFileReader::MayMatch - #38

Merged
murphy-4o merged 2 commits into
ClickHouse/v11.8.1from
unique-key-maymatch-v11.8.1
Dec 5, 2026
Merged

murphy-4o merged 2 commits into
ClickHouse/v11.8.1from
unique-key-maymatch-v11.8.1

Conversation

@murphy-4o

Copy link
Copy Markdown
Member

SstFileReader::MultiGet pays a per-key setup (lookup key, get context, sort) before its bloom filter check. ClickHouse's UNIQUE KEY probes check every inserted key against every part's SST, and most keys are absent, so that setup dominates large inserts.

SstFileReader::MayMatch checks a batch of keys against the table's full whole-key filter and returns one bool per key, without file reads. false means the key is absent. true means it may be present, or the table cannot answer from memory: no filter, a prefix-only or partitioned filter, or a filter not in the block cache. Other table formats answer true through the TableReader default.

Replaces #30, which was based on the old master.

🤖 Generated with Claude Code

murphy-4o and others added 2 commits December 5, 2026 16:46
For each key, false means definitely absent; true means it may be present
or the filter cannot answer from memory. A full whole-key filter is probed
with the user key alone, without building an internal key per key;
partitioned filters and missing filters answer true.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SstFileReader::MayMatch takes bare user keys, like MultiGet, and the filter
holds user keys without timestamp, so a UDT table got false negatives.
Probe keys as given. Fallback calls TableReader::MayMatch; drop the
whole_key_filtering guard (FullFilterBlockReader::KeyMayMatch answers true)
and the 3-arg overload. Document no file reads and the block / secondary
cache lookup. Test the UDT case, the no-filter, prefix-only and
partitioned fallbacks, and an empty batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@murphy-4o murphy-4o self-assigned this Dec 5, 2026
@murphy-4o
murphy-4o merged commit ec09a01 into ClickHouse/v11.8.1 Dec 5, 2026
58 checks passed
murphy-4o added a commit to murphy-4o/ClickHouse that referenced this pull request Dec 5, 2026
ClickHouse/rocksdb#38 was squash-merged as ec09a01cc6d; its tree is identical to the PR head 4d2037c77 this branch pointed at.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant