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 results

Inputs

Table and indexes
bytes
bytes
%
%
bytes
%
Growth and cache
months
%
GB
Disk and WAL workload
queries/s
queries/s
%
bytes

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.

Table and index growth
Table and index growthHeap and indexes now 115 GB. 12-month storage 165.6 GB. 36-month storage 165.6 GB0 GB82.8 GB165.6 GBNow12 mo36 moHeap + indexesHeap alone
Detailed results
Current heap85 GB
Current indexes30 GB
12-month rows720,000,000
36-month rows720,000,000
Hot working set17.25 GB
Working set / available RAM100.408 %
Read IOPS400 IOPS
Write IOPS720 IOPS
Data page I/O1,120 IOPS
WAL write throughput0.336 MB/s
Data and WAL throughput9.511 MB/s
WAL generated per day29.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.

Open Database storage & IOPS calculator