Skip to content

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.