Careeroza
Denormalization
What is Denormalization?
Denormalization deliberately adds redundancy back, to make reads faster by avoiding joins or repeated calculations. It is a trade-off, made after normalizing and measuring.
Common Techniques
- Store a computed total:
Orders.TotalAmountinstead of summingOrderDetailsevery time. - Copy a frequently-read value:
Orders.CustomerNamefor invoices that must show the name at the time of purchase. - Summary / reporting tables and materialized views.
- Star schemas in data warehouses (fact tables + wide dimension tables).
Normalized vs Denormalized
| Normalized | Denormalized | |
|---|---|---|
| Redundancy | minimal | intentional |
| Writes | simple, consistent | must keep copies in sync (triggers, jobs) |
| Reads | more joins | fewer joins, faster |
| Typical use | OLTP (transactional apps) | OLAP (reporting, analytics) |