CHAPTER 1 / 8
Relational models and consistency
The strength of the relational model lies less in its tabular shape than in separating logical relationships and constraints from physical storage.
Why this concept became necessary
Primary keys, foreign keys, and constraints let multiple applications share the same data rules. A transaction commits or rolls back related changes as a single unit, controlling the exposure of intermediate states.
A schema does not obstruct change; it reveals which changes break the existing contract. However, a fixed schema and joins are not optimal for every access pattern, so measure workloads and scaling conditions.
The strength of the relational model lies less in its tabular shape than in separating logical relationships and constraints from physical storage.
Declarative queries, constraints, and transactions enforce data relationships and consistency in the database.
Inject invalid rows that attempt to bypass constraints and concurrent transactions, then verify rejection and rollback.
Follow it through a concrete system
In an order system, a foreign key that prevents `orders.customer_id` from referencing a nonexistent customer is a stronger shared rule than validation on a single screen. The constraint applies consistently even when admin tools, batch jobs, and new mobile APIs all use the same database. A unique constraint prevents duplicate storage of the same payment identifier, while a check constraint enforces allowed quantity or status values close to the data.
A transaction defines externally visible state transitions rather than merely grouping queries for speed. If order creation fails after inventory is reduced, both changes must roll back. When two users order the last item in stock at the same time, you must understand which outcomes the isolation level and locking strategy permit. Using a transaction alone does not eliminate every concurrency problem.
Schema migration does not end with adding a column. In a rolling deployment where old and new application versions coexist, you may need to add a compatible column, backfill data, switch the read path, and strengthen constraints last. Validation and index builds on large tables can introduce locks and I/O, so measure duration and blocking scope at realistic data volumes.
There are also conditions where a relational model is not the right choice. If most access reads and writes an entire aggregate rather than focusing on relationships and transactions, if the schema changes rapidly, or if cross-region availability is a strong priority, another storage model may be simpler. However, compare query plans, cardinality, consistency requirements, and recovery approaches on the same workload rather than splitting storage based only on an assumption that joins are slow.
Selection criteria and failure boundaries
Costs include migrations, locks, scaling topology, and rigorous modeling.
Misconceptions to avoid: It is incorrect to assume that an RDB is merely a spreadsheet and cannot scale.
Verify it yourself
Inject invalid rows that attempt to bypass constraints and concurrent transactions, then verify rejection and rollback.
Official sources for this chapter
The technical facts in the text were reviewed against the following primary sources. The author reconstructed the diagrams and comparisons using these materials.
- IBM Research, 「A Relational Model of Data for Large Shared Data Banks」Review date 2026-08-28 · Scope Original 1970 paper
- PostgreSQL Global Development Group, 「Constraints」Review date 2026-08-28 · Scope PostgreSQL 18 / current
- PostgreSQL Global Development Group, 「Concurrency Control: Introduction」Review date 2026-08-28 · Scope PostgreSQL 18 / current