Web apps & software

What is database normalization?

Database normalization is the practice of splitting data into related tables so every fact lives in exactly one place. It prevents contradictions, such as one customer having two different phone numbers across their orders.

The idea through an example

An orders table that repeats the customer's name, address and phone on every row invites trouble: change the address once and old rows disagree. Normalizing moves customers into their own table, and each order stores only a customer id.

The first three forms

  • First normal form: each cell holds one value, not a comma-separated list of items.
  • Second normal form: every column depends on the whole key, not just part of a composite key.
  • Third normal form: columns depend on the key and not on other non-key columns, so a city name is not stored beside a postcode that already determines it.

When to bend the rules

Reporting databases and read-heavy features sometimes denormalize on purpose, copying values into one wide table so queries need fewer joins. The trade is extra storage and the risk of copies drifting apart. Start normalized, then denormalize only where measurements show a need.

Questions, answered

It adds joins, which are fast with proper indexes. Slowness usually comes from missing indexes, not normalization.

Document stores often embed related data on purpose, which is a deliberate form of denormalization.

By the Stegnor team · Updated