Read replica cache and IOPS sizing
A read-heavy replica handles 12,000 queries per second, each touching three pages. It often reaches 98% cache hits, while a hot share of 45% must compete for 16 GiB of RAM.
Jump to resultsInputs
Results
Runs in your browser- Heap and indexes now
- 52.8GB
- 12-month storage
- 112.2GB
- 36-month storage
- 118.8GB
The modeled hot working set exceeds available RAM.
| Current heap | 44 GB |
|---|---|
| Current indexes | 8.8 GB |
| 12-month rows | 170,000,000 |
| 36-month rows | 180,000,000 |
| Hot working set | 23.76 GB |
| Working set / available RAM | 138.301 % |
| Read IOPS | 720 IOPS |
| Write IOPS | 100 IOPS |
| Data page I/O | 820 IOPS |
| WAL write throughput | 0.09 MB/s |
| Data and WAL throughput | 6.807 MB/s |
| WAL generated per day | 7.776 GB |
What to try
Compare the hot working set against available RAM, then reduce the hit rate to model a cold replica. The 98% case should not be the sole disk performance target.
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 can a replica with 98% hits still need 720 read IOPS?
Two percent of 36,000 page touches each second miss the cache in this model. A high hit fraction can still leave a large absolute miss rate.
Which writes should I count when sizing a PostgreSQL read replica?
Use measured page-write activity from replay and background work. A read-only client endpoint can still have substantial storage writes.