| From: | Sami Imseih <samimseih(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Lukas Fittl <lukas(at)fittl(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Unify parallel worker handling for index builds and instrumentation |
| Date: | 2026-06-02 23:29:05 |
| Message-ID: | CAA5RZ0vdsH7UNhuBJmgLhUwHVsaHzsrpMPrxWLNtvd_U-g+4fA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> >> 0001: Use the new Instrumentation struct to handle WAL and Buffer usage together
> >
> > This one is a straightforward refactor. Only comment is to remove the bare block
> >
> > - InstrEndParallelQuery(&buffer_usage[ParallelWorkerNumber],
> > -
> > &wal_usage[ParallelWorkerNumber]);
> > + {
> > + Instrumentation *worker_instr;
> > +
> > + worker_instr = shm_toc_lookup(toc,
> > PARALLEL_KEY_INSTRUMENTATION, false);
> > + InstrEndParallelQuery(&worker_instr[ParallelWorkerNumber]);
> > + }
>
> Instrumentation is a structure larger than WalUsage and BufferUsage
> combined, and we don't care about all these other fields for the
> parallel workers. Sure, this cuts code, but this also increases the
> DSM and memory footprint.
The difference is 192 bytes per worker; 360 bytes for Instrumentation
- 168 bytes
for removing BufferUsage and WalUsage. Even with 32 parallel workers ( probably
the extreme case ) that is ~6 KB, which is negligible compared to the code
cleanup.
gdb -batch -nx $PGHOME/bin/postgres \
-ex "print (int)sizeof(Instrumentation)" \
-ex "print (int)sizeof(BufferUsage)" \
-ex "print (int)sizeof(WalUsage)" \
-ex "ptype/o Instrumentation" \
-ex "ptype/o BufferUsage" \
-ex "ptype/o WalUsage"
$1 = 360
$2 = 128
$3 = 40
--
Sami Imseih
Amazon Web Services (AWS)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jeff Davis | 2026-06-02 23:33:41 | Commit Sequence Numbers and Visibility |
| Previous Message | David Rowley | 2026-06-02 23:10:22 | Re: deep copy with mutation? |