Skip to content

Enable enable_join_runtime_filters_index_analysis - #121859

Merged
rschu1ze merged 1 commit into
masterfrom
enable-enable_join_runtime_filters_index_analysis
Sep 24, 2026
Merged

rschu1ze merged 1 commit into
masterfrom
enable-enable_join_runtime_filters_index_analysis

Conversation

@rschu1ze

@rschu1ze rschu1ze commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #109085

Changelog category (leave one):

  • Improvement

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

Enables setting enable_join_runtime_filters_index_analysis by default which enables pruning granules during the probe phase of joins.


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

Version info

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

@clickhouse-gh

clickhouse-gh Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [76e75a2]

Summary: ✅


AI Review

Summary

This PR flips enable_join_runtime_filters_index_analysis to true by default and records the compatibility transition in 26.10. I found one major issue: the new default also enables build-side key-range collection in cases where the probe side cannot use index-analysis pruning at all, so the setting is no longer a no-op in its documented "no effect" modes and adds avoidable work to every qualifying runtime-filtered hash join.

Findings

⚠️ Majors

  • [src/Core/Settings.cpp:9468] Making enable_join_runtime_filters_index_analysis default-on also turns on RuntimeFilterBuildOptions.track_key_range for every positive runtime filter. The build side then runs RuntimeFilterIndexAnalysis::insert() / getExtremes() on each block even when the probe side cannot consume that range: for example when use_skip_indexes_on_data_read = 0, when the probe side is not a MergeTree read, or when the join key has no primary-key / eligible skip-index coverage. That violates the setting's documented "only has an effect if use_skip_indexes_on_data_read = 1" contract and broadens the cost to joins that can never benefit.
    Suggested fix: enable range tracking only when the probe-side read actually registers a runtime-filter index-analysis descriptor, or at minimum gate it on use_skip_indexes_on_data_read.
Final Verdict

Changes needed before merge: the default flip currently adds build-side work in unsupported / no-op cases instead of restricting the extra cost to joins that can actually prune on the probe side.

LLVM Coverage Report

Measured on commit 76e75a2.

Metric Baseline Current Δ
Lines 88.10% 88.10% +0.00%
Functions 91.70% 91.70% +0.00%
Branches 79.40% 79.40% +0.00%

Changed lines: Changed C/C++ lines covered: 16/16 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Sep 23, 2026
Comment thread src/Core/Settings.cpp
Run a second pass index analysis (via use_skip_indexes_on_data_read) to prune granules on LHS of a join.
DECLARE(Bool, enable_join_runtime_filters_index_analysis, true, R"(
Prune granules on the probe side of a JOIN with the runtime filter collected from the build side, see `enable_join_runtime_filters`.
Only has an effect if `use_skip_indexes_on_data_read = 1`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This default flip also turns on build-side key-range tracking for every positive runtime filter, not just for reads that can actually prune granules. joinRuntimeFilter.cpp passes enable_join_runtime_filters_index_analysis straight into RuntimeFilterBuildOptions.track_key_range, so BuildRuntimeFilterTransform will call RuntimeFilter::enableIndexAnalysis() and every build block on integer/date keys pays an extra getExtremes() pass even when the probe side cannot use it: for example when use_skip_indexes_on_data_read = 0, when the probe side is not a MergeTree read, or when the join key has no PK / eligible skip index. That makes the setting stop being a no-op in the documented "no effect" cases and adds per-block work to all hash joins with runtime filters. Please gate range tracking on the probe side actually registering an index-analysis descriptor (or at least on use_skip_indexes_on_data_read) before making this default-on.

@clickhouse-gh clickhouse-gh Bot added the comp-joins JOINs end-to-end (planning hooks + runtime join operators/algorithms). Single bucket to avoid pla... label Sep 23, 2026
@rschu1ze
rschu1ze added this pull request to the merge queue Sep 24, 2026
Merged via the queue into master with commit 9e91233 Sep 24, 2026
176 checks passed
@rschu1ze
rschu1ze deleted the enable-enable_join_runtime_filters_index_analysis branch September 24, 2026 09:49
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 24, 2026
zoomxi pushed a commit to zoomxi/ClickHouse that referenced this pull request Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-joins JOINs end-to-end (planning hooks + runtime join operators/algorithms). Single bucket to avoid pla... 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.

2 participants