v.24.6Experimental Feature

Introduce "number of distinct values" statistics

Introduce statistics of type "number of distinct values". #59357 (Han Fei).
Introduce statistics of type "number of distinct values" in ClickHouse.

Why it matters

This feature provides the capability to collect and utilize statistics on the number of distinct values in columns. It helps optimize query execution plans by giving the query optimizer more precise information about data distribution, leading to better resource usage and performance improvements.

How to use it

Users can enable and collect the new distinct values statistics by configuring the table statistics collection settings in ClickHouse. Once enabled, the query optimizer will automatically take these statistics into account during query planning without additional user intervention.