DevTools Logo

Database Capacity Planner

Database Capacity Planner

Project table, index and WAL growth from row width, writes per day and retention — with every formula visible.

Runs in your browser
Try an example

Schema & indexes

3 columns · 1 indexes

Estimated data width 93 B + 8 B overhead.

Indexes

Storage projection

41.47 GB retained · 2.16 GB WAL/month
WAL is monthly churn, shown separately and never added to retained table size.
Retained rows
144,000,000
Fillfactor ratio
1.00
Table (rows × rowWidth ÷ fillfactor(ratio))
25.92 GB
Indexes (rows × (keyBytes + 8 B TID) × 1.5 B-tree slack)
15.55 GB
WAL/month
2.16 GB
Total retained
41.47 GB
Monthly storage data
MonthTableIndexesWAL
11.08 GB648.00 MB2.16 GB
22.16 GB1.30 GB2.16 GB
33.24 GB1.94 GB2.16 GB
44.32 GB2.59 GB2.16 GB
55.40 GB3.24 GB2.16 GB
66.48 GB3.89 GB2.16 GB
77.56 GB4.54 GB2.16 GB
88.64 GB5.18 GB2.16 GB
99.72 GB5.83 GB2.16 GB
1010.80 GB6.48 GB2.16 GB
1111.88 GB7.13 GB2.16 GB
1212.96 GB7.78 GB2.16 GB
1314.04 GB8.42 GB2.16 GB
1415.12 GB9.07 GB2.16 GB
1516.20 GB9.72 GB2.16 GB
1617.28 GB10.37 GB2.16 GB
1718.36 GB11.02 GB2.16 GB
1819.44 GB11.66 GB2.16 GB
1920.52 GB12.31 GB2.16 GB
2021.60 GB12.96 GB2.16 GB
2122.68 GB13.61 GB2.16 GB
2223.76 GB14.26 GB2.16 GB
2324.84 GB14.90 GB2.16 GB
2425.92 GB15.55 GB2.16 GB

Planning aid only — real engines vary with page layout and TOAST.

The planner turns a row width (typed directly or parsed from a column list), a daily write rate and a retention window into a month-by-month storage projection. Table bytes, per-index bytes and WAL churn are computed by separate, documented formulas so the estimate is auditable rather than opaque. A disk budget adds a crossing-month warning.

Examples

180-byte rows, 2 indexes

Input
200,000 writes/day · 24 months · idx_email 64 B + idx_created 8 B
Output
≈ 25.9 GB table + ≈ 15.6 GB indexes; WAL ≈ 2.2 GB/month

A flagship sizing scenario: table and index bytes are computed separately and WAL is never folded into the retained total.

Column-list parsing

Input
id bigint, location geometry, payload jsonb
Output
8 + 8 + 64 data bytes; geometry flagged as unknown-type assumption

Known types map to fixed widths; heuristics and unknown-type assumptions are surfaced as chips.

Budget warning

Input
disk budget = 100 GB
Output
Crossing month highlighted in the results panel

The crossing is based on retained table+index bytes only, matching the chart's cumulative series.

About this tool

The Database Capacity Planner turns a row width, a daily write rate and a retention window into a month-by-month storage projection. You can type the row width directly or paste a column list (id bigint, email varchar(255), …) and let the parser estimate it, then add index key widths, a fillfactor and a WAL multiplier.

Every number carries its formula. Table bytes are rows × row width ÷ fillfactor ratio; each index is rows × (key bytes + 8-byte tuple ID) × 1.5 B-tree slack; WAL is shown as its own monthly churn line rather than silently accumulated as retained data. The formula sheet next to the results uses the same constants as the code, so the estimate is auditable.

A disk budget adds a crossing-month warning, and the SVG growth chart has a matching data table for screen readers. The estimate is a planning aid: real engines vary with page layout, TOAST and compression, so treat the figures as an order-of-magnitude budget rather than a guarantee.

