You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Allow aggregates to provide estimates of their transition state data size.
Formerly the planner had a hard-wired rule of thumb for guessing the amountof space consumed by an aggregate function's transition state data. Thisestimate is critical to deciding whether it's OK to use hash aggregation,and in many situations the built-in estimate isn't very good. This patchadds a column to pg_aggregate wherein a per-aggregate estimate can beprovided, overriding the planner's default, and infrastructure for settingthe column via CREATE AGGREGATE.It may be that additional smarts will be required in future, perhaps evena per-aggregate estimation function. But this is already a step forward.This is extracted from a larger patch to improve the performance of numericand int8 aggregates. I (tgl) thought it was worth reviewing and committingthis infrastructure separately. In this commit, all built-in aggregatesare given aggtransspace = 0, so no behavior should change.Hadi Moshayedi, reviewed by Pavel Stehule and Tomas Vondra