v.21.11Improvements
Allow Optimization of Arithmetic Operations in Aggregate Functions with Alias
Allow optimization optimize_arithmetic_operations_in_aggregate_functions = 1 when alias is used. #28746 (Amos Bird).Why it matters
This feature improves query performance by allowing arithmetic operation optimizations inside aggregate functions even when those functions are used via aliases. Previously, such optimizations did not apply if aliases were involved, limiting the effectiveness of this setting.How to use it
Set the settingoptimize_arithmetic_operations_in_aggregate_functions to 1 in your query or configuration to enable this optimization. It will now correctly optimize arithmetic operations in aggregate functions, including when these are used with aliases.