Hi all,
This patch is an update after reworking the “checkpoint reason” changes as a standalone patch, separate from the pg_stat_checkpointer additions as suggested [1]. I applied the patch on a clean tree and verified that the logging changes work as expected under different workloads. I am attaching the observations and patch in support for this.This would improve clarity for performance debugging and help understand checkpoint behavior without parsing WAL logs manually. Below is one representative checkpoint log entry after a pgbench run and an explicit CHECKPOINT:
2025-12-01 15:33:30.121 IST [69178] LOG: checkpoint complete (immediate): wrote 3417 buffers (20.9%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 1 recycled; write=0.122 s, sync=0.022 s, total=0.166 s; sync files=9, longest=0.005 s, average=0.003 s; distance=31304 kB, estimate=489729 kB; lsn=0/65E92BC8, redo lsn=0/65E92B70
Regarding the pg_stat_checkpointer extensions [1], I understand the concerns that were raised and I will follow up with a separate full patch once I incorporate the remaining feedback.
Thank you for the guidance. It has been very helpful. Looking forward to more further feedback.
Regards,
Soumya
Reference
[1]
https://www.postgresql.org/message-id/flat/CAMtXxw_W6w2Q1QsCvMPnoq3xCMKzH28Zjk_EmL60oP%2BsCTkXOw%40mail.gmail.com