GCP Prep
Browse all topics
Databases4 min readUpdated August 16, 2026

Spanner

In one sentence

Spanner is a SQL database that scales out like a distributed system while still giving you transactions that behave correctly across the whole planet.

What it is

Spanner is a distributed relational database. It offers SQL, schemas, secondary indexes and ACID transactions — while distributing data across many machines and, if you choose, across regions.

Historically, systems forced a choice: relational guarantees on one machine, or horizontal scale with weaker consistency. Spanner's significance is that it provides both, using tightly synchronised clocks to order transactions globally.

Why it matters

For systems that genuinely outgrow a single-machine database but cannot give up transactional correctness — payments, ledgers, inventory, global user accounts — there are very few alternatives that do not involve building the consistency logic yourself.

The trade-off is cost. Spanner has a meaningful minimum spend and is substantially more expensive than Cloud SQL for small workloads. Choosing it for a database that would fit comfortably on one machine is a classic over-engineering error, and exams test that judgement.

Key concepts

  • Instance — the provisioned capacity, measured in nodes or processing units, plus a chosen configuration.
  • Instance configuration — regional for lower cost and latency in one region; multi-region for higher availability and global reads at higher cost.
  • Split — the unit of data distribution. Spanner divides tables into ranges and spreads them across servers automatically.
  • Primary key design — the most consequential decision you make. Keys determine how data is distributed, and a poor choice creates a hotspot that limits throughput.
  • Interleaved tables — physically storing child rows next to their parent rows so related data is fetched together efficiently.
  • Strong and stale reads — strongly consistent reads always see the latest data; slightly stale reads can be cheaper and faster when a few seconds of lag is acceptable.
  • External consistency — the strongest guarantee Spanner offers: transactions appear in an order consistent with real time, globally.

Choosing between relational options

RequirementAnswer
Standard relational workload that fits on one machineCloud SQL — cheaper and simpler.
Write throughput beyond a single machine, still needs transactionsSpanner.
Single database serving several regions with strong consistencySpanner in a multi-region configuration.
Analytical queries scanning enormous volumesBigQuery — not an operational database.
Migrating an existing MySQL or PostgreSQL application unchangedCloud SQL — Spanner requires schema and application changes.

Common use cases

  • Financial ledgers and payment systems needing correctness at scale.
  • Global inventory where overselling must be impossible across regions.
  • Gaming platforms with worldwide player state and leaderboards.
  • Telecommunications and logistics systems with very high transaction volumes.
  • Consolidating many sharded databases that have become unmanageable.

Certification relevance

Where this topic appears, and how deeply each exam goes into it. These are our own assessments based on published exam guides.

  • Professional Cloud Architect

    A frequent correct answer in scenarios combining global scale with transactional requirements — and a frequent wrong answer when the scenario is smaller than it first appears.

  • Professional Cloud Database Engineer

    Deep coverage: schema design, hotspot avoidance, instance sizing and multi-region configuration.

  • Professional Data Engineer

    Appears in storage-selection questions distinguishing operational from analytical workloads.

Practice questions

Databases practice questions

8 original questions with full explanations.