13.5. Distributed SQL: Spanner & CockroachDB
Distributed SQL is the category that refused the trade-off everyone said was mandatory: it delivers horizontal scale and strong consistency and familiar SQL transactions at once. It does so by combining nearly every mechanism in this handbook — consensus per shard, synchronized clocks, two-phase commit layered over Raft groups. This chapter reads Spanner and CockroachDB as the two landmark implementations, showing how TrueTime and hybrid logical clocks solve global ordering and how distributed transactions are made practical over consensus.
Topics Covered
Section titled “Topics Covered”- 13.5.1. Spanner: TrueTime, Paxos Groups, and External Consistency: Covers Spanner’s use of TrueTime, Paxos groups, and the external consistency it uniquely guarantees.
- 13.5.2. CockroachDB: Raft, HLC, and Parallel Commits: Explains how CockroachDB combines Raft, hybrid logical clocks, and parallel commits without atomic clocks.
- 13.5.3. Distributed Transactions in Practice: 2PC over Consensus: Covers making distributed transactions practical by layering two-phase commit over consensus groups.
- 13.5.4. Follower Reads and Bounded Staleness: Explains follower reads and bounded staleness that scale reads without violating consistency.