All concepts

Normalization vs Denormalization

Store each fact once so it can never disagree with itself — or copy it everywhere so nobody has to join.

DE Foundations · Beginner · ~5 min

In plain English

Write your address in one address book and everything points at it, or write it on every envelope. The first is easy to change; the second is faster to post.

Why it's worth your time

It's the reason the warehouse schema shouldn't look like the app schema, and the reason copying data can be correct rather than sloppy.

If you remember three things

  • Normalize for writes and correctness; denormalize for reads
  • In a warehouse the duplicate is a snapshot, not a stale copy
  • Denormalize toward the query, not toward every column

Overview

Normalization removes duplication: every fact lives in exactly one place, so updating a customer's address is one write and there is no way for two copies to disagree. That is precisely what a transactional system needs. Denormalization does the opposite: it copies the address next to every order, so a query that wants both reads one table. That is precisely what an analytical system needs, because the join it avoids would otherwise shuffle terabytes across a cluster. The rule is not 'normalize good, denormalize bad' — it is that normalization optimises for writes and correctness, denormalization optimises for reads, and you pick per system based on which one you do more of.

In an interview

Normalization stores every fact exactly once, so writes are cheap and updates can't create contradictions — right for OLTP. Denormalization duplicates data so reads need no joins — right for OLAP, where reads dominate and the duplicated copy is immutable history anyway. The cost of denormalizing is that a change has to be rewritten everywhere it was copied.

Production defaults

Staging layer
keep the normalised copy even after building wide tables — it's what you rebuild from
Rebuild, don't patch
regenerate denormalised tables from source on a schedule

What breaks

  • A denormalised attribute disagrees with the source — You copied mutable state and never refreshed it. Either rebuild it or version it as a Type 2 attribute.

Watch it explained

Normalization vs. Denormalization (Hands On) | Events and Event Streaming — Confluent, 2:12

Related