Cloud Spanner
Definition
Google Cloud's globally distributed database that combines the benefits of relational databases with horizontal scaling.
Use Cases
- Google: AdWords/ads-related transactional workloads requiring high availability and strong consistency across regions — Spanner originated at Google to support globally distributed, strongly consistent transactions. Google built and operated Spanner internally using synchronized clocks (TrueTime) and automatic sharding/replication to keep data consistent while scaling horizontally. (Enabled global-scale transactional systems with strong consistency and high availability, reducing operational complexity compared to manually sharded databases.)
- Square: Globally available payment and commerce data that must remain consistent during high transaction volumes — Square has publicly discussed using Google Cloud Spanner for strongly consistent, horizontally scalable storage for critical transactional data, leveraging managed replication and SQL transactions. (Improved scalability and reliability for transaction-heavy systems while reducing the need for manual sharding and complex consistency management.)
Provider Equivalents
- AWS: Amazon Aurora
- Azure: Azure Cosmos DB
- GCP: Cloud Spanner
- OCI: Oracle Autonomous Database
Frequently Asked Questions
- What's the difference between Cloud Spanner and Cloud SQL?
- Cloud SQL is a managed MySQL/PostgreSQL/SQL Server database that’s typically designed for a single region and scales mostly by making the machine bigger (vertical scaling) plus read replicas. Cloud Spanner is built to scale out horizontally across many nodes and can replicate data across regions while keeping strong consistency for transactions. Use Cloud SQL for simpler, smaller-to-medium relational workloads; use Spanner when you need global scale with relational transactions.
- When should I use Cloud Spanner?
- Use Cloud Spanner when you need (1) a relational database with SQL and ACID transactions, (2) very high scale (large data size and/or high read/write throughput), and (3) high availability and optional multi-region replication with strong consistency. Common fits include global user profiles, financial ledgers, inventory systems, and order processing where correctness matters and manual sharding would be risky or expensive.
- How much does Cloud Spanner cost?
- Cloud Spanner pricing mainly depends on (1) compute capacity (provisioned nodes or processing units), (2) storage used, and (3) network egress (especially cross-region). Multi-region configurations and higher availability typically require more provisioned capacity. Costs can be optimized by right-sizing compute, using autoscaling where available, choosing appropriate instance configuration (regional vs multi-region), and designing schemas/queries to reduce hotspots and unnecessary load.
Category: data
Difficulty: advanced
Related Terms
See Also