During my decades as a database application developer, I never imagined in my wildest dreams that I would ever have access to a transactional, planet-scale, distributed database, much less that I would be comparing many of them. But with Google Cloud Spanner, CockroachDB, Azure Cosmos DB, Neo4j Enterprise, and most recently YugaByte DB all available in production, that one-time pipe dream is now quite real.
In broad terms, Google Cloud Spanner offers a scalable, distributed, strongly consistent SQL database as a service that can handle around 2,000 writes per second and 10,000 reads per second, per node, with a median latency of about five milliseconds. To speed up reads that don’t need absolutely up-to-date data, you can ask Spanner for stale reads, since it supports time-travel queries. Spanner uses a Google dialect of SQL and runs only on the Google Cloud Platform.
CockroachDB is a Spanner-like, open-source SQL database that supports the PostgreSQL wire protocol and PostgreSQL SQL dialect. CockroachDB is built on top of RocksDB, an open-source transactional and consistent key-value store. Like Spanner, it supports time-travel queries. CockroachDB can run on any cloud, in Docker containers with or without orchestration, or on Linux servers or VMs. The enterprise version of CockroachDB adds geo-partitioning, role-based access control, and support.
Azure Cosmos DB is a globally distributed, horizontally partitioned, multimodel database as a service. It offers four data models (key-value, column family, document, and graph) and five tunable consistency levels (strong, bounded staleness, session, consistent prefix, and eventual). It offers five API sets: SQL (dialect), MongoDB-compatible, Azure Table-compatible, graph (Gremlin), and Apache Cassandra-compatible. It only runs on the Microsoft Azure cloud.