WAL planning for an audit ledger
A regulated audit ledger holds 500 million narrow rows. It keeps twelve months of events and sees approximately 240 writes per second at its provisioned baseline.
Jump to resultsInputs
Results
Runs in your browser- Heap and indexes now
- 115GB
- 12-month storage
- 165.6GB
- 36-month storage
- 165.6GB
The modeled hot working set exceeds available RAM.
| Current heap | 85 GB |
|---|---|
| Current indexes | 30 GB |
| 12-month rows | 720,000,000 |
| 36-month rows | 720,000,000 |
| Hot working set | 17.25 GB |
| Working set / available RAM | 100.408 % |
| Read IOPS | 400 IOPS |
| Write IOPS | 720 IOPS |
| Data page I/O | 1,120 IOPS |
| WAL write throughput | 0.336 MB/s |
| Data and WAL throughput | 9.511 MB/s |
| WAL generated per day | 29.03 GB |
What to try
The table’s stored data and the estimated 29 GB/day of WAL have different retention rules. Budget the WAL volume from replication lag and archive policy as well as steady write rate.
How the estimate works
Heap bytes ≈ rows × (payload + tuple overhead) ÷ fillfactor × (1 + bloat)
The heap estimate includes row overhead, free space from fillfactor, and extra bloat. Index size uses an average entry size, a B-tree overhead factor, and the same bloat factor. Use measured relation sizes to calibrate these estimates when available.
A forecast month is 30 days. When a retention period and a positive arrival rate are set, future rows are capped at arrivals within that retention horizon. The current size uses the supplied row count. Forecast points assume pruning is effective by that point.
Read IOPS comes from uncached page touches. Page I/O assumes 8 KiB pages and a steady write rate. WAL bandwidth uses bytes generated per write. Data page throughput and WAL throughput are added. A WAL segment retention policy, TOAST, maintenance spikes, and replica amplification need separate sizing.
Frequently asked questions
Should audit-table retention be applied to WAL segments too?
No. WAL retention is governed by archives, backups, and replication slots. The table row retention horizon describes application data.
Can point-in-time recovery replay every retained audit record?
PITR needs a usable base backup and all WAL segments from that backup to the target. Set and test the recovery window independently of live table retention.