optimize_aggregation_in_order
Enables GROUP BY optimization in SELECT queries for aggregating data in corresponding order in MergeTree tables. Possible values:- 0 —
GROUP BYoptimization is disabled. - 1 —
GROUP BYoptimization is enabled.
optimize_aggregation_in_order_limit
When enabled and aggregation in order is active, pushes LIMIT into the aggregation step to enable early termination after producing enough groups. This reduces the amount of data read when ORDER BY matches the GROUP BY key prefix. May reduce the value reported byrows_before_limit_at_least; use exact_rows_before_limit if exact counts are needed.