v.25.11Improvement
Add two settings: merge tree
Cache table-level statistics, add two settings: merge tree settingrefresh_statistics_intervalmeans the interval of refreshing statistics cache, 0 means no cache will be created. Session settinguse_statistics_cachemeans whether to use table-level statistics in a query. Sometimes we want better statistics so we choose to ignore it. #88670 (Han Fei).
Why it matters
The feature improves query performance by caching table-level statistics, reducing overhead from frequent statistics recalculations. It also provides flexibility by allowing users to disable the cache when more accurate or up-to-date statistics are required for specific queries.How to use it
Set the MergeTree table settingrefresh_statistics_interval to a non-zero value (in seconds) to enable periodic refreshing of the cached statistics. Use the session setting use_statistics_cache to true to enable using cached statistics in queries or set it to false to bypass the cache if up-to-date statistics are needed.