From 7d4395d0a11589aa450a073d658c49b420f4493f Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Thu, 6 Feb 2020 11:49:56 -0800 Subject: Refactor hash_agg_entry_size(). Consolidate the calculations for hash table size estimation. This will help with upcoming Hash Aggregation work that will add additional call sites. --- src/backend/utils/adt/selfuncs.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 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 7c6f0574b37..0be26fe0378 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -3526,16 +3526,8 @@ double estimate_hashagg_tablesize(Path *path, const AggClauseCosts *agg_costs, double dNumGroups) { - Size hashentrysize; - - /* Estimate per-hash-entry space at tuple width... */ - hashentrysize = MAXALIGN(path->pathtarget->width) + - MAXALIGN(SizeofMinimalTupleHeader); - - /* plus space for pass-by-ref transition values... */ - hashentrysize += agg_costs->transitionSpace; - /* plus the per-hash-entry overhead */ - hashentrysize += hash_agg_entry_size(agg_costs->numAggs); + Size hashentrysize = hash_agg_entry_size( + agg_costs->numAggs, path->pathtarget->width, agg_costs->transitionSpace); /* * Note that this disregards the effect of fill-factor and growth policy -- cgit v1.2.3