diff options
author | Jeff Davis <jdavis@postgresql.org> | 2025-01-07 15:13:50 -0800 |
---|---|---|
committer | Jeff Davis <jdavis@postgresql.org> | 2025-01-07 15:13:50 -0800 |
commit | 3f482940dbcbd15834a67894f4d9efdf5ceb7e16 (patch) | |
tree | d456c83c3a84d245c0f6efa5a0cff9dd642dddfe /src/backend/executor/nodeAgg.c | |
parent | 32ddfaffd1493b27f200afb3919d3fd2e6a200ef (diff) | |
download | postgresql-3f482940dbcbd15834a67894f4d9efdf5ceb7e16.tar.gz postgresql-3f482940dbcbd15834a67894f4d9efdf5ceb7e16.zip |
ExecInitAgg: update aggstate->numaggs and ->numtrans earlier.
Functions hash_agg_entry_size() and build_hash_tables() make use of
those values for memory size estimates.
Because this change only affects memory estimates, don't backpatch.
Discussion: https://postgr.es/m/7530bd8783b1a78d53a3c70383e38d8da0a5ffe5.camel%40j-davis.com
Diffstat (limited to 'src/backend/executor/nodeAgg.c')
-rw-r--r-- | src/backend/executor/nodeAgg.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 66cd4616963..3005b5c0e3b 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -3379,8 +3379,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) max_aggno = Max(max_aggno, aggref->aggno); max_transno = Max(max_transno, aggref->aggtransno); } - numaggs = max_aggno + 1; - numtrans = max_transno + 1; + aggstate->numaggs = numaggs = max_aggno + 1; + aggstate->numtrans = numtrans = max_transno + 1; /* * For each phase, prepare grouping set data and fmgr lookup data for @@ -3944,13 +3944,6 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) } /* - * Update aggstate->numaggs to be the number of unique aggregates found. - * Also set numstates to the number of unique transition states found. - */ - aggstate->numaggs = numaggs; - aggstate->numtrans = numtrans; - - /* * Last, check whether any more aggregates got added onto the node while * we processed the expressions for the aggregate arguments (including not * only the regular arguments and FILTER expressions handled immediately |