Denormalization is the process of intentionally adding redundancy into a database — basically undoing some of the normalization — in order to improve read performance.
Key Idea:
- In normalization, we split data into multiple related tables to reduce redundancy.
- In denormalization, we combine tables or add redundant columns to make reads faster (at the cost of some redundancy).
Why Denormalize?
- Performance:
- Complex queries in a fully normalized database might require multiple
JOINoperations. - Joins are expensive — they cost time and resources.
- Denormalization can speed up queries by reducing or eliminating joins.
- Complex queries in a fully normalized database might require multiple
- Simpler Queries:
- Fewer joins mean easier, faster queries.
- Precomputed Data:
- Sometimes, denormalization involves storing computed values like totals, counts, or derived data to avoid recalculating them.
Example
Normalized Tables (good design, normalized to 3NF):
Customers
| customer_id | customer_name |
|---|---|
| 1 | Alice |
| 2 | Bob |
Orders
| order_id | customer_id | order_date |
|---|---|---|
| 101 | 1 | 2025-06-01 |
| 102 | 2 | 2025-06-02 |
To get the customer’s name with the order:
SELECT o.order_id, c.customer_name, o.order_date
FROM Orders o
JOIN Customers c ON o.customer_id = c.customer_id;
Denormalized Table:
| order_id | customer_id | customer_name | order_date |
|---|---|---|---|
| 101 | 1 | Alice | 2025-06-01 |
| 102 | 2 | Bob | 2025-06-02 |
Now:
customer_nameis stored redundantly in theOrderstable.- No
JOINneeded to fetch the customer name!
But:
- If Bob changes his name, you have to update it everywhere Bob’s name appears — risk of inconsistency.
Advantages vs Disadvantages
| Advantages | Disadvantages |
|---|---|
| Faster reads (less joins). | Redundancy — same data in many places. |
| Simpler queries (fewer joins to write). | Harder to update — more maintenance. |
| Precomputed values can improve speed. | Risk of inconsistencies. |
| Better for reporting, analytics systems. | More storage space used. |
In Simple Words:
- Normalization = Break apart to avoid redundancy. Good for updates and data consistency.
- Denormalization = Copy data around to make reads faster. Good for performance and speed.
In Simple Words:
- Normalization = Break apart to avoid redundancy. Good for updates and data consistency.
- Denormalization = Copy data around to make reads faster. Good for performance and speed.
Real-World Analogy
- Normalized: You have one file cabinet for customers, another for orders — to find a customer’s order, you cross-reference both.
- Denormalized: You make a folder for each order and also write the customer name on each one — easier to find, but if the customer changes their name, you have to update every folder manually!