0Pricing
SQL Academy · Lesson

Capacity Planning and Bloat Audits

Forecast disk and IOPS growth, audit table and index bloat regularly, and plan upgrades before you run out.

What to Forecast

To size your database for the next 6–12 months you need to project:

  • Disk usage (data + WAL + indexes)
  • IOPS demand
  • RAM working set
  • Connection count

Disk Growth

Trend recent growth:

SELECT pg_size_pretty(pg_database_size(current_database()));
SELECT pg_size_pretty(pg_total_relation_size(t.oid)) AS total,
       relname
FROM pg_class t
WHERE relkind = 'r'
ORDER BY pg_total_relation_size(t.oid) DESC LIMIT 20;

All lessons in this course

  1. pg_stat_statements: Top Queries
  2. pgBadger for Log Analysis
  3. Connection Pooling: PgBouncer
  4. Capacity Planning and Bloat Audits
← Back to SQL Academy