On Sun, Mar 15, 2020 at 04:05:37PM -0700, Jeff Davis wrote:
> > + if (from_tape)
> > + partition_mem += HASHAGG_READ_BUFFER_SIZE;
> > + partition_mem = npartitions * HASHAGG_WRITE_BUFFER_SIZE;
> >
> > => That looks wrong ; should say += ?
>
> Good catch! Fixed.
> +++ b/src/backend/executor/nodeAgg.c
> @@ -2518,9 +3499,36 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
> */
> if (use_hashing)
> {
> + Plan *outerplan = outerPlan(node);
> + uint64 totalGroups = 0;
> + for (i = 0; i < aggstate->num_hashes; i++)
> + totalGroups = aggstate->perhash[i].aggnode->numGroups;
> +
> + hash_agg_set_limits(aggstate->hashentrysize, totalGroups, 0,
I realize that I missed the train but .. that looks like another += issue?
Also, Andres was educating me about the range of behavior of "long" type, and I
see now while rebasing that you did the same thing.
https://www.postgresql.org/message-id/20200306175859.d56ohskarwldyrrw%40alap3.anarazel.de
--
Justin