Repository navigation
Do not perform PrimaryKeyExpand step if skip index is already part of primary key - #88368
Merged
shankar-iyer merged 8 commits intoOct 30, 2025
Conversation
shankar-iyer
marked this pull request as draft
October 11, 2025 06:53
Contributor
|
Workflow [PR], commit [061180f] Summary: ❌
|
shankar-iyer
marked this pull request as ready for review
October 12, 2025 15:55
Member
Author
|
@rschu1ze Please review! |
…_index_final_exact_mode
rschu1ze
approved these changes
Oct 29, 2025
Member
Author
|
CI run is clean at |
Member
Author
|
Only failure in |
shankar-iyer
enabled auto-merge
October 30, 2025 13:55
This was referenced Oct 30, 2025
robot-clickhouse
added a commit
that referenced
this pull request
Oct 30, 2025
… index is already part of primary key
robot-clickhouse
added a commit
that referenced
this pull request
Oct 30, 2025
…p index is already part of primary key
rschu1ze
added a commit
that referenced
this pull request
Oct 31, 2025
Backport #88368 to 25.10: Do not perform PrimaryKeyExpand step if skip index is already part of primary key
rschu1ze
added a commit
that referenced
this pull request
Oct 31, 2025
Backport #88368 to 25.9: Do not perform PrimaryKeyExpand step if skip index is already part of primary key
This was referenced Nov 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
If a skip index used in a FINAL query is on a column that is part of the primary key, the additional step to check for primary key intersection in other parts is unnecessary and now not performed. Resolves #85897
Details
Assume following ReplacingMergeTree table with ORDER BY (id1, id2) and two skip indexes: id2_idx on id2 (which is part of the primary key) and v_idx on v (which is not).
With rows (1,1,'blue') and (1,1,'red') in different parts, the second row is a modification of the first. Using skip index v_idx in a FINAL query requires the PrimaryKeyExpand step (use_skip_indexes_if_final_exact_mode=True).
With rows (1,1,'blue') and (1,2,'blue') in different parts, the second row is a different row. Skip index id2_idx can be safely used without needing the primary key intersection step for FINAL.