Slowly Changing Dimensions
How to handle dimension data that changes over time — three strategies, three trade-offs.
Slowly Changing Dimensions (SCDs) deal with the question: what do we do when a dimension attribute changes?
A customer moves to a new city. An employee changes departments. A product gets a new category. How do we update the dimension table? Do we overwrite? Keep history? It depends on what the business needs to know.
The three classic types
Type 1 — Overwrite
Simply replace the old value with the new one. No history retained.
Pros: Simplest. Minimal storage. Always shows current value.
Cons: No history. Past reports become incorrect (historical sales now attributed to wrong department).
Use when: Corrections (fixing typos), attributes where history doesn't matter.
Type 2 — Add new row
Add a new row for the changed record, with effective date ranges. Keeps full history.
Pros: Complete history. Past reports remain accurate. Standard for data warehouses.
Cons: Table grows over time. More complex queries (need date filtering).
Use when: History matters — most analytics scenarios.
Querying Type 2 dimensions
Type 3 — Add new column
Add a new column to store the previous value. Limited history — only what fits in the columns you add.
Pros: Limited history without row explosion. Both values queryable in same row.
Cons: Only tracks the previous value (not the one before that). Schema changes if you want more history.
Use when: You only need "current vs previous" — rare in practice.
Side-by-side comparison
| Aspect | Type 1 | Type 2 | Type 3 |
|---|---|---|---|
| Approach | Overwrite | Add new row | Add new column |
| History | None | Full | Limited |
| Storage | Smallest | Grows over time | Wider rows |
| Query complexity | Simplest | Need date logic | Simple |
| Past report accuracy | Broken | Preserved | Preserved (last change) |
| Real-world frequency | Sometimes | Most common | Rare |
Other SCD types (mentioned for completeness)
- Type 0 — Never change. Use for date of birth, original signup date.
- Type 4 — Maintain a separate history table.
- Type 6 (hybrid) — Combination of Type 1, 2, and 3. Used when you want "current" and "as-of-transaction" simultaneously.