Skip to content

Backport #98776 to 26.2: Fix detecting set skip index usefulness with OR with false (i.e. or(x, 0)) predicate - #98838

Merged
clickhouse-gh[bot] merged 1 commit into
26.2from
backport/26.2/98776
Mar 5, 2026
Merged

clickhouse-gh[bot] merged 1 commit into
26.2from
backport/26.2/98776

Conversation

@robot-clickhouse-ci-2

@robot-clickhouse-ci-2 robot-clickhouse-ci-2 commented Mar 5, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #98776
Cherry-pick pull-request #98837

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job


Note

Medium Risk
Changes the set skip-index applicability logic for OR expressions, which can alter query planning and index usage (performance/behavior) in edge cases. Adds coverage to prevent regressions around analyzer-generated or(..., 0) predicates.

Overview
Fixes MergeTreeIndexConditionSet::checkDAGUseless so that constant false arguments inside or(...) are ignored when deciding whether a set skip index can be applied, avoiding incorrect “index is useful” detection for predicates like or(non_indexed_expr, 0).

Adds a stateless query test (04027_set_index_or_non_indexed_column) that asserts the set index is not used when only a non-indexed column is referenced (even with or(..., 0)), and is still used when the indexed column appears inside the same OR pattern.

Written by Cursor Bugbot for commit 508a9c8. This will update automatically on new commits. Configure here.

Version info

  • Merged into: 26.2.4.24

… OR with false (i.e. or(x, 0)) predicate
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default labels Mar 5, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [508a9c8]

Summary: ✅

@clickhouse-gh
clickhouse-gh Bot merged commit 5f955b0 into 26.2 Mar 5, 2026
33 of 34 checks passed
@clickhouse-gh
clickhouse-gh Bot deleted the backport/26.2/98776 branch March 5, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants