CodeBlanks Logo Icon CodeBlanks

Denormalization

Learn the deliberate repeat scenario.

Denormalization

Denormalization adds deliberately copied columns to a normalized table to speed up reads. Writes get more costly but read queries simplify.

-- orders tablosuna customer_name ekle
-- JOIN gereği azalır, okuma hızlanır

Denormalization speeds up reads.

Denormalization — details

Denormalization helps in reporting and OLAP workloads. In OLTP systems it is used with care due to write anomaly risk.

Practice Denormalization

Add a customer_name TEXT column to orders for denormalization.

Starter code

query.sql
-- denormalization
ALTER TABLE orders

Sample solution

query.sql
ALTER TABLE orders
ADD COLUMN customer_name TEXT;

Expected output

ALTER TABLE

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Add a column to the table

Question
ALTER TABLE orders ADD COLUMN ____ TEXT
Answer
ALTER TABLE orders ADD COLUMN customer_name TEXT

Explanation: customer_name is the right answer.

2 Denormalization: match the terms

Term Meaning
normalize split
denormalize merge
OLAP report
OLTP transaction

3 What does denormalization increase?

  • Write speed
  • The number of tables
  • Read speed Correct answer
  • It reduces disk size

Explanation: Denormalization increases read speed.

All lessons in Expert