Relational vs NoSQL Data Modeling
Compare SQL ACID guarantees against Document, Key-Value, Wide-Column, and Graph databases to choose the optimal persistent storage model.
No single database engine satisfies every engineering requirement in a large-scale distributed system. The era of defaulting to a monolithic relational database for all data models is over.
Modern software architectures embrace polyglot persistence: selecting the specialized storage engine whose underlying data model and concurrency guarantees match the exact access patterns of each microservice.
Understanding when to choose a relational database versus one of the four distinct NoSQL families prevents costly data migrations and architectural dead ends.
01The Relational Model: ACID and Normalization
Relational databases (such as PostgreSQL, MySQL, and Oracle) organize information into structured two-dimensional tables with rows and columns. They enforce strict schemas, primary keys, and foreign key constraints.
The ACID Guarantee
The defining strength of relational databases is strict adherence to ACID properties:
- Atomicity: All statements within a transaction either commit completely or roll back entirely. If a payment service debits an account and credits a merchant, both operations succeed or neither takes effect.
- Consistency: Transactions transition the database from one valid state to another, strictly enforcing all defined constraints, foreign keys, and unique indices.
- Isolation: Concurrent transactions execute without interfering with one another, preventing dirty reads and phantom updates through configurable isolation levels.
- Durability: Once a transaction commits, its modifications are permanently recorded to disk in a write-ahead log (WAL) and will survive power failure or crash.
Normalization and Joins
Relational data modeling emphasizes normalization: decomposing complex entities into distinct tables (such as users, orders, and line_items) to eliminate redundancy and maintain a single source of truth.
When applications need combined views, they execute relational JOIN operations. In a single-node database, joins are fast because the engine navigates indexed memory and disk pages. However, as data scales beyond a single physical server, executing joins across partitioned network boundaries becomes exceptionally slow and complex.
Loading the rest of the lesson…