Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3f48294

Browse files
committed
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
1 parent 32ddfaf commit 3f48294

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/backend/executor/nodeAgg.c

+2-9
Original file line numberDiff line numberDiff line change
@@ -3379,8 +3379,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
33793379
max_aggno = Max(max_aggno, aggref->aggno);
33803380
max_transno = Max(max_transno, aggref->aggtransno);
33813381
}
3382-
numaggs = max_aggno + 1;
3383-
numtrans = max_transno + 1;
3382+
aggstate->numaggs = numaggs = max_aggno + 1;
3383+
aggstate->numtrans = numtrans = max_transno + 1;
33843384

33853385
/*
33863386
* For each phase, prepare grouping set data and fmgr lookup data for
@@ -3943,13 +3943,6 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
39433943
ReleaseSysCache(aggTuple);
39443944
}
39453945

3946-
/*
3947-
* Update aggstate->numaggs to be the number of unique aggregates found.
3948-
* Also set numstates to the number of unique transition states found.
3949-
*/
3950-
aggstate->numaggs = numaggs;
3951-
aggstate->numtrans = numtrans;
3952-
39533946
/*
39543947
* Last, check whether any more aggregates got added onto the node while
39553948
* we processed the expressions for the aggregate arguments (including not

0 commit comments

Comments
 (0)