staff-engineering-skills-denormalization
Installation
SKILL.md
Denormalization Trap
Every copy of data is a consistency obligation. Before duplicating a field to avoid a join, ask: who updates this copy, what happens when the update fails, and how do you detect drift?
Snapshot vs Reference
The first question when copying data: is this a snapshot or a reference?
- Snapshot: The value at a point in time. Correct to copy. Example: the price on an order line item at time of purchase. The product price may change later, but the order price should not.
- Reference: The current value of something. Dangerous to copy. Example: a user's plan name stored on their profile. When the plan changes, every copy is wrong until updated.
If you're copying a reference, you've taken on a consistency obligation. If you can't answer all four questions in the checklist below, don't denormalize.
Consistency Obligation Checklist
For every denormalized field, document: