v.24.2Improvement

Added Settings for Query Optimization and Debugging in ClickHouse

Added settings split_parts_ranges_into_intersecting_and_non_intersecting_final and split_intersecting_parts_ranges_into_layers_final. These settings are needed to disable optimizations for queries with FINAL and needed for debug only. #59705 (Maksim Kita). Actually not only for that - they can also lower memory usage at the expense of performance.
Added two new settings, split_parts_ranges_into_intersecting_and_non_intersecting_final and split_intersecting_parts_ranges_into_layers_final, to control query optimizations for FINAL queries and memory usage trade-offs.

Why it matters

These settings allow users to disable certain internal optimizations applied during queries with the FINAL modifier, primarily for debugging purposes. Additionally, they help reduce memory consumption at the cost of query performance, giving users flexibility to balance resource usage and speed.

How to use it

Users can enable or disable these optimizations by setting split_parts_ranges_into_intersecting_and_non_intersecting_final and split_intersecting_parts_ranges_into_layers_final in their session or server configuration. Setting them to false disables the optimizations, which is useful for debugging or lowering memory usage.