SQL past one server
Keeping tables, joins and transactions when the data or the write load no longer fits on one primary server.
What it asks of a system
A single PostgreSQL or MySQL primary can be scaled up and given read replicas, but every write still goes to one machine. Past that point there are two families. Sharding layers, such as Vitess for MySQL or Citus for PostgreSQL, split tables by a sharding key across many ordinary database servers and route each query to the shards it needs; queries and transactions that stay on one shard are cheap, and the rest cost more or are limited. Distributed SQL databases, such as Spanner, CockroachDB and TiDB, store data as ranges of an ordered key space, keep several synchronous replicas of each range, and split and move ranges between nodes on their own, so any transaction can span any rows.
The questions that separate them: does adding a node move data automatically, or does someone plan a reshard? Are transactions that touch several shards fully atomic and isolated, and at what level? Can a query join tables sharded on different keys? Do schema changes run online? And how compatible is the SQL with the PostgreSQL or MySQL that the application was written for, including the drivers, ORMs and extensions it uses?
Good at it · 7
Compare side by sideRelational databases
Sources
- Vitess docs: Sharding
- Citus docs: Concepts (distributed tables, shards, co-location)
- TiDB docs: Architecture
- CockroachDB docs: Architecture overview
- Corbett et al., Spanner: Google’s Globally-Distributed Database (OSDI 2012)
Why each technology is listed comes from the sources on its own page.