Google Cloud · Databases
Spanner
A relational database that scales horizontally across regions while staying strongly consistent, with up to 99.999% availability.
On the Google Cloud Associate Cloud Engineer exam listRelational databaseDisaster recovery
What it is and what problem it solves
Spanner is a fully managed relational database with SQL (GoogleSQL or PostgreSQL dialect) that splits data across many servers and keeps it strongly consistent with synchronous replication. Regional configurations replicate across zones; multi-region configurations replicate across regions. Capacity is set in nodes or processing units and can scale up and down online.
When to use it
- Global applications needing consistent writes from several regions (gaming, financial ledgers, inventory).
- Relational workloads too large for a single-primary database.
- Systems that need very high availability with a near-zero RPO.
When to avoid it
- Small or regional applications: Cloud SQL is much cheaper and simpler.
- Analytics: BigQuery.
- Teams relying on PostgreSQL extensions or behaviours Spanner doesn't support.
Limits and quotas
| Item | Value | Context | Source |
|---|---|---|---|
| Availability SLA, multi-region configuration | 99.999% | Regional configurations have a 99.99% SLA. | Source checked |
Quotas and limits change. Check the linked source before designing around a number.
Cost model
What you pay for
- Compute capacity (nodes or processing units) per hour, by configuration.
- Storage and backups; replication across regions.
Where it is cost-efficient
Large, consistent workloads that would otherwise need sharding by hand.
Where costs grow
Small workloads paying for minimum capacity; multi-region configs where regional would do.
Cost controls and common surprises
Autoscaling capacity, smaller processing-unit allocations, and choosing regional configs unless global consistency is needed.
Prices differ by Region and change over time; see the pricing page linked under Sources.
Security
Controls the service provides
Encryption at rest (CMEK optional), IAM at database level, fine-grained access control.
What you configure
Grant least-privilege database roles, use VPC Service Controls for sensitive data, and enable audit logs.
Exam cues and common confusions
- Relational, global scale, strong consistency, 99.999%: Spanner.
- Regional relational database for a typical app: Cloud SQL.
Related
Courses and lessons
- The Region Went Down · Google Cloud in Production · Members
Services, comparisons and patterns
- Cloud SQL · Service
- AlloyDB for PostgreSQL · Service
- Firestore · Service
- Cloud SQL vs AlloyDB vs Spanner vs Firestore · Comparison
- High availability · Concept
Sources
Independent study material, not affiliated with or endorsed by Google. Google Cloud and service names are trademarks of Google LLC.