Update bloat in a multitenant PostgreSQL table

A multitenant settings table has 10 million rows and five indexes. Frequent updates have raised the bloat estimate to 50% and peak write rate to 1,800 queries per second.

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
9GB
12-month storage
12.24GB
36-month storage
18.72GB

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

Table and index growth
Table and index growthHeap and indexes now 9 GB. 12-month storage 12.24 GB. 36-month storage 18.72 GB0 GB9.36 GB18.72 GBNow12 mo36 moHeap + indexesHeap alone
Detailed results
Current heap6 GB
Current indexes3 GB
12-month rows13,600,000
36-month rows20,800,000
Hot working set1.35 GB
Working set / available RAM7.858 %
Read IOPS400 IOPS
Write IOPS5,400 IOPS
Data page I/O5,800 IOPS
WAL write throughput4.32 MB/s
Data and WAL throughput51.834 MB/s
WAL generated per day373.248 GB

What to try

Set a lower bloat scenario and compare its steady-state size with the free disk available during a rewrite. Reclaiming space can itself need temporary storage and WAL bandwidth.

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

Do tenant-specific index entry sizes matter for this bloat forecast?

Yes. An index using a long tenant key can be larger than the average. Estimate a weighted entry size or model that index separately.

Does ordinary PostgreSQL VACUUM shrink the table to the modeled clean size?

It usually marks space reusable inside the existing relation. Reclaiming space at the filesystem can require a rewrite or a point where trailing pages can be truncated.

Open Database storage & IOPS calculator