Skip to content

Automatically create minmax + uniq statistics for new columns#101275

Merged
rschu1ze merged 8 commits intoClickHouse:masterfrom
hanfei1991:hanfei/enable-auto-stats
Apr 13, 2026
Merged

Automatically create minmax + uniq statistics for new columns#101275
rschu1ze merged 8 commits intoClickHouse:masterfrom
hanfei1991:hanfei/enable-auto-stats

Conversation

@hanfei1991
Copy link
Copy Markdown
Member

@hanfei1991 hanfei1991 commented Mar 30, 2026

Changelog category (leave one):

  • New Feature

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

  • auto_statistics_types MergeTree setting defaults to "minmax, uniq" — minmax and uniq statistics are created automatically for all suitable columns in new tables
  • materialize_statistics_on_insert defaults to false — statistics are now built during merges rather than at INSERT time, reducing insert overhead. Use SET materialize_statistics_on_insert = 1 to restore the old
    behavior

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@hanfei1991 hanfei1991 marked this pull request as draft March 30, 2026 21:31
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Mar 30, 2026

Workflow [PR], commit [c8a1905]

Summary:

job_name test_name status info comment
Stress test (arm_release) failure
Server died FAIL cidb, issue ISSUE EXISTS
Segmentation fault (STID: 4009-3959) FAIL cidb IGNORED

AI Review

Summary

This PR changes defaults for statistics materialization: materialize_statistics_on_insert is now false (build stats during merges), and MergeTree auto_statistics_types now defaults to minmax, uniq. The code updates include corresponding compatibility history entries and broad test adjustments to keep existing expectations deterministic where needed. I did not find correctness, safety, compatibility, or performance blockers in the patch itself.

ClickHouse Rules
Item Status Notes
Deletion logging
Serialization versioning
Core-area scrutiny
No test removal
Experimental gate
No magic constants
Backward compatibility
SettingsChangesHistory.cpp
PR metadata quality
Safe rollout
Compilation time
No large/binary files
Final Verdict
  • Status: ✅ Approve

@rschu1ze rschu1ze mentioned this pull request Mar 31, 2026
72 tasks
@hanfei1991 hanfei1991 marked this pull request as ready for review April 1, 2026 12:32
Comment thread src/Core/SettingsChangesHistory.cpp
@rschu1ze
Copy link
Copy Markdown
Member

rschu1ze commented Apr 3, 2026

Tests in the private repository are destroyed :-/

@alexey-milovidov
Copy link
Copy Markdown
Member

The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix.

@rschu1ze rschu1ze changed the title automatically create minmax + uniq statistics for new columns Automatically create minmax + uniq statistics for new columns Apr 8, 2026
@rschu1ze rschu1ze changed the title Automatically create minmax + uniq statistics for new columns Automatically create minmax + uniq statistics for new columns Apr 8, 2026
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Apr 11, 2026

LLVM Coverage Report

Metric Baseline Current Δ
Lines 78.00% 84.00% +6.00%
Functions 90.40% 90.90% +0.50%
Branches 70.50% 76.50% +6.00%

Changed lines: 100.00% (40/40) · Uncovered code

Full report · Diff report

@rschu1ze rschu1ze self-assigned this Apr 13, 2026
@rschu1ze
Copy link
Copy Markdown
Member

Public CI:

Private CI:

  • Somehow stuck in last commit but runs for previous runs were okay.

@rschu1ze rschu1ze added this pull request to the merge queue Apr 13, 2026
Merged via the queue into ClickHouse:master with commit c3860be Apr 13, 2026
162 of 164 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

5 participants