v.18.14Improvement

Significant Memory Optimization for ORDER BY and LIMIT Queries

Significantly reduced memory consumption for queries with ORDER BY and LIMIT. See the max_bytes_before_remerge_sort setting. #3205
Significantly reduced memory consumption for queries using ORDER BY with LIMIT by introducing the max_bytes_before_remerge_sort setting.

Why it matters

This feature addresses the high memory usage problem when executing queries that combine ORDER BY and LIMIT. By optimizing the sorting process, it helps users run such queries more efficiently, reducing resource consumption and improving overall performance.

How to use it

Users can enable or configure this optimization by setting the max_bytes_before_remerge_sort parameter in their query settings or user configurations. Adjusting this value controls when the remerge sort optimization is applied to limit memory usage during sorting.