SQLIntermediate#normalization

What is denormalization and when do you use it?

Deliberately duplicating data to avoid expensive joins, typically in reporting or read-heavy analytics workloads. It trades write complexity and storage for read speed.

Example
-- store the total on the order instead of summing items every read
ALTER TABLE orders ADD total_amount DECIMAL(10,2);

Related Questions

1
SQLBeginner#sets

UNION vs UNION ALL?

Open
2
SQLIntermediate#sets

What are INTERSECT and EXCEPT/MINUS?

Open
3
SQLIntermediate#indexes#performance

What is an index? What are the trade-offs?

Open