Normalization Organizing a DB to reduce redundancy by dividing tables into smaller related tables, establishing relationships using foreign keys. This requires queries with need for joins.

Denormalization Denormalization is process of combining related tames to reduce number of joins needed. This improves read performance by introducing some redundancy, but can lead to increased storage usage, and potential inconsistencies when updating data.

Normalized Schema

Customers Table

customer_idnameemail
1Alicealice@email.com
2Bobbob@email.com
Orders Table
order_idcustomer_idorder_datetotal_amount
10112024-02-20$50
10222024-02-21$30
  • Data is stored efficiently
  • Joins slow down read performance, especially with large tables

New Orders Table (Denormalized)

order_idnameemailorder_datetotal_amount
101Alicealice@email.com2024-02-20$50
102Bobbob@email.com2024-02-21$30
  • Faster reads (no join needed, direct query to one table)
  • Redundancy (Customer details are duplicated in every order)
  • Slower writes (if Alice changes her email, all rows need updating)

Impact Analysis

OperationBefore (Normalized)After (Denormalized)
Read Performance❌ Slower (requires JOINs)✅ Faster (no JOINs)
Write Performance✅ Faster (update in one table)❌ Slower (update multiple rows)
Storage Efficiency✅ Less redundancy❌ More redundancy

Databases