diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2020-11-24 10:45:00 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2020-11-24 10:45:00 +0200 |
commit | 0a2bc5d61e713e3fe72438f020eea5fcc90b0f0b (patch) | |
tree | 8f630f828fa6bbfb5984f037118211cd68d8a50e /src/backend/utils/adt/selfuncs.c | |
parent | e522024bd8dd28a0f13dcccfd39170698f45c939 (diff) | |
download | postgresql-0a2bc5d61e713e3fe72438f020eea5fcc90b0f0b.tar.gz postgresql-0a2bc5d61e713e3fe72438f020eea5fcc90b0f0b.zip |
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
Diffstat (limited to 'src/backend/utils/adt/selfuncs.c')
-rw-r--r-- | src/backend/utils/adt/selfuncs.c | 12 |
1 files changed, 7 insertions, 5 deletions
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 |