Back to feed
Dev.to
Dev.to
5/9/2026
You need foreign keys and surrogate keys because you broke your relationships

You need foreign keys and surrogate keys because you broke your relationships

Short summary

Normalization decomposes cohesive domain aggregates (orders with line items) into separate tables, creating artificial need for foreign keys and surrogate keys to reconstruct consistency. Document databases preserve aggregate structure, avoiding row-level locks and referential constraints. Key tradeoff: data redundancy elimination versus aggregate coherence—choose based on query patterns and consistency needs, not just domain relationships.

  • Normalization decomposes domain aggregates into independent tables, forcing need for foreign keys and surrogate keys
  • Document databases keep aggregates whole, avoiding schema fragmentation and associated locks/constraints
  • Fundamental tradeoff: redundancy elimination versus aggregate boundary coherence and transaction scope

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more