Why this problem matters
Heavy write volume increases WAL generation, while archiving, slots, or checkpoint conditions can retain files longer. Generation and retention are different problems.
How to diagnose it
Compare deltas from pg_stat_wal, the current LSN position, and archive and slot state over time. A single wal_bytes total does not show the current generation rate.
The query reads cumulative WAL statistics and the current WAL position on a primary. pg_current_wal_lsn() is not available for use on a server in recovery.
SELECT wal_records, wal_fpi, wal_bytes, wal_buffers_full, stats_reset
FROM pg_stat_wal;
SELECT pg_current_wal_lsn() AS current_wal_lsn;A safe solution approach
First classify whether growth comes from write workload or a retention condition. Address query write behavior, archiving, slots, or checkpoint capacity according to the identified source.
Why continuous monitoring matters
moon helps continuously monitor WAL generation and disk trends with low overhead. Slack, PagerDuty, or webhook alerts expose rate changes and persistent growth.
Frequently asked questions
Does a large pg_wal directory prove high WAL generation?
No, files may be retained because of archiving or slot requirements. Measure generation rate and retention causes separately.
How does moon help with this problem?
moon continuously observes SQL Server, PostgreSQL, and MongoDB signals, helping teams evaluate the problem as a trend instead of relying on a one-time check.