The best open source alternative to Google Cloud Spanner is tidb. If that doesn't suit you, we've compiled a ranked list of open source Google Cloud Spanner alternatives to help you find a replacement.
Google Cloud Spanner is a managed relational database that combines strong consistency with horizontal scalability across regions, aimed at applications that need both SQL semantics and the scale of a distributed system. It handles replication, sharding, and failover automatically, and supports both a Spanner-specific SQL dialect and, more recently, a PostgreSQL-compatible interface.
Teams look for open-source alternatives to Spanner mostly over cost and portability. Spanner pricing is based on provisioned compute nodes plus storage, and running a globally distributed cluster is expensive compared to a single-region database, which makes it a hard sell for applications that don't need true global scale. Being tied to Google Cloud is also a concern for teams wanting to avoid single-cloud lock-in for a core piece of infrastructure like their primary database.
TiDB is a reasonable open-source comparison point. It is a distributed SQL database that shares Spanner's general architecture, separating compute from storage and scaling horizontally while maintaining strong consistency guarantees, and it speaks the MySQL protocol rather than Spanner's dialect or Postgres compatibility layer. This makes it a more natural fit for teams already using MySQL-compatible tooling than for teams built around Spanner's specific SQL extensions.
Before migrating, understand that moving from Spanner's SQL dialect to TiDB's MySQL compatibility is not a drop-in change if you use Spanner-specific features like interleaved tables. Test consistency and latency behavior under your real traffic patterns and geographic distribution, since distributed databases handle cross-region writes differently. Also plan for the shift from a fully managed service to one you deploy and operate yourself, including cluster sizing and failover testing.