| From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
|---|---|
| To: | Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com> |
| Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Hash aggregation shows only the last execution's stats for parallel workers |
| Date: | 2026-11-24 01:43:45 |
| Message-ID: | CAApHDvpOELHPYgA+4ooKz05JJNgCp4=tA0RLquTztDxYOd+=Wg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, 17 Nov 2026 at 03:17, Tatsuya Kawata
<kawatatatsuya0913(at)gmail(dot)com> wrote:
> When a Gather (or Gather Merge) node is rescanned, a new set of workers
> is started, and they write their Agg stats into the same shared memory
> slots as the previous ones. ExecEndAgg() overwrites the values, so
> EXPLAIN ANALYZE shows the per-worker Batches etc. only for the last
> execution.
This seems to be a duplicate of [1]. The patches seem to take a
different approach to how hash_batches_used is calculated.
You've got:
+ /* Workers restart on rescan; count the initial batch only once. */
+ if (si->hash_batches_used == 0)
+ si->hash_batches_used = node->hash_batches_used;
+ else
+ si->hash_batches_used += node->hash_batches_used - 1;
Whereas the other patch does:
+ si->hash_batches_used = Max(si->hash_batches_used, 1) +
+ node->hash_batches_used - 1;
Can you state the other patches version isn't correct?
David
[1] https://postgr.es/m/CAJTYsWW5evhmWDWAgknx=GXNMJG=k4-T+d435pZpg8Lqxc=kFQ@mail.gmail.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bharath Rupireddy | 2026-11-24 01:58:36 | Re: Parallel heap vacuum |
| Previous Message | Masahiko Sawada | 2026-11-24 01:39:25 | Re: Make COPY format extendable: Extract COPY TO format implementations |