Pcornel
Databases · Performance & Capacity

Database Memory and Disk Sizing

Cheat sheet · https://pcornel.dk/topic.php?topic=6191

Back to the Topic

Answer

Database sizing plans memory (buffer pools, work memory), CPU, disk capacity and IOPS, and growth for data, indexes, logs and backups.

Remember

Measure growth per month. Leave space for maintenance (VACUUM FULL, index rebuilds) and WAL bursts. Per-query memory (work_mem, sort buffers) multiplies with connections.

First checks

  • SELECT pg_size_pretty(pg_database_size('db')); — first check for this topic
  • psql -c "SELECT now(), version();" — PostgreSQL reachable and version
  • mysql -e "SELECT NOW(), VERSION();" — MariaDB/MySQL reachable and version
  • sqlcmd -S <server> -Q "SELECT @@VERSION" — SQL Server reachable and version

Verify in this order

workload → memory/CPU/IO needs → growth → capacity plan

Where it usually breaks

Network storage with high latency makes commits slow even at low load.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6191

Confirmation

Confirm action

Continue?