From 0a2bc5d61e713e3fe72438f020eea5fcc90b0f0b Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Tue, 24 Nov 2020 10:45:00 +0200 Subject: Move per-agg and per-trans duplicate finding to the planner. This has the advantage that the cost estimates for aggregates can count the number of calls to transition and final functions correctly. Bump catalog version, because views can contain Aggrefs. Reviewed-by: Andres Freund Discussion: https://www.postgresql.org/message-id/b2e3536b-1dbc-8303-c97e-89cb0b4a9a48%40iki.fi --- src/backend/utils/adt/selfuncs.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/backend/utils/adt/selfuncs.c') diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index bec357fcef0..80bd60f8767 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -3839,12 +3839,14 @@ estimate_hash_bucket_stats(PlannerInfo *root, Node *hashkey, double nbuckets, * won't store them. Is this a problem? */ double -estimate_hashagg_tablesize(Path *path, const AggClauseCosts *agg_costs, - double dNumGroups) +estimate_hashagg_tablesize(PlannerInfo *root, Path *path, + const AggClauseCosts *agg_costs, double dNumGroups) { - Size hashentrysize = hash_agg_entry_size(agg_costs->numAggs, - path->pathtarget->width, - agg_costs->transitionSpace); + Size hashentrysize; + + hashentrysize = hash_agg_entry_size(list_length(root->aggtransinfos), + path->pathtarget->width, + agg_costs->transitionSpace); /* * Note that this disregards the effect of fill-factor and growth policy -- cgit v1.2.3