Skip to content

Enable Implicit Skip Indices for Projections - #105137

Merged
Michicosun merged 9 commits into
masterfrom
projection_implicit_skip_indices
May 18, 2026
Merged

Michicosun merged 9 commits into
masterfrom
projection_implicit_skip_indices

Conversation

@Michicosun

@Michicosun Michicosun commented May 16, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

This patch enables implicit min-max indices for projections.

Version info

  • Merged into: 26.5.1.766

@clickhouse-gh

clickhouse-gh Bot commented May 16, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [fae0934]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_asan_ubsan, db disk, distributed plan, sequential) FAIL
03008_deduplication_mv_generates_several_blocks_replicated ERROR cidb
Server died FAIL cidb, issue
Segmentation fault (STID: 1367-3678) FAIL cidb

AI Review

Summary

This PR wires implicit projection skip-index materialization through MergeTreeDataWriter, adds projection-level parsing for implicit minmax index settings, and ensures settings are loaded before projection-index metadata is built. I re-checked all existing inline threads against the current fae09343ef810b84dd524417d7c39bcfcdc5e7bd head and reviewed the full diff in touched storage/projection paths; the previously reported issues are addressed in the current code and I did not identify new live correctness or safety regressions.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label May 16, 2026
Comment thread src/Storages/ProjectionsDescription.cpp Resolved
Comment thread src/Storages/ProjectionsDescription.cpp Resolved
Comment thread src/Storages/ProjectionsDescription.cpp Resolved
Comment thread src/Storages/ProjectionsDescription.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.10% 84.20% +0.10%
Functions 91.40% 91.40% +0.00%
Branches 76.50% 76.60% +0.10%

Changed lines: 92.37% (109/118) | lost baseline coverage: 2 line(s) · Uncovered code

Full report · Diff report

@Michicosun
Michicosun added this pull request to the merge queue May 18, 2026
Merged via the queue into master with commit 0329624 May 18, 2026
165 of 167 checks passed
@Michicosun
Michicosun deleted the projection_implicit_skip_indices branch May 18, 2026 19:15
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label May 18, 2026
amosbird added a commit to amosbird/ClickHouse that referenced this pull request May 19, 2026
…ax indices

Address PR ClickHouse#101170 review feedback (CI #2):

- Drop the 5 add_minmax_index_for_* members from ProjectionDescription. They
  were stale ad-hoc fields duplicating MergeTreeSettings; with the new generic
  SettingsChanges flow the effective MergeTreeSettings is already the canonical
  representation.
- Thread the already-computed effective MergeTreeSettings (defaults from the
  projection index plus user WITH SETTINGS overrides) into fillProjectionDescription
  and fillProjectionDescriptionByQuery as a new parameter, instead of
  reconstructing it. fillProjectionDescriptionByQuery reads the implicit-minmax
  flags via strongly-typed MergeTreeSetting accessors.
- Add the 5 add_minmax_index_for_* names to ALLOWED_PROJECTION_SETTINGS so the
  feature added in ClickHouse#105137 (Enable Implicit Skip Indices for Projections) keeps
  working under the new settings flow.

The ATTACH validation gap raised by review item #3 is intentionally left as
`mode <= LoadingStrictnessLevel::CREATE` to match the project-wide convention
(InterpreterCreateQuery, registerStorageMergeTree, etc. all validate user input
on CREATE/SECONDARY_CREATE only). The previous loadSettings validated
unconditionally because it had no access to mode; now that we do, aligning with
the rest of the codebase is the consistent choice.
alexey-milovidov added a commit that referenced this pull request May 20, 2026
… `add_minmax_index_for_numeric_columns`

The test from #105137 (added in `8117c54fb8f`) verifies that the
`add_minmax_index_for_numeric_columns` setting can be applied per
projection via `PROJECTION ... WITH SETTINGS (...)`. Its reference was
generated assuming the setting defaults to `0`, so the main table has
no auto minmax index and 3 of 3 partitions are read.

This PR flips the default to `1`, which adds an implicit minmax index
on the main table too. That index now prunes 2 of the 3 partitions
before the projection is consulted, shrinking the reported `Parts:`
and `Granules:` counts.

Explicitly setting `add_minmax_index_for_numeric_columns = 0` on the
main table preserves the test's original intent (exercising the
projection-level `WITH SETTINGS` override) and makes it robust to
future default changes.
DavidHe-2008 pushed a commit to DavidHe-2008/ClickHouse that referenced this pull request Jun 1, 2026
…ax indices

Address PR ClickHouse#101170 review feedback (CI ClickHouse#2):

- Drop the 5 add_minmax_index_for_* members from ProjectionDescription. They
  were stale ad-hoc fields duplicating MergeTreeSettings; with the new generic
  SettingsChanges flow the effective MergeTreeSettings is already the canonical
  representation.
- Thread the already-computed effective MergeTreeSettings (defaults from the
  projection index plus user WITH SETTINGS overrides) into fillProjectionDescription
  and fillProjectionDescriptionByQuery as a new parameter, instead of
  reconstructing it. fillProjectionDescriptionByQuery reads the implicit-minmax
  flags via strongly-typed MergeTreeSetting accessors.
- Add the 5 add_minmax_index_for_* names to ALLOWED_PROJECTION_SETTINGS so the
  feature added in ClickHouse#105137 (Enable Implicit Skip Indices for Projections) keeps
  working under the new settings flow.

The ATTACH validation gap raised by review item ClickHouse#3 is intentionally left as
`mode <= LoadingStrictnessLevel::CREATE` to match the project-wide convention
(InterpreterCreateQuery, registerStorageMergeTree, etc. all validate user input
on CREATE/SECONDARY_CREATE only). The previous loadSettings validated
unconditionally because it had no access to mode; now that we do, aligning with
the rest of the codebase is the consistent choice.
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
… `add_minmax_index_for_numeric_columns`

The test from ClickHouse#105137 (added in `8117c54fb8f`) verifies that the
`add_minmax_index_for_numeric_columns` setting can be applied per
projection via `PROJECTION ... WITH SETTINGS (...)`. Its reference was
generated assuming the setting defaults to `0`, so the main table has
no auto minmax index and 3 of 3 partitions are read.

This PR flips the default to `1`, which adds an implicit minmax index
on the main table too. That index now prunes 2 of the 3 partitions
before the projection is consulted, shrinking the reported `Parts:`
and `Granules:` counts.

Explicitly setting `add_minmax_index_for_numeric_columns = 0` on the
main table preserves the test's original intent (exercising the
projection-level `WITH SETTINGS` override) and makes it robust to
future default changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog 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