Normalise, then denormalise on purpose
Normalisation says: store each fact exactly once. Denormalisation says: store it several times so reads get cheap. Presented as rivals, they're actually a sequence — normalise first, then denormalise specific things, on purpose, with your eyes open. Let's see why that order matters and what each step costs.
Why normalise first: one fact, one home
A user's display name lives in exactly one row of the users table. Everything else — posts, comments, orders — points to it by ID. The payoffs are quiet but profound: an update touches one row (rename once, done, instantly true everywhere); and it is structurally impossible for two copies to disagree, because there's only one copy. No sync jobs, no drift, no "why does the app show my old name here but not there." This is the correct default, and you should need a named reason to leave it.
The moment denormalisation earns its keep
Your feed screen renders 50 posts, and each needs the author's name and avatar. Normalised, that's a join to users on every single render — millions of times a day, for data that changes approximately never. So you break the rule deliberately: copy author_name and author_avatar onto each post row. The join vanishes; the read path becomes a single sweep down one table.
Now read the bill, in full, because signing it unread is the actual sin:
- When a user renames themselves, you must update every post they ever wrote — one write became thousands.
- That fan-out is too slow inline, so it becomes a background job — a new moving part you own, monitor, and debug.
- Between the rename and the job finishing, old and new names coexist — you have accepted a window of inconsistency, by design.
That's the honest shape of the trade: cheap, fast reads in exchange for expensive, eventually-consistent writes. For a feed — read a thousand times per write, where a briefly stale name harms no one — it's a great trade. The skill is not avoiding the trade; it's pricing it.
Counters: the same trade in miniature
SELECT COUNT(*) FROM likes WHERE post_id = ? on a post with two million likes is a scan of two million rows — at read time, on your hottest content. Nobody does that twice. Instead: a like_count column on the post, incremented in the same transaction as each like. It's denormalisation (the count is derivable, you're storing it anyway), and it needs the standard chaser: a periodic reconciliation job that recomputes true counts and fixes drift — because drift will happen (crashed transactions, migrations, bugs), and a plan for it beats a mystery about it. The general pattern — precompute a summary, maintain incrementally, reconcile periodically — scales all the way up to materialised views.
The reversibility lens
Here's a tool for judging risk that you'll reuse all the way through Tier 14: how hard is this decision to undo? Denormalisation is genuinely reversible — drop the copied column, restore the join, done in an afternoon. Sharding (Tier 4) is not — unwinding it is a migration project measured in quarters. Reversible optimisations can be tried on evidence as thin as a hunch; irreversible ones demand measurement and a written justification. Prefer the reversible move at every fork where it's available.
Denormalising for a query nobody actually runs. Every duplicated field is a consistency bug waiting for the one code path that forgets to update it — that's the standing cost, paid whether or not anyone benefits. The discipline: copy a field only when you can point at the specific hot query it makes cheap, with its frequency. "Might speed things up" is how databases fill with landmines.