v.23.11New Feature

Use Statistics to Improve Prewhere Condition Ordering

Use statistics to order prewhere conditions better. #53240 (Han Fei).
Optimize the order of PREWHERE conditions using query statistics to improve query performance.

Why it matters

This feature addresses the issue of inefficient ordering of PREWHERE conditions by leveraging collected statistics. It helps ClickHouse execute queries more efficiently by prioritizing the most selective conditions first, thus reducing data scanning and speeding up query execution.

How to use it

This optimization is applied automatically when using PREWHERE clauses. No additional user configuration is necessary as the optimizer uses available statistics to reorder the conditions dynamically.