What this tool does not do

  • Estimates are order-of-magnitude planning aids; real sizes vary with page layout, TOAST, compression and update-driven bloat.
  • Index sizing assumes a generic B-tree with 8-byte tuple IDs; clustered InnoDB secondary indexes carry the primary key instead.
  • WAL is reported as monthly churn only — retained WAL archives and replication slots are not modelled.

How to use this tool

  1. Describe a row

    Type an average row width in bytes, or paste a column list and let the parser map SQL types to widths (with a stated 30% text fill heuristic).

  2. Set the workload

    Enter writes per day, retention in months, fillfactor (50–100) and the WAL multiplier, then add one row per index with its key width.

  3. Read the projection

    The formula sheet shows table, index, WAL and total bytes; the chart and its data table show cumulative growth month by month.

  4. Add a budget

    Enter a disk budget in GB to see the month when retained table and index bytes cross it, then copy or download the summary as Markdown.

Use cases

Pre-launch instance sizing

Estimate a year-one disk footprint before provisioning a database, including index overhead and fillfactor.

Budget planning

Overlay a monthly storage budget and see the month when growth is expected to cross it.

Migration estimates

Parse a target column list and compare retention policies side by side before a migration.

Formula sheet

MetricFormula
Retained rowswrites/day × 30 × retention months
Table bytesrows × row width ÷ fillfactor ratio (50–100 → 0.5–1.0)
Index bytesrows × (key bytes + 8 B TID) × 1.5 B-tree slack, summed per index
WAL per monthwrites/day × 30 × row width × WAL multiplier (churn, not retained)
Total retainedtable bytes + Σ index bytes
Crossing monthfirst month where cumulative retained bytes exceed the disk budget

Generic rows add 8 bytes of overhead; Postgres tuple mode adds a 24-byte header.

Common mistakes

Mistake:Using a raw fillfactor percentage in the formula.

Fix:Fillfactor is a 50–100 percentage; the code normalises by ÷100 before dividing, so 100 means no expansion and 50 doubles the table bytes.

Mistake:Adding WAL churn to the retained total.

Fix:WAL is recycled churn, not accumulating disk. The planner shows it as a separate monthly line; size archives or replication slots separately if you retain them.

Mistake:Treating varchar(255) as 255 bytes per row.

Fix:The parser uses a stated average-fill heuristic (30% by default) and flags it, so swap in a measured average from your data.

Frequently asked questions

How do I estimate row width?

Either type a measured average in bytes or paste a column list. The parser maps fixed-width types (bigint 8 B, int 4 B, uuid 16 B, timestamp 8 B) and uses a stated 30% average-fill heuristic for text and varchar(n) — change it from measured data for better accuracy. Unknown types are flagged and assumed to be 8 bytes. Add generic 8-byte overhead, or 24 bytes for the Postgres tuple-header mode.

How much overhead do B-tree indexes add?

Each index row stores the key bytes plus an 8-byte tuple ID (or row pointer), multiplied by 1.5 for typical B-tree page slack at roughly 67% occupancy. Composite keys sum their column widths. The planner shows this formula beside each index's byte total, and unique indexes are noted separately because they do not need duplicate-key slack.

Does WAL count toward disk usage?

WAL files are recycled, so churn does not accumulate as retained disk the way table rows do. The planner reports WAL as a separate monthly figure — writes/day × 30 × row width × multiplier — and never adds it to the retained total. If you retain WAL archives for point-in-time recovery or replication slots, size those separately using your retention policy.

What is fillfactor and how does it change totals?

Fillfactor reserves free space on each page for future updates. The input is a 50–100 percentage, normalised by dividing by 100: table bytes are rows × row width ÷ that ratio. At 100 there is no expansion; at 90 the table is about 11% larger; at 50 it doubles. Values outside 50–100 are clamped and warned about.

Is the estimate engine-specific?

The core formulas are engine-neutral: table bytes, index bytes and WAL churn from row width and write rate. The parser offers a generic 8-byte row overhead and a Postgres-style 24-byte tuple header. InnoDB stores rows in the clustered primary-key index and secondary indexes carry the primary key rather than a tuple ID, so MySQL totals need that adjustment — the tool states this rather than pretending the models are identical.

References & standards