Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Overview

Google Cloud Spanner is a globally distributed, horizontally scalable, strongly consistent relational database (often categorized as NewSQL). It combines relational schemas, SQL queries, and full ACID transactions with horizontal sharding and synchronous multi-region replication across datacenters. Spanner supports both its native GoogleSQL dialect and a PostgreSQL interface (including PGAdapter for standard PostgreSQL drivers and tooling).

Architecture & TrueTime

In the OSDI 2012 paper, Google described how Spanner achieves global consistency at scale:

Spanner and the CAP Theorem

Under the CAP theorem (Consistency, Availability, Partition tolerance):

Alternatives & Comparison

If you are already on Google Cloud and want zero-ops global strict serializability with a 99.999% SLA, Google Cloud Spanner is the gold standard. If you need multi-cloud portability, self-hosting, or open-source licensing without specialized atomic-clock hardware, YugabyteDB (PostgreSQL-compatible, Apache 2.0 core) and TiDB (MySQL-compatible, Apache 2.0) are the strongest open-source alternatives, while CockroachDB offers a mature PostgreSQL-compatible distributed SQL engine under a source-available license.

Table 1:Distributed SQL Database Comparison

Distributed SQL Database

Status

Clock / Time Sync

SQL Dialect

Open Source?

Language

License

Popularity (Stars)

Google Cloud Spanner

Active

TrueTime (GPS + atomic clocks)

GoogleSQL, PostgreSQL

N

C++ (proprietary)

Proprietary (Managed)

N/A

YugabyteDB

Active

Hybrid Logical Clocks (HLC)

PostgreSQL (YSQL), YCQL

Y[1]

C++ / C

Apache-2.0 (Core)

~10.7k ★

TiDB

Active

Placement Driver TSO

MySQL

Y

Go / Rust[2]

Apache-2.0

~40.8k ★

CockroachDB

Active

Hybrid Logical Clocks (HLC)

PostgreSQL

N[3]

Go

CockroachDB Software License

~32.6k ★

References

Footnotes
  1. Core database engine (src/yb/, src/postgres/) is Apache-2.0; enterprise/management components (YugabyteDB Anywhere) are proprietary.

  2. SQL layer (TiDB) is written in Go; the distributed transactional key-value storage engine (TiKV) is written in Rust.

  3. Source-available under the CockroachDB Software License (previously BSL), not an OSI-approved open-source license.