Google Cloud SQL vs Google Cloud Spanner

Betty
2 min readFeb 10, 2021

The quick look at key differences between the two Google’s relational databases

Introduction to Cloud Spanner

Spanner is a product that offers global availability and horizontal scalability. Spanner is designed as a massive data solution for which it can scale up to millions of machines across hundreds of datacenters.

It is a strongly consistent and relational database fully managed for its beneficiaries. Next to all that, this distributed-systems infrastructure comes with a guarantee that your data will never be lost — Spanner replicates the data even across continents.

This Google Product offers also control over the system. Within your application, you can:
- control read latency by deciding how far should the data be from its users,
- control write latency by choosing how far replicas are from each other,
- control durability, availability, and read performance by specifying how many replicas should be maintained.

Unique features:
- external consistency for read and writes,
- globally consistent reads across the database at a timestamp.

Introduction to Cloud SQL

Cloud SQL is a fully-managed relational database making its users happy with its reliability, security and scalability but it will not scale well for massive data volume.

Cloud SQL offers automatic backups, replication, tons of indexes and ACID compliance.
It supports MySQL, PostgreSQL and also Microsoft SQL Server. It is considered the no-ops relational database perfectly matching the needs of working with one database and the volume of data described by Gigabytes (not Petabytes).

Cloud Spanner vs Cloud SQL

Spanner is globally and horizontally scalable

If you need horizontal scaling or a globally available system the choice is simple — use Spanner since Cloud SQL can not meet those requirements.

Use Spanner if you have a lot of data

Cloud SQL supports regional-level databases of up to 30 TB. If you have more data to store don’t consider using Cloud Cloud SQL.

Use Spanner if you have more than 1 database

You are limited with having everything on one server with Cloud SQL

Cloud SQL is cheaper

If you have just a bit of data to be stored and you don’t need a globally available or horizontally scalable system, watch out for overpayments. Cloud SQL should satisfy you if the above is correct.

That’s it!

Hopefully, the differences between Spanner and Cloud SQL have just become clearer.

--

--