A URL shortener that stores 1.2 billion links a year sounds like a big-data problem. Its link table is probably the smallest dataset in the system. The click events behind those links can outgrow the table within weeks, and the index that resolves a short code can stop fitting in memory long before the disk fills up.
That gap between intuition and arithmetic is why storage estimation has to come before choosing a database. When teams skip the calculation, they tend to pick an engine for the dataset they picture, not the one they will run. They size disks for logical bytes and then run into the physical ones: row headers, index pages, replicas, write-ahead logs, compaction space, backups, and data that was supposed to expire but never did.
The deceptively hard part is not multiplication. A database stores much more than the logical record, and every layer adds its own multiplier. Those multipliers interact with time, replication, and failure recovery.
This article builds a storage estimation model from first principles. It covers how to move from a logical record to physical bytes, how growth compounds, which overheads dominate at scale, and how the resulting numbers should shape (and sometimes rule out) your database choice.
The Core Problem: Logical Bytes Are Not Physical Bytes
Every storage estimate starts with a simple question: how big is one thing, and how many things will there be? The trouble is that "one thing" exists at several layers at once, and each layer makes assumptions.
Take a short-link record in a hypothetical URL shortener:
| Field | Type | Logical size |
|---|---|---|
| short_code | 7-char string | ~8 bytes |
| long_url | variable string | ~100 bytes (average, assumed) |
| user_id | 64-bit integer | 8 bytes |
| created_at | timestamp | 8 bytes |
| expires_at | timestamp | 8 bytes |
| url_hash (for dedup) | 16-byte hash | 16 bytes |
That comes to about 150 bytes of application data. A row-oriented relational engine does not store 150 bytes, though. In PostgreSQL, for example, each heap tuple carries a header of roughly 23 bytes (padded to 24), each tuple needs a 4-byte line pointer in its page, variable-length fields carry length headers, and columns are aligned to word boundaries. Pages are rarely 100% full, and MVCC leaves dead tuple versions behind until vacuum reclaims them.
Then come the indexes. A B-tree on short_code and another on url_hash each store a copy of the key, a pointer to the heap tuple, and per-entry overhead. Random inserts (which hash-like short codes produce) cause page splits that leave B-tree pages partly empty. A reasonable working assumption for this record is somewhere around 350 to 450 physical bytes per row once you include the heap and both indexes. The exact figure depends on the engine, fill factor, and workload, so it should be measured on a prototype, not trusted from a blog post.
The assumption the whole estimate rests on is that the multipliers are stable. They aren't. A system that updates rows often builds up dead tuples. A system that deletes heavily creates tombstones in LSM-based stores. A table that grows from 100 million to 6 billion rows does more than grow 60x on disk: its index height changes, its working set leaves memory, and its backup and restore times change by the same factor.
That gives the causal chain storage estimation has to capture:
larger dataset → larger indexes → index working set exceeds memory → point lookups go to disk → tail latency rises → connection hold times grow → throughput falls before the disk is anywhere near full
Disk capacity is rarely the first constraint you hit. Usually it's memory relative to index size, I/O relative to compaction, or recovery time relative to dataset size. Storage estimation matters because it predicts which constraint arrives first.
A Framework for Storage Estimation and Data Growth
A useful storage estimate is a product of multipliers applied over a time horizon:
physical_storage =
record_count(t)
× (logical_record_size + engine_overhead)
× (1 + index_factor)
× replication_factor
× (1 + headroom)
+ log_and_backup_storage(t)
Each term deserves its own reasoning.
Record Count Is a Function of Time and Retention
Record count is the term people most often get wrong, because it depends on two different growth models.
Bounded retention (logs, sessions, events with a TTL) reaches a steady state:
steady_state_records = ingest_rate × retention_period
A system ingesting 3,800 events per second with 7-day retention holds about 2.3 billion events, whatever its age. Storage stays flat unless the ingest rate changes.
Unbounded retention (user accounts, links, uploaded media) accumulates forever. If the ingest rate is constant, storage grows linearly. If the ingest rate grows by a fraction g per year, cumulative storage grows geometrically:
cumulative_after_n_years = year_1_volume × ((1 + g)^n − 1) / g
At 50% annual growth in ingest, three years of storage is not 3× the first year's volume. It is 1 + 1.5 + 2.25 = 4.75× the first year's volume. Five years is about 13.2×. That difference decides whether a single-node database lasts the system's lifetime or needs a partitioning strategy planned from the start.
Engine Overhead and Amplification
Storage engines trade space for other properties, and the trade depends on their design.
B-tree engines (most relational databases) update in place. Their space overhead comes from page fill factor, tuple headers, and MVCC versions waiting for cleanup. Space amplification is moderate and fairly predictable, but update-heavy workloads can bloat tables until vacuum or compaction catches up.
LSM-tree engines (RocksDB, Cassandra, ScyllaDB, and many others) write immutable sorted files and merge them in the background. They often compress well, but they need free space to compact. Size-tiered compaction can temporarily need space comparable to the data being compacted, which is why operators have historically kept a large fraction of disk free on such nodes. Leveled compaction lowers space amplification at the cost of more write amplification. Deletes write tombstones that take up space until compaction removes them, and in some systems they are kept deliberately for a grace period so deleted data is not resurrected from a stale replica.
Columnar engines (ClickHouse, BigQuery, Parquet-based lakes) store each column contiguously, so repetitive data like timestamps, country codes, and status enums compresses very well. Compression ratios vary widely with cardinality and data shape. Teams should measure the ratio on representative samples rather than assume a vendor's headline figure.
The mental model is that every engine optimizes one of three amplifications (read, write, space) at the expense of the others. Your storage estimate is therefore partly a statement about which engine family you are considering.
Indexes and Secondary Representations
An index is a second copy of part of your data, kept in a different order. Every secondary index adds storage, adds write cost (each insert updates every index), and competes for memory.
The broader principle is that most systems store the same fact several times: in the primary table, in each index, in a cache, in a search index, in a change-data-capture stream, in an analytics warehouse, and in backups. A link created once in a URL shortener can easily exist in six or more physical representations. Storage estimation that only counts the primary table underestimates by a multiple, not by a margin.
This is also where consistency complexity hides. Every secondary representation is a copy that has to be kept acceptably fresh, so the count of representations is also a count of synchronization paths.
Replication, Erasure Coding, and Durability Overhead
Replication multiplies storage directly. Three-way replication, common in consensus-based and quorum-based systems, triples physical bytes. A cross-region replica set may double that again.
Object storage systems usually reach durability through erasure coding instead. A scheme that splits data into k data fragments and m parity fragments has a storage overhead of (k + m) / k. A 6+3 scheme stores 1.5× the original bytes and survives the loss of any three fragments. Triple replication stores 3× and survives the loss of two copies.
Erasure coding is not free. Reconstruction after a failure reads from many nodes, which increases network traffic during recovery, and small objects cost more relative to their size. That's why databases holding hot, small, frequently updated records tend to use replication, while blob stores holding large immutable objects tend to use erasure coding. The storage multiplier follows from the access pattern.
Enjoying this so far?
Join thousands of engineers receiving practical engineering, Cloud, Distributed Systems, Infrastructure and AI engineering insights.
No spam. Unsubscribe anytime.
Architecture: Three Datasets, Three Growth Curves
Consider a hypothetical link-sharing platform with a URL shortener and user-uploaded images. The architecture is less interesting than the observation that it has at least three datasets with very different growth behavior.
Client
|
v
Load Balancer
|
v
API Service ----------------------------+
| | |
v v v
Cache Metadata DB Object Storage
(hot codes) (links, users, (original images
image metadata) + resized variants)
|
v
Click Event Stream (7-day retention)
|
v
Stream Consumers
|
v
Columnar Analytics Store (raw: 90 days, rollups: indefinite)
Here are illustrative assumptions, worked through.
Dataset 1: Links (unbounded, small records). 100 million new links per month is about 38 writes per second on average, or 1.2 billion rows per year. At ~400 physical bytes per row including indexes, that comes to about 480 GB per year per replica, or ~1.44 TB with three replicas. Five years at constant ingest is about 2.4 TB per replica. That is well within what a single well-provisioned relational primary can hold.
What actually constrains this dataset is the short_code index. At five years, 6 billion entries at roughly 30 to 40 bytes each is 180 to 240 GB of index. If redirects are evenly distributed across old and new links, cache hit rates fall and lookups hit disk. If traffic is skewed toward recent links (typical for shared content), the hot set stays small and a cache in front of the database absorbs most reads. The access distribution matters more than the total size.
Dataset 2: Click events (bounded log, unbounded warehouse). Assume 100 redirects per link created, about 10 billion clicks per month, or ~3,800 events per second on average. At ~150 bytes per raw event, that is roughly 1.5 TB per month before replication. The 7-day event stream holds about 350 GB, or ~1 TB at a replication factor of 3, and stays flat. The analytics store is what grows: about 18 TB of raw events per year before compression and replication.
Within a few months, the "secondary" analytics dataset is several times larger than the link table that justifies the whole system. That is why it belongs in a columnar store with a retention policy (raw events expire after 90 days, aggregated rollups are kept indefinitely) and not in the transactional database.
Dataset 3: Images (unbounded, large objects). Assume 2 million uploads per day at an average of 4 MB, plus resized variants adding ~30%. That is about 10.4 TB per day, or roughly 3.8 PB per year of logical bytes. With 1.5× erasure coding overhead, that is about 5.7 PB of raw capacity. Triple replication would need over 11 PB.
The image metadata (dimensions, owner, storage key, moderation status) at ~1 KB per row is about 730 GB per year. Metadata is roughly 0.02% of the bytes but serves nearly 100% of the queries. Separating blob storage from metadata storage is a direct consequence of the arithmetic, not a matter of taste.
The consistency boundary between them needs explicit design. An upload writes the object first, then commits the metadata row. If the metadata write fails, an orphaned object remains, so a background reconciler has to find and delete objects with no metadata reference. Storage estimation should include the orphan rate, because a 1% failure rate on 10 TB per day is 100 GB of daily garbage.
A short estimator makes these assumptions explicit and reviewable:
def estimate_storage_tb(
records_per_year: float,
bytes_per_record: float, # physical, incl. engine overhead
index_factor: float, # 0.5 = indexes add 50%
replication: float, # 3.0 for RF=3, 1.5 for 6+3 EC
headroom: float, # 0.3 = keep 30% free
annual_growth: float, # 0.5 = ingest grows 50%/yr
years: int,
) -> list[float]:
"""Cumulative physical storage at the end of each year, in TB."""
results, total, yearly = [], 0.0, records_per_year
for _ in range(years):
total += yearly
physical = total * bytes_per_record * (1 + index_factor)
results.append(physical * replication * (1 + headroom) / 1e12)
yearly *= 1 + annual_growth
return results
The value is not the code. The value is that every multiplier is named, so a design review can argue about the assumptions rather than the result.
Tradeoffs: How the Estimate Shapes the Database Choice
Storage estimation doesn't pick a database for you. It removes options that can't work and points out which tradeoffs actually matter.
| Option | Makes sense when | What it makes harder | Behavior at scale |
|---|---|---|---|
| Single relational primary + replicas | Dataset fits on one node for the planning horizon; transactional integrity matters | Vertical ceiling; restore time grows with size | Predictable until working set exceeds memory |
| Partitioned/sharded relational | Dataset or write rate exceeds one node | Cross-shard queries, rebalancing, schema migrations | Scales writes, but hot partitions remain a risk |
| LSM-based wide-column/KV | High write throughput, simple access patterns, TTL-heavy data | Compaction headroom, tombstones, limited ad hoc queries | Scales horizontally; operations dominated by compaction |
| Columnar analytics store | Append-heavy events, aggregate queries | Point updates and deletes are expensive | Compression keeps large histories affordable |
| Object storage + metadata DB | Large immutable blobs | Cross-system consistency, orphan cleanup | Near-unbounded capacity; metadata DB becomes the scaling concern |
Several tradeoffs come up repeatedly.
Retention versus queryability. Keeping raw events forever keeps every future question answerable, but storage cost grows without limit. Rollups bound storage but fix your aggregation dimensions ahead of time. A tiered data retention policy (raw for weeks, hourly aggregates for months, daily aggregates indefinitely) is a decision about which questions the business will be able to answer later.
Normalization versus denormalization. Denormalized records cost more storage per record and multiply update paths, but avoid joins at read time. At scale, storage is usually cheaper than the coordination needed to keep joined data consistent across partitions. That isn't always true, though, and the estimate tells you how much extra storage the denormalization actually costs.
Replication versus erasure coding. Replication gives faster recovery and simpler reads at 2× to 3× cost. Erasure coding cuts overhead but makes recovery heavier on the network. For petabyte-scale media, the difference between the two can exceed the entire cost of the rest of the system.
Compression versus CPU. Heavier compression lowers storage and I/O but costs CPU on every write and read. For cold data, that is almost always worth it. For hot transactional data, it depends on whether the system is I/O-bound or CPU-bound.
Failure Modes and What Happens at Scale
Storage-related failures rarely look like "the disk is full." They show up as secondary effects.
Uneven partitions. Average utilization can be 50% while one partition sits at 95% because a single tenant or key range grew faster than expected. Partition-level estimates, not cluster averages, decide when you fail.
Compaction and vacuum starvation. An LSM node at 85% utilization may not have room to compact, so read amplification climbs as SSTables pile up. A PostgreSQL table where vacuum falls behind keeps dead tuples around and bloats. Both are failures of headroom, not capacity.
Recovery time. Restore time scales linearly with dataset size. Restoring 10 TB at a sustained 500 MB/s takes about 20,000 seconds, or roughly 5.5 hours. If the recovery time objective is one hour, the dataset size itself is a reliability problem, and the fix is partitioning or faster replica promotion, not more disk.
Rebalancing under load. Adding nodes to a partitioned cluster moves data, and that movement uses the same disk and network the live workload needs. Clusters expanded at 90% utilization often degrade during the expansion meant to relieve them.
Behavior changes with scale. Using the ~400-byte link record:
- 10 writes/second is about 315 million rows and ~126 GB per year. One database node, with backups that finish in minutes. Sharding would be premature.
- 1,000 writes/second is about 31.5 billion rows and ~12.6 TB per year per replica. Single-node is possible for a year or two, but index memory, backup windows, and restore time now drive the design.
- 100,000 writes/second is about 3.15 trillion rows and ~1.26 PB per year per replica. Partitioning is mandatory, and retention policy becomes the main storage lever.
Most systems live near the first tier. Complexity is justified when the estimate, not ambition, says so.
Engineering Principles for Database Capacity Planning
Estimate physical bytes, not logical bytes. The record your application sees is the smallest representation of that data anywhere in the system.
Count every representation of the same fact. Indexes, caches, search indexes, event streams, warehouses, and backups are all storage, and each one is a separate path you have to keep consistent.
Retention is an architectural decision, not a cleanup task. Bounded retention creates a steady state. Unbounded retention creates a growth curve that compounds.
The first constraint is rarely disk capacity. Index working set, compaction headroom, and restore time usually fail before the disks fill.
Separate data by access pattern before separating by technology. Large immutable blobs, small mutable records, and append-only events have different growth curves, durability schemes, and query shapes.
Plan headroom as part of capacity, not on top of it. Compaction, vacuum, rebalancing, and failover all need free space at exactly the moments the system is under stress.
Make every multiplier explicit. An estimate with named assumptions can be reviewed, measured, and corrected. A single number cannot.
Final Thoughts
Storage estimation looks like arithmetic, but it is really a way of finding out how a system will behave before it exists. Multiplying records by bytes is the easy part. The real work is seeing that one logical fact becomes many physical copies, that retention policy determines whether growth is flat or compounding, and that the dataset's size eventually shapes its latency, its recovery time, and its operational risk.
Experienced engineers use these estimates to find the constraint that arrives first. Sometimes the answer is that a single relational database will serve the system comfortably for years, which is worth knowing, because it rules out a lot of distributed complexity that would never earn its cost. Sometimes the answer is that a "secondary" analytics stream will dwarf the primary dataset within months and needs its own storage design from the first day.
These are the kinds of engineering problems at the center of modern software systems: knowing where state lives, how it multiplies, how it grows, and what happens to the system once the assumptions behind the original estimate stop holding.
Key Takeaways
- Storage estimation should model physical bytes per record, including engine headers, alignment, page fill factor, and MVCC or tombstone overhead, not just application-level field sizes.
- Bounded retention produces a steady-state dataset (ingest rate × retention period), while unbounded retention with growing ingest compounds; at 50% annual growth, three years of data is 4.75× the first year.
- Indexes, caches, event streams, analytics stores, and backups are each additional representations of the same data, so total storage is often several times the primary table's size.
- Replication multiplies storage by the replication factor, while erasure coding (for example, 6+3 at 1.5×) lowers overhead for large immutable objects at the cost of heavier recovery traffic.
- Index working set exceeding memory, compaction headroom running out, and restore time exceeding the recovery objective usually constrain a system before raw disk capacity does.
- Separating blob storage from metadata follows from the arithmetic: metadata can be a tiny fraction of total bytes while serving nearly all queries.
- A database choice is justified by the storage estimate's growth curve and access pattern; when the estimate fits on one node for the planning horizon, distributed storage is premature complexity.
Get insights like this in your inbox
Join thousands of engineers receiving practical engineering, Cloud, Distributed Systems, Infrastructure and AI engineering insights.
No spam. Unsubscribe anytime.