← Lessons

quiz vs the machine

Silver1120

Databases

Denormalization

Trading redundancy for read speed when joins get expensive.

4 min read · intro · beat Silver to climb

When You Reverse Normalization

Denormalization deliberately stores redundant copies of data to make reads faster. Instead of joining many normalized tables on every request, you precompute and store the combined result.

Common Techniques

  • Duplicating columns so a read needs one table, not three.
  • Precomputed aggregates like a cached order total or comment count.
  • Materialized views that store a query result and refresh on a schedule.

The Tradeoff

  • Reads get faster and simpler.
  • Writes get harder because each fact lives in several places.
  • You must keep copies consistent, often through triggers or background jobs.

Denormalize only where measured read pressure justifies it. Premature denormalization spreads bugs across stale copies that are hard to reconcile.

Key idea

Denormalization speeds reads by storing redundant data, but shifts the burden onto writes that must keep every copy consistent.

Check yourself

Answer to earn rating on the learn ladder.

1. Denormalization primarily improves:

2. The main risk of denormalization is: