Re: log_checkpoints: count WAL segment creations from all processes

Hüseyin Demir <huseyin.d3r@gmail.com>

From: Hüseyin Demir <huseyin.d3r@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Cc: Xuneng Zhou <xunengzhou@protonmail.com>
Date: 2026-05-17T09:10:36Z
Lists: pgsql-hackers
Hi,

Thanks for the patch. The idea is good and can we introduce a new
counter to pg_stat_checkpointer ? For example, we can add
wal_segments_created to this view and it would be useful for capacity
planning and load estimations.

Additionally I have a few questions

- Should we make walSegsCreatedLastCheckpoint atomic ? In the future
we can also add this to views maybe. It's an auxiliary suggestion.
- ckpt_segs_added is defined as int but overflow threshold is 2^32 in
comments. Shouldn't we use 2^31 for int ?
- Maybe it's a bad idea but should we extend the tests with the
wal_level set to minimal ?

PS: I created a patch to expose wal_segments_created to
pg_stat_checkpointer view. You can review it and enhance your patch if
you need. I created it to explain my idea better so it can be
destroyed after your review. But I couldn't create a patch for
preceding questions.

Regards,
Demir.