v.22.12Improvement

Implement Aggregation-in-Order Optimization for Query Plans

Implement aggregation-in-order optimization on top of a query plan. It is enabled by default (but works only together with optimize_aggregation_in_order, which is disabled by default). Set query_plan_aggregation_in_order = 0 to use the previous AST-based version. #43592 (Nikolai Kochetov).
Implemented aggregation-in-order optimization at the query plan level to improve aggregation performance.

Why it matters

This feature aims to enhance aggregation efficiency by applying the aggregation-in-order optimization on the query plan, which can lead to better query execution compared to the previous AST-based method. It solves the problem of less efficient aggregation by leveraging optimization during the query planning phase.

How to use it

The optimization is enabled by default but requires optimize_aggregation_in_order to be enabled (disabled by default). To revert to the legacy AST-based aggregation optimization, set query_plan_aggregation_in_order = 0.