Hi Ayush,

> HashAgg seems to lose the worker's spill stats when Gather is rescanned.

I looked at v1, and it LGTM.
I had noticed the same problem and posted a patch in another thread [1],
but as David pointed out, it was a duplicate, so I've withdrawn it.  The
two differ only in how the following part is written, and they gave the
same results.

Yours:
+ if (si->hash_batches_used == 0)
+ si->hash_batches_used = node->hash_batches_used;
+ else
+ si->hash_batches_used += node->hash_batches_used - 1;

Mine:
+ si->hash_batches_used = Max(si->hash_batches_used, 1) +
+ node->hash_batches_used - 1;

I wrote it this way because I couldn't find a similar if...else in other
nodes, and it can be written more simply without one.  But I think it's
just a matter of taste.

Regards,
Tatsuya Kawata

[1]
https://www.postgresql.org/message-id/flat/CAHza6qfgOQ0Psd5kbYkHn2RCAOfcBMvRohUX3SUptd1kZj6euA%40mail.gmail.com

Reply via email to