Database Capacity Planning: A Practical Guide

Plan database capacity from measured growth, retention, workload, and provisioning time. Includes a storage forecast and PostgreSQL-specific memory guidance.

published: reading time: 7 min read author: Geek Workbench updated: November 8, 2026
Quick Summary

Use observed workload and growth ranges to plan compute, memory, storage, and connections. This guide separates PostgreSQL settings from general capacity work and includes a storage estimate you can recalculate as new measurements arrive.

Database Capacity Planning: A Practical Guide

Capacity planning is a forecast with an expiration date. Workloads change, retention policies shift, and maintenance can need more space than expected. Start with measurements from the database you run, record the assumptions, and set a date to recalculate before the next provisioning decision.

The method here applies to database systems generally. PostgreSQL settings are labeled where they appear; check the matching documentation for other engines and managed services.

Start with the workload

Before sizing hardware, capture the workload the system needs to support:

  • Request and transaction volume across normal and peak periods.
  • Query mix, concurrency, and latency objectives.
  • Read/write ratio, batch jobs, and maintenance windows.
  • Retention, deletion, and expected product or customer changes.
  • Provisioning lead time, failover requirements, and backup retention.

Use a representative load test or recent production measurements. A single CPU or disk-utilization number does not identify the bottleneck on its own. Compare latency with CPU, I/O wait, lock waits, active sessions, and queue time.

Compute and connections

Size compute against the concurrency and query mix you measured. When latency rises, first find where time is spent: query plans, locks, connection queues, CPU saturation, or storage waits can call for different fixes. A larger instance may help, but it will not repair an inefficient query or a connection pool that admits too many active queries.

For PostgreSQL, max_connections sets a connection limit, and some resources scale with it. The right value depends on the pooler, useful active query concurrency, and memory available to the host. A pool can queue client work while keeping database concurrency within a level the measured workload supports. Keep room for administrative and replication connections.

There is no safe pool-size formula that works across query mixes. Start with a conservative limit, then measure queue wait, active sessions, database latency, and throughput under representative load. Increase the pool only when the database can use more concurrent work without worsening the latency target.

Memory: PostgreSQL example

For PostgreSQL, shared_buffers is the database’s shared page cache. The current PostgreSQL resource documentation, checked 2026-11-08, describes roughly 25% of RAM as a reasonable starting point on a dedicated database server with at least 1 GB of RAM. It is a benchmark hypothesis, not an automatic setting: PostgreSQL also benefits from the operating-system cache, and the best value depends on the workload and host.

On a dedicated 32 GB host, 8 GB is a benchmark hypothesis for shared_buffers, not a recommendation to copy without testing. Compare representative query latency and I/O before and after the change, and account for memory used by the operating system and other processes.

effective_cache_size is a planner estimate of cache available to queries. It does not reserve memory. Set it from the memory PostgreSQL and the operating system can realistically use for cached data.

work_mem applies to each eligible query operation, such as a sort or hash table. A query can use several such operations, and several queries can run at once. For that reason, a per-session estimate can understate peak memory use. Check temporary-file activity, query concurrency, and hash operations before raising it. maintenance_work_mem applies to operations such as vacuum and index creation; account for concurrent maintenance work too.

Storage forecast

Measure table and index growth after deletes and retention jobs. Use low and high recent net-growth observations instead of a single fixed growth rate. A retention change, new product feature, or bulk import can make old measurements poor predictors, so record those assumptions beside the estimate.

For a planning horizon that includes the time needed to provision storage, calculate:

projected retained data range = current table/index size + (low/high measured net growth per month × horizon in months)
required allocated capacity = (projected retained data + measured maintenance/WAL/temporary-space headroom) ÷ target utilization

Use actual maintenance peaks to estimate bloat, WAL, temporary files, index rebuilds, and backup needs. Set target utilization from your alerting and procurement process. Do not treat a generic 70% or 80% threshold as a universal trigger.

Hypothetical example: A database currently has 500 GB of tables and indexes. Its last three net monthly changes, after retention, were 24 GB, 32 GB, and 40 GB. Storage expansion takes two months, and the next review is six months away, so use an eight-month forecast horizon. The data-only range is 692–820 GB, before measured maintenance and WAL headroom.

After the next month, suppose table and index use is 522 GB and the latest net change is 22 GB. Recalculate with the recent range of 22–40 GB: the eight-month data-only estimate is now 698–842 GB. Add the measured overhead, then divide by the team’s target utilization to get the allocated capacity to plan for. The range is a planning aid; it does not imply growth will stay inside those endpoints.

I/O and storage performance

Measure reads, writes, bytes, latency, checkpoints, and temporary I/O during representative peak periods. Transaction rate or WAL volume alone cannot be converted into storage IOPS: caching, write batching, page writes, and checkpoints affect the result.

For PostgreSQL, use statistics supported by the version you run and compare them with operating-system or managed-service storage metrics. PostgreSQL views change over time; consult the monitoring statistics documentation for the matching release. If a storage tier appears to be the limit, benchmark the intended tier with a workload that resembles production before changing it.

When comparing local and managed storage, include latency, throughput limits, durability, failover behavior, expansion time, and cost. Advertised maximum IOPS or bandwidth may depend on block size, queue depth, volume size, and instance limits. Treat vendor numbers as configuration limits to verify, not as a prediction of database performance.

A repeatable review cycle

Step Record Revisit when
Baseline Data size, peak and normal load, latency, active sessions, storage use A new workload or major release changes the query mix.
Growth Net data change after retention, with low/high observations Retention, customer behavior, or product data changes.
Headroom Maintenance peaks, WAL, backups, rebuilds, and provisioning time Maintenance, recovery, or procurement requirements change.
Forecast Capacity range, target utilization, and assumptions New measurements arrive or the next review date is reached.
Action Query change, pooling, vertical scale, storage expansion, or architecture review Measurements show the current bottleneck or forecast is no longer acceptable.

Set the review date before capacity becomes urgent. Track the rate of change as well as current use: a system with lower utilization but a short provisioning window may need action sooner than a fuller system that can expand quickly.

Further Reading

Conclusion

A useful forecast explains where its numbers came from and when to update them. Measure growth after retention, include observed operational headroom, and account for the time needed to provision the next step. Recalculate as the workload changes instead of carrying forward a fixed projection.

Category

Related Posts

Database Backup Strategies: Full, Incremental, and PITR

Learn database backup strategies: full, incremental, and differential backups. Point-in-time recovery, WAL archiving, and RTO/RPO planning.

#database #backup #recovery

Connection Pooling: HikariCP, pgBouncer, and ProxySQL

Learn connection pool sizing, HikariCP, pgBouncer, and ProxySQL, timeout settings, idle management, and when pooling helps or hurts performance.

#database #connection-pooling #performance

Failover Automation

Automatic failover patterns. Health checks, failure detection, split-brain prevention, and DNS TTL management during database failover.

#database #failover #high-availability