-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Fuse some aggregate functions #20091
Copy link
Copy link
Closed
Labels
Description
Add aggregate function sumCount. This function returns a tuple of two fields: sum and count.
Add a setting optimize_fuse_sum_count_avg.
If it is enabled and query contains at least two aggregate functions from sum, count, avg of identical arguments, rewrite them to sumCount(x).1, sumCount(x).2, sumCount(x).1 / sumCount(x).2.
This setting should not be enabled by default to avoid incompatibilities in clusters where new and old server versions may work at the same time.
Further directions
Multiple quantile functions can be fused to single quantiles.
Alternatives
Compiled aggregator that we already had years ago but removed.
Reactions are currently unavailable