PostgreSQL storage
Identify whether tables, indexes, TOAST, or WAL are driving growth without reclaiming space in production.
Last updated
On this page (5)
PostgreSQL ยท Storage
Before you start
- Read access to size and monitoring views and to filesystem or volume metrics.
Procedure
- Trend database and tablespace sizes and sample the largest relations using pg_total_relation_size, pg_table_size, and pg_indexes_size; account for partitions separately.
- Compare relation growth with data-volume and WAL-volume usage. Inspect archiving and replication state if WAL is growing.
- Record the headroom and likely cause; avoid deleting WAL files or starting rewrites as part of diagnosis.
Verify the result
- Repeat the sample across a representative workload interval and reconcile major differences between SQL sizes and host usage.
- Confirm that any WAL backlog explanation matches observed archive or replication status before proposing changes.
