Skip to content

Allow to enable statistics on all columns - #87241

Merged
CurtizJ merged 33 commits into
ClickHouse:masterfrom
CurtizJ:automatic-statistics
Oct 14, 2025
Merged

CurtizJ merged 33 commits into
ClickHouse:masterfrom
CurtizJ:automatic-statistics

Conversation

@CurtizJ

@CurtizJ CurtizJ commented Sep 17, 2025 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New Feature

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

Added an ability to automatically create statistics on all suitable columns in MergeTree tables. Added table-level setting auto_statistics_types which stores comma-separated types of statistics to create (e.g. auto_statistics_types = 'minmax, uniq, countmin').

@clickhouse-gh

clickhouse-gh Bot commented Sep 17, 2025 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c66230d]

Summary: ❌

job_name test_name status info comment
Integration tests (amd_binary, 2/5) failure
test_trace_log_memory_context/test.py::test_memory_context_in_trace_log FAIL cidb
Integration tests (arm_binary, distributed plan, 2/4) failure
test_async_load_databases/test.py::test_materialized_views_cascaded_multiple FAIL cidb
test_async_load_databases/test.py::test_materialized_views_replicated FAIL cidb
Performance Comparison (amd_release, master_head, 3/3) failure
Configure failure

@clickhouse-gh clickhouse-gh Bot added the pr-feature Pull request with new product feature label Sep 17, 2025
@hanfei1991 hanfei1991 self-assigned this Sep 18, 2025
@CurtizJ

CurtizJ commented Sep 24, 2025 •

Copy link
Copy Markdown
Member Author

Tests fail with:

2025.09.23 17:18:14.593878 [ 45131 ] {test_quota_key} <Error> executeQuery: Code: 159. DB::Exception: Timeout exceeded (180 s) while flushing system log 'DB::SystemLogQueue<DB::TraceLogElement>'. (TIMEOUT_EXCEEDED) (version 25.10.1.355) (from [::1]:57584) (comment: 01198_client_quota_key.sh-test_1o58lpmj) (query 2, line 1) (in query: SYSTEM FLUSH LOGS;), Stack trace (when copying this message, always include the lines below):

Most likely it is related to adding statistics to all columns, but I don't see that calculating statistics take a long time for system.trace_log. That's strange.

2025.09.23 17:16:39.442795 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 0 ms calculating statistics hostname for the part 202509_9_9_0
2025.09.23 17:16:39.442857 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 4 ms calculating statistics event_date for the part 202509_9_9_0
2025.09.23 17:16:39.442873 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 5 ms calculating statistics event_time for the part 202509_9_9_0
2025.09.23 17:16:39.442893 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 9 ms calculating statistics event_time_microseconds for the part 202509_9_9_0
2025.09.23 17:16:39.442940 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 11 ms calculating statistics timestamp_ns for the part 202509_9_9_0
2025.09.23 17:16:39.442965 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 3 ms calculating statistics revision for the part 202509_9_9_0
2025.09.23 17:16:39.442983 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 2 ms calculating statistics trace_type for the part 202509_9_9_0
2025.09.23 17:16:39.443001 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 3 ms calculating statistics thread_id for the part 202509_9_9_0
2025.09.23 17:16:39.443019 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 4 ms calculating statistics query_id for the part 202509_9_9_0
2025.09.23 17:16:39.443037 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 6 ms calculating statistics size for the part 202509_9_9_0
2025.09.23 17:16:39.443056 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 5 ms calculating statistics ptr for the part 202509_9_9_0
2025.09.23 17:16:39.443073 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 0 ms calculating statistics event for the part 202509_9_9_0
2025.09.23 17:16:39.443091 [ 2378 ] {} <Debug> system.trace_log (2eeff988-7665-4abb-b864-8f1f8d1ea2db) (DataPartWriter): Spent 5 ms calculating statistics increment for the part 202509_9_9_0

@CurtizJ
CurtizJ force-pushed the automatic-statistics branch from ed9187a to 5271ab9 Compare September 24, 2025 00:43
@CurtizJ
CurtizJ marked this pull request as ready for review October 3, 2025 17:48
@CurtizJ
CurtizJ requested a review from hanfei1991 October 8, 2025 13:44
Comment thread src/Storages/Statistics/Statistics.cpp Resolved

@hanfei1991 hanfei1991 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.

rest LGTM

@CurtizJ
CurtizJ force-pushed the automatic-statistics branch from c22e1a0 to df2c93a Compare October 9, 2025 22:56
@CurtizJ

CurtizJ commented Oct 14, 2025

Copy link
Copy Markdown
Member Author

Failed tests are flaky according to cidb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-feature Pull request with new product feature 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