aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/selfuncs.c
diff options
context:
space:
mode:
authorJeff Davis <jdavis@postgresql.org>2020-02-06 11:49:56 -0800
committerJeff Davis <jdavis@postgresql.org>2020-02-06 11:49:56 -0800
commit7d4395d0a11589aa450a073d658c49b420f4493f (patch)
treeb9be6165922e73d2351d8565f9051184ae56f036 /src/backend/utils/adt/selfuncs.c
parentc02fdc9223015c5c386abfa00c47fc7f4c845161 (diff)
downloadpostgresql-7d4395d0a11589aa450a073d658c49b420f4493f.tar.gz
postgresql-7d4395d0a11589aa450a073d658c49b420f4493f.zip
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.
Diffstat (limited to 'src/backend/utils/adt/selfuncs.c')
-rw-r--r--src/backend/utils/adt/selfuncs.c12
1 files changed, 2 insertions, 10 deletions
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