Global and Wide-Column Databases on GCP: Cloud Spanner and Cloud Bigtable for Massive Scale

Google Cloud Platform Architect 60 min min read Updated: Nov 17, 2026 Advanced
Global and Wide-Column Databases on GCP: Cloud Spanner and Cloud Bigtable for Massive Scale
Advanced Topic 2 of 3

When Normal Databases Hit a Wall

  • A single-node relational database can only scale up so far, and replicas scale reads, not writes
  • Global apps need low-latency data in many regions and very high write rates
  • Google built Spanner and Bigtable for these needs

Cloud Spanner

  • A fully managed relational database with SQL, ACID transactions and horizontal scale
  • Strong consistency globally, using Google's TrueTime clocks
  • 99.99 percent (regional) to 99.999 percent (multi-region) availability SLA
  • Scales by adding nodes or processing units. Data is split into splits automatically
  • Supports GoogleSQL and PostgreSQL dialects, secondary indexes, change streams and graph and vector features
ConfigUse
RegionalLow latency in one region, survives zone failure
Dual-region / multi-regionSurvives a region failure and serves global users. Higher cost and write latency
bash gcloud spanner instances create shop-spanner --config=regional-asia-south1 --description="Shop" --processing-units=100 gcloud spanner databases create orders-db --instance=shop-spanner --ddl='CREATE TABLE Customers (CustomerId INT64 NOT NULL, Name STRING(100)) PRIMARY KEY (CustomerId)' gcloud spanner databases execute-sql orders-db --instance=shop-spanner --sql="SELECT COUNT(*) FROM Customers"

Spanner Design Tips

  • Do not use a sequential primary key (like an auto-increment number). It creates hotspots. Use UUIDs, hashed or bit-reversed keys
  • Interleave child tables in parents (for example Orders under Customers) to keep related rows together
  • Use secondary indexes for lookups, and stale reads for cheaper, faster reads when slightly old data is fine
  • Use Spanner Data Boost or federated queries for analytics without hurting production

Cloud Bigtable

  • A fully managed wide-column NoSQL database (the technology behind Google Search and Maps)
  • Very high throughput and low latency (single-digit milliseconds) at petabyte scale
  • Data model: row key → column families → columns → cells with timestamps. Only the row key is indexed
  • API compatible with HBase. No SQL joins or multi-row transactions
  • Great for time series, IoT, ad tech, financial ticks, personalization
bash gcloud bigtable instances create sensors --display-name="Sensors" --cluster-config=id=sensors-c1,zone=asia-south1-a,nodes=1 cbt -instance=sensors createtable readings cbt -instance=sensors createfamily readings metrics cbt -instance=sensors set readings device42#20261117T0900 metrics:temp=31.5 cbt -instance=sensors read readings prefix=device42#

Bigtable Design Tips

  • Design the row key for your main query. Example: deviceId#reverseTimestamp to read newest first for one device
  • Avoid keys that start with a timestamp or sequential number (hotspots)
  • Keep rows under a few MB, and use field promotion to put varied identifiers in the key
  • Add clusters in other regions for replication, failover and read locality (app profiles route traffic)

Spanner vs Bigtable vs Others

SpannerBigtableCloud SQL / AlloyDB
ModelRelational (SQL)Wide-column NoSQLRelational (SQL)
TransactionsGlobal ACIDSingle rowACID (single primary)
ScaleHorizontal, globalHorizontal, petabytesVertical plus read replicas
Query styleSQL with joinsRow key and range scansSQL with joins
Best forGlobal OLTP, financial, inventoryTime series, IoT, huge key-valueTypical apps

Practice

  1. Explain why an auto-increment key is bad in Spanner
  2. Design a Bigtable row key for 'latest 100 readings of one sensor'
  3. Choose a database for: global payments ledger, IoT telemetry at 1 million writes per second, small blog
  4. Create a 100 processing unit Spanner instance and run a query

Conclusion

Spanner gives a globally consistent relational database that scales horizontally. Bigtable gives massive-throughput NoSQL keyed by row. Design keys carefully to avoid hotspots, and use ordinary Cloud SQL when scale does not demand these.

Quick Summary: wall; Spanner; design; Bigtable; design; comparison.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators