"Normalize until it hurts; denormalize until it works"
summary
Advice: normalize until redundancy causes anomalies then selectively denormalize with patterns and tools. It defines three denormalization patterns EXTEND, AGGREGATE, FETCH and shows concrete implementations: expression indexes and Postgres functions for EXTEND, materialized views or django-pgviews and triggers or django-denorm for AGGREGATE, and explicit tasks or field-tracking (django-model-utils or django-lifecycle) for FETCH. It warns historical fields (order totals, slugs, shipment addresses) must remain immutable, to profile before changing schema, and to accept eventual consistency when using cronjobs or celerybeat.
AI-written summary · about
chapters (12)
- 0:00Introduction and context
- 1:03Normalization basics and anomalies
- 3:30Simpler view of normalization
- 4:56Normalization in Django
- 6:41Historical data vs normalization
- 8:55Query expressions to avoid denormalization
- 12:11Denormalization patterns overview
- 13:16EXTEND pattern explained
- 15:22AGGREGATE pattern explained
- 19:23FETCH pattern explained
- 21:59Concurrency and profiling tips
- 22:43Advanced denormalization ideas
