v.1.1.54276New Feature

Max Size Parameter and Performance Optimization for groupArray Function

Added the max_size parameter for the groupArray(max_size)(column) aggregate function, and optimized its performance.
Introduced a max_size parameter for the groupArray(max_size)(column) aggregate function in ClickHouse and optimized its performance to efficiently limit the size of the resulting array.

Why it matters

This feature addresses the issue of potentially large memory consumption and performance overhead when using groupArray on large datasets by allowing users to specify a maximum size for the aggregated array. Limiting the size helps control resource usage, improving query performance and stability, especially in scenarios with high cardinality or large groups.

How to use it

Use the groupArray function with the max_size parameter to limit the number of elements collected in the array. For example:
SELECT groupArray(100)(column) FROM table
This collects at most 100 elements per group, optimizing both memory consumption and execution time compared to the unlimited default.