What WAL does
Before PostgreSQL writes a changed data page, it first records enough information in the write-ahead log to redo the change. Sequential WAL writes support crash recovery, continuous archiving, point-in-time recovery, and replication.
Three questions must stay separate: how many WAL bytes the workload generates, how many segment files PostgreSQL currently retains, and how much archived or provider-managed storage those records occupy.
Inspect cumulative WAL generation
pg_stat_wal returns one cluster-wide row. Its counters are cumulative since stats_reset, so take two timestamped observations and compare compatible deltas to estimate a rate.
SELECT
wal_records,
wal_fpi,
wal_bytes,
wal_buffers_full,
stats_reset
FROM pg_stat_wal;Inspect replication slots that can retain WAL
A slot's restart_lsn identifies the oldest WAL it might still require. This read-only query exposes slot state without calculating a provider-specific disk value.
SELECT
slot_name,
slot_type,
database,
active,
restart_lsn,
confirmed_flush_lsn,
wal_status,
safe_wal_size
FROM pg_replication_slots
ORDER BY active, slot_name
LIMIT 50;Generation and retention have different causes
| Observation | Possible context | What to verify |
|---|---|---|
| WAL bytes rise quickly | Write-heavy statements, full-page images, bulk loads, index work, or maintenance can generate records. | Compare counter deltas over a known interval and correlate with authorized workload evidence. |
| WAL files remain retained | Replication slots, standby needs, archiving, checkpoints, and retention settings can delay recycling. | Inspect slot and archiver state plus the settings available on your platform. |
| wal_buffers_full increases | WAL buffers filled and writes were requested. | Treat it as a cumulative signal; configuration changes need workload testing. |
| Provider disk rises | The provider may count WAL and system storage separately from logical database size. | Use the provider's documented measurement and architecture. |
Managed platforms can report WAL differently
Supabase describes WAL as a separate component of disk usage. Neon routes WAL through Safekeepers and derives pages through its storage service, so assumptions based on access to a traditional server filesystem are not portable. Follow the provider's supported controls and definitions instead of translating a PostgreSQL counter directly into cost.
WAL safety rules
- Do not reset WAL statistics just to make a graph easier to read; preserve the observation window.
- Do not assume an inactive slot is abandoned or safe to drop.
- Do not treat logical database size as the size of WAL or archived backups.
- Do not change retention, checkpoint, or archiving settings from one snapshot.
When DatabaseMeter can help
When pg_stat_statements exposes WAL counters, the analyzer can rank normalized query fingerprints by their cumulative WAL bytes and records. That can identify statement-level contributors within the extension's statistics window without collecting SQL text.
DatabaseMeter does not currently collect cluster-wide pg_stat_wal totals or replication-slot retention. Its logical database-size trend also does not represent WAL directory or archive size, so confirm retention with PostgreSQL and provider-native evidence.
Definitions and sources
Provider and PostgreSQL statements last reviewed August 29, 2026. Pricing consoles and invoices remain authoritative.
Related database resources
How to interpret pg_stat_statements
Rank normalized query fingerprints while accounting for cumulative counters, resets, and privacy.
Open resourceWhy your PostgreSQL database keeps growing
Separate logical data and index growth from reusable space, WAL retention, and provider disk measurements.
Open resourcepg_stat_statements analyzer
Rank bounded query fingerprints from CSV, TSV, JSON, or an eligible connected database—without SQL text.
Open resource