1.Choosing a data model at a system-design level
The 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.
Key features
- Relational (PostgreSQL/MySQL): strong consistency, joins, constraints — scales reads easily, writes harder to shard
- Non-relational (MongoDB-style document, key-value, wide-column, graph): flexible schema, easier horizontal write scaling
- The generic mechanics of each model (SQL joins, document embedding, ACID, indexing) belong to the PostgreSQL, MySQL or MongoDB roadmap, not here
- The system-design-specific question is which trade-off a given workload's access pattern and consistency requirement can actually afford
- A single system commonly uses both — relational for the transactional core, non-relational for a specific high-write or flexible-schema workload
The trade-off, at a system-design level
- 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
Command
relational: strong consistency + joins, harder write-sharding
non-relational: flexible schema + easier write-sharding, weaker built-in joinsRelational 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.