v.23.10New Feature
Enhancement: Indexing with Space-Filling Curves in ClickHouse
If a table has a space-filling curve in its key, e.g.,ORDER BY mortonEncode(x, y), the conditions on its arguments, e.g.,x >= 10 AND x <= 20 AND y >= 20 AND y <= 30can be used for indexing. A settinganalyze_index_with_space_filling_curvesis added to enable or disable this analysis. This closes #41195. Continuation of #4538. Continuation of #6286. Continuation of #28130. Continuation of #41753. #55642 (Alexey Milovidov).
Why it matters
This feature improves query performance for tables that use space-filling curves in theirORDER BY keys by enabling analysis of filter conditions on the curve's input arguments (e.g., ranges on x and y). It helps the query planner leverage these conditions to better prune data during query execution.How to use it
To enable analysis of indexes with space-filling curves, set the configuration parameteranalyze_index_with_space_filling_curves to 1 (or true) in your server configuration or session settings. Then queries with conditions on arguments of the space-filling curve function in the key will be considered for index usage.