Interview Databases & Caching

What is database normalisation, and when would you denormalise?

Databases & Caching · Intermediate level

Answer

Normalization reduces duplication and update anomalies by modeling entities in separate related tables. Denormalization intentionally duplicates or precomputes data for read performance, but it adds consistency and reconciliation work.

Technical explanation

Normalization reduces duplicated facts and prevents update anomalies.

Denormalization improves specific reads but creates consistency and reconciliation work.

The normalized OLTP schema can remain source of truth while read models, materialized views, or caches serve optimized reads.

Hands-on example

Example denormalization:

orders(customer_id) references customers(id).

Add orders.customer_name_at_purchase for immutable order history.

Backfill:

UPDATE orders o SET customer_name_at_purchase = c.name FROM customers c WHERE c.id = o.customer_id;

Preparing for an interview?

Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.

More Databases & Caching interview questions

← All Databases & Caching questions