> >> 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)