Skip to content

Estimate hypothetical projections with WHERE in EXPLAIN WHATIF - #125792

Merged
yariks5s merged 7 commits into
masterfrom
yarik/whatif-projection-where
Oct 21, 2026
Merged

yariks5s merged 7 commits into
masterfrom
yarik/whatif-projection-where

Conversation

@yariks5s

@yariks5s yariks5s commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Improvement

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

EXPLAIN WHATIF now estimates hypothetical projections with a WHERE clause.


Stack created with GitHub Stacks CLI • Give Feedback 💬


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

Version info

  • Merged into: 26.11.1.425-master (included in 26.11 and later)

@yariks5s
yariks5s added this pull request to stack #125793 October 14, 2026 12:59
@clickhouse-gh

clickhouse-gh Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [22ecc1b]

Summary: ✅


AI Review

Summary

This PR extends EXPLAIN WHATIF to estimate hypothetical projections with a WHERE clause, accounting for filtered samples, lightweight deletes, and mixed projection/base-table reads. The current code addresses all five earlier findings. No new actionable issues were found.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-improvement Pull request with some product improvements comp-projections Projections: precomputed layouts for accelerating queries (projection parts, maintenance). labels Oct 14, 2026
@nihalzp nihalzp self-assigned this Oct 14, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 22ecc1b11 with master 6cf960b3c (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

12 translation units recompiled, 60 s compile time in total, 10 of them have a recent master baseline.

Median compile-time ratio to the baselines is ×1.08 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio.
The matched translation units cost +3.5 s (+7%) in total before that adjustment.

Job report

@yariks5s
yariks5s marked this pull request as draft October 15, 2026 15:56
@yariks5s
yariks5s marked this pull request as ready for review October 15, 2026 20:50

@nihalzp nihalzp 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!

Base automatically changed from yarik/whatif-projection-key-granularity to master October 16, 2026 15:50
@yariks5s
yariks5s force-pushed the yarik/whatif-projection-where branch from 80afff0 to 2540f6d Compare October 16, 2026 15:50
@yariks5s
yariks5s added this pull request to the merge queue Oct 21, 2026
Merged via the queue into master with commit 9be882a Oct 21, 2026
180 checks passed
@yariks5s
yariks5s deleted the yarik/whatif-projection-where branch October 21, 2026 14:33
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 21, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Oct 22, 2026
…ild-normal-projection-stale

The only conflict was in WhatIfProjectionEstimator.cpp with ClickHouse#125792, which reads
the delete mask itself and drops the deleted rows through ProjectionDescription::calculate.
Take its version and keep only the check that reads `_row_exists` once when the
projection stores it: reading it twice aborts the scan (05402, last case).

Drop the sampled-scan decline of 05241: ClickHouse#125792 estimates sampled parts with deleted
rows per granule. In 05402 a part with every row deleted is now not_applicable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-what-if What-if analysis: hypothetical indexes and projections that exist only in the catalog, and the es... and removed comp-projections Projections: precomputed layouts for accelerating queries (projection parts, maintenance). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-what-if What-if analysis: hypothetical indexes and projections that exist only in the catalog, and the es... pr-improvement Pull request with some product improvements 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