Course contentsShow
← Databases & SQL
Lesson 676 of 1,9536. Query Performance and IndexingFree lesson

Normalization vs Denormalization

Assess the impact of data duplication on index maintenance and query join complexity.

In this lesson, you will learn how the choice between normalization and denormalization fundamentally changes how indexes are maintained and how complex your query joins become.

The Normalization Approach

Normalization aims to store each piece of data in exactly one place. If you have an Orders table and a Customers table, the CustomerName lives only in the Customers table.

  • Index Maintenance: Because data exists in one place, updating a customer's name involves updating one row. Your indexes only need to update the entry for that specific row.
  • Query Complexity: To display a report of orders with customer names, the database must perform a JOIN. As you’ve learned in our performance modules, frequent joins increase CPU overhead, especially if the join columns aren't perfectly indexed.

The Denormalization Approach

Denormalization intentionally introduces data duplication—for example, storing CustomerName directly inside the Orders table.

  • Index Maintenance: This is where the hidden costs arise. If a customer changes their name, you must now update every order row associated with that customer. Every UPDATE statement forces the database to maintain index entries for every affected row. This increases I/O and potential lock contention, which we previously discussed in our lessons on index-locking granularity.
  • Query Complexity: The benefit here is simplicity. You can fetch your report with a simple SELECT from the Orders table, completely bypassing the need for expensive JOIN operations.

The Balancing Act

The decision rests on your read-vs-write ratio. If your system is "read-heavy," denormalization might save you from the massive performance penalty of constant JOIN operations. However, if your system is "write-heavy," the overhead of updating duplicated data—and the subsequent cost of maintaining those bloated indexes—will significantly slow down your ingestion performance.

When you denormalize, you aren't just saving a join; you are trading off "read speed" against "write maintenance cost." Always consider if the performance gain of a single SELECT is worth the increased background work your indexes must do every time the data changes.

Key Takeaway: Normalization minimizes index maintenance overhead, while denormalization minimizes query join complexity at the expense of write-heavy maintenance costs.