Choosing a data model at a system-design level
coreintermediateThe choice between a relational database and a non-relational one is not "which is better" — it is which trade-offs a specific workload can afford. Relational buys strong consistency, joins and constraints, at the cost of harder horizontal scaling for writes. Non-relational buys easier horizontal scaling and schema flexibility, at the cost of weaker built-in consistency guarantees and no cross-collection joins.
Think of it as
A relational database is like a well-organized library with a strict card catalog — every book's location is guaranteed correct and cross-referenced, but reorganizing the whole library to add a new wing is a serious undertaking. A non-relational store is like many independent reading rooms that can each grow on their own — easy to add more rooms, but nothing guarantees a book you expect to find cross-referenced in another room actually is, and you look it up differently in each.
What we're doing: Show the same system using both models deliberately, for different reasons, rather than picking one for everything.
- 3
- This is the relational case: a transaction has to touch multiple entities atomically.
- 9
- This is the non-relational case: independent writes at very high volume, no transaction needed.
Why this works: The decision is made per workload, not once for the whole system — a design that forces every workload into one model pays for a trade-off it did not need to accept.
Picking a data model based on general reputation rather than the workload's actual requirement
Wrong
Better
What you see: A payments or inventory system built on a store with weak cross-entity transaction guarantees develops subtle correctness bugs — double charges, negative inventory — that a relational database's ACID guarantees would have prevented by construction.
Why: "Scales better" is true for a specific access pattern (independent, high-volume writes), not universally. A workload that genuinely needs atomic multi-row transactions gives that guarantee up by choosing a store that doesn't provide it, regardless of that store's other strengths.
- Relational
- Strong consistency, native joins
- Multi-row transactions across entities
- Harder to shard writes
- Non-relational
- Flexible, per-record schema
- Easier horizontal write scaling
- Weaker built-in joins and consistency
The trade-off, at a system-design level
Together
Remember: Relational buys strong consistency and joins at the cost of harder write-sharding; non-relational buys easier write-scaling and schema flexibility at the cost of weaker built-in joins and consistency — choose per workload, not once for the whole system.
See also: postgresql as rdbms · workload types

