Google Cloud · Comparison

Cloud SQL vs AlloyDB vs Spanner vs Firestore

Which operational database should I use on Google Cloud?

Decision summary

Default to Cloud SQL for relational applications that fit on one primary instance with read replicas.

Move to AlloyDB when PostgreSQL performance or mixed analytics outgrow Cloud SQL.

Choose Spanner only when you need relational data that scales horizontally with strong consistency across regions or extreme availability; it's powerful but costs more and changes how you design schemas.

Choose Firestore for document data in web and mobile apps, especially with real-time sync and serverless billing. For huge key-based throughput, look at Bigtable instead.

Best fit for each option

Cloud SQL

Typical relational apps on MySQL, PostgreSQL or SQL Server.

AlloyDB

Busy PostgreSQL workloads and analytics on operational data.

Spanner

Global, strongly consistent relational data at very large scale.

Firestore

Document data for mobile and web apps, real-time listeners, serverless billing.

Side by side

 Cloud SQLAlloyDBSpannerFirestore
Best forStandard relational appsHigh-performance PostgreSQLGlobal relational scaleDocuments for apps
ScalingVertical, read replicasVertical primary, read poolsHorizontal, onlineAutomatic, serverless
AvailabilityZonal HA standby; cross-region replicasHA by default in the regionRegional or multi-region (up to 99.999%)Regional or multi-region
CostInstance size and storageInstances and storage usedCompute capacity and storagePer operation and stored data
Operational complexityLow; you size instancesLow; you size instances and poolsLow; schema and key design matterLowest; data modelling matters

When to avoid each option

Cloud SQL

  • Write volume beyond one machine or global writes.

AlloyDB

  • Small databases where Cloud SQL is cheaper.
  • MySQL or SQL Server.

Spanner

  • Small, regional apps that don't need its scale or price.

Firestore

  • Joins, complex transactions and relational integrity.

Example scenarios

SituationChooseWhy
A SaaS product with 200 GB of PostgreSQL data in one regionCloud SQLFits one primary with HA and replicas.
An inventory system taking writes in Europe, America and AsiaSpannerGlobal consistent writes are its purpose.
A mobile app that syncs user data offlineFirestoreClient SDKs with offline persistence and real-time updates.
Reporting queries slowing down a busy PostgreSQL databaseAlloyDBIts columnar engine speeds analytics on operational data.

Exam cues

  • Global, strongly consistent relational: Spanner. Regional relational: Cloud SQL.
  • Serverless documents, mobile sync: Firestore. High-performance PostgreSQL: AlloyDB.

Service pages

Related

Courses and lessons

Services, comparisons and patterns

Sources

Independent study material, not affiliated with or endorsed by Amazon Web Services.

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake