A PostgreSQL event table with six-month retention

A product event table holds 120 million rows and adds a million each day. Two narrow B-tree indexes support product queries, and daily partitions expire after six months.

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
42.24GB
12-month storage
63.36GB
36-month storage
63.36GB

The modeled hot working set fits in the supplied RAM budget.

Table and index growth
Table and index growthHeap and indexes now 42.24 GB. 12-month storage 63.36 GB. 36-month storage 63.36 GB0 GB31.68 GB63.36 GBNow12 mo36 moHeap + indexesHeap alone
Detailed results
Current heap31.68 GB
Current indexes10.56 GB
12-month rows180,000,000
36-month rows180,000,000
Hot working set3.802 GB
Working set / available RAM29.504 %
Read IOPS400 IOPS
Write IOPS1,200 IOPS
Data page I/O1,600 IOPS
WAL write throughput0.72 MB/s
Data and WAL throughput13.827 MB/s
WAL generated per day62.208 GB

What to try

At steady retention the modeled heap and indexes stabilize at 63.36 GB. Check partition deletion and current relation bytes before budgeting disk for WAL and maintenance as well.

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

Why are 12-month and 36-month event storage equal?

Both dates are beyond the six-month retention horizon. Fixed daily inserts and timely partition drops produce the same estimated row count.

Can monthly event partitions match six-month retention precisely?

Dropping by whole partitions can retain part of an extra month. Size the temporary overlap or choose smaller time partitions.

Open Database storage & IOPS calculator