Data Modeling
Entities, normalization, schema evolution
- 00 Data Modeling — Roadmap Ten chapters that take you from 'what's a primary key' to deliberate schema design under load — keys, normalization, denormalization, constraints, multi-tenancy, JSONB, and zero-downtime evolution. beginner 5 min →
- 01 What data modeling is Schema design is the most expensive thing you ship. The columns you pick on day one outlast every framework, every refactor, every rewrite. Modeling well is mostly thinking before typing CREATE TABLE. beginner 10 min →
- 02 Entities, attributes, relationships Before SQL, before ORMs, draw the boxes and lines. ER thinking is twenty minutes that saves a year of refactoring. beginner 11 min →
- 03 Keys The primary key is the most expensive choice in your schema. Pick wrong and you spend years working around it. Pick right and you forget it exists. beginner 12 min →
- 04 Normalization 1NF, 2NF, 3NF — three rules that prevent the same data from being recorded twice. Ignore them and your schema rots from the inside as data drifts out of sync. beginner 12 min →
- 05 Denormalization Sometimes the same fact lives in two places on purpose. Done well, it makes hot queries fly. Done badly, it creates the exact drift normalization was designed to prevent. intermediate 11 min →
- 06 Constraints The schema is your last line of defense against application bugs. Constraints encode the rules that should always be true — Postgres enforces them whether your app remembers to or not. intermediate 12 min →
- 07 Time and soft delete Timestamps that survive time zones, soft delete that doesn't poison every query, and history tables that answer 'what did this look like last Tuesday?' intermediate 12 min →
- 08 Multi-tenancy Three architectures for serving many customers from one app: single database with a tenant column, schema per tenant, or a database per tenant. Each has a different cost curve. intermediate 12 min →
- 09 JSONB and the schemaless trap JSONB is one of Postgres's best features. Used well, it's how you stop fighting your schema. Used badly, it's how you end up with a schemaless mess inside a relational database. advanced 12 min →
- 10 Schema evolution Every schema change against live data is a deploy. The expand/contract pattern is how you change tables that have a million rows and a thousand concurrent writers without downtime. advanced 13 min →