Database selection and migration with Database Migration Service for the Professional Cloud Database Engineer exam

5 min read

Two skills run through the whole Professional Cloud Database Engineer exam: choosing the right database service for the requirements, and planning low-downtime data migrations. Section 1 (design, ~32%) and section 3 (migration, ~23%) alone make up more than half the exam. This article gives a database decision table, the question signals that point to each service, then walks through migration with Database Migration Service (DMS) and its alternatives.

Key takeaways

  • Two skills run through the PCDBE exam: choosing the right database service for a requirement and planning a low-downtime data migration.
  • The design section (~32%) and the migration section (~23%) together are more than half the exam.
  • "Minimal downtime" in a question signals continuous migration; don't forget a fallback plan and reverse replication.
  • Bigtable doesn't fit data that needs joins and transactions; Spanner needs a different schema and key design, so don't pick it just to "scale".

Database decision table

ServiceData modelSignals in the question
Cloud SQL (MySQL, PostgreSQL, SQL Server)RelationalExisting OLTP app, one region, moderate scale, "minimal changes", lift-and-shift from on-premises
AlloyDB for PostgreSQLRelational, PostgreSQL-compatiblePostgreSQL needing more performance, mixed transactional and analytical work, vector search for gen AI
SpannerDistributed relational, strongly consistentGlobal, very large scale, highest SLA, horizontal write scaling (practice question #8)
BigtableWide-column NoSQLTime series, IoT, clickstream, millions of writes per second, hundreds of TB, row-key access (question #46)
FirestoreServerless document NoSQLWeb and mobile apps, flexible user profiles (question #17), offline sync (question #35)
MemorystoreIn-memory key-valueCaching, sessions, sub-millisecond latency (question #40)
BigQueryAnalytical data warehouseAnalytics at scale, not OLTP
Bare Metal Solution / Oracle on Google CloudCommercial databases needing specific hardware or licensingOracle that can't be converted and must keep its engine

Firestore in Datastore mode is the current name for the old Cloud Datastore. If an older question mentions Datastore, read it as Firestore in Datastore mode.

Three questions to narrow the choice

  1. Is the data relational and does it need ACID transactions? Yes: Cloud SQL, AlloyDB or Spanner. No: Bigtable, Firestore or Memorystore.
  2. What scope and write scale? One region with moderate writes: Cloud SQL/AlloyDB. Multiple regions or writes beyond one machine: Spanner.
  3. What access pattern? Key-based at huge throughput: Bigtable; documents and realtime to clients: Firestore; caching: Memorystore.

Scale up or scale out

Cloud SQL scales up with bigger machine types and scales out reads with read replicas. Spanner and Bigtable scale out by adding nodes or processing units; Bigtable adds nodes to reach the needed throughput. For variable Spanner load, use small processing-unit sizing and an autoscaler to keep costs down (question #12).

Migration: the framework

Migration typeCharacteristicsWhen
One-time (dump and load)A single snapshot; no writes to the source during the move, so there is downtimeSmall databases where downtime is acceptable
ContinuousFull dump, then ongoing CDC; cut over when in sync for minimal downtimeProduction with near-zero downtime requirements
HomogeneousSame engine, e.g. MySQL to Cloud SQL for MySQLLift-and-shift
HeterogeneousDifferent engines, e.g. Oracle to Cloud SQL for PostgreSQL; schema and code conversion neededModernization, cutting license costs

What Database Migration Service supports

Per the DMS documentation, the service migrates into Cloud SQL and AlloyDB for PostgreSQL:

  • Homogeneous: MySQL to Cloud SQL for MySQL; PostgreSQL to Cloud SQL for PostgreSQL or AlloyDB; SQL Server to Cloud SQL for SQL Server. Sources can be on-premises, self-managed VMs, Amazon RDS/Aurora, Azure or Cloud SQL.
  • Heterogeneous: Oracle to Cloud SQL for PostgreSQL or AlloyDB; SQL Server to Cloud SQL for PostgreSQL or AlloyDB. Conversion workspaces convert schemas automatically, with a SQL editor and Gemini assistance for what doesn't convert.
  • Not supported: dual-write to both source and destination; Oracle Autonomous Database as a source.

Steps of a continuous migration

  1. Prepare the source: for PostgreSQL, install pglogical and make sure every table has a primary key (question #26); for MySQL, enable binary logging and GTID as required.
  2. Connectivity: pick the method (IP allowlist, reverse SSH tunnel, VPC peering or Private Service Connect) that fits the network.
  3. Create a Continuous migration job: DMS runs the full dump, then switches to CDC.
  4. Watch replication lag until it nears zero; test the app against the (read-only) target.
  5. Cut over: stop writes to the source, let CDC catch up, promote the target, repoint the app (question #29).
  6. Fallback: keep the source for a while; if rollback is required, set up reverse replication from Google Cloud to the source.

For several MySQL and PostgreSQL databases that need a low-downtime cutover when closing a data center, reasonable answers are DMS or replication from an external server into Cloud SQL (question #28). For databases spread across on-premises and AWS, DMS is again the default (question #5).

When not to use DMS

SituationTool
One-time copy between Cloud SQL instances in different regions or projectsExport a SQL dump to Cloud Storage (serverless export or a temporary instance), then import (question #23)
Target is SpannerSpanner migration tool for schema and data; revisit the schema since Spanner needs hotspot-aware keys
Target is Bigtable from HBaseThe HBase client for Bigtable and import tools
CDC into BigQuery or Cloud Storage for analyticsDatastream
Oracle must keep its engineBare Metal Solution or Oracle services on Google Cloud, not DMS

Common traps

  • Choosing a one-time migration for a system that can't stop: "minimal downtime" signals continuous migration.
  • Forgetting the fallback plan: the exam guide explicitly lists reverse replication and fallback.
  • Moving to Spanner just "to scale" when the app should change little: Spanner needs a different schema and key design.
  • Choosing Bigtable for data needing joins and transactions.

Start practicing

Try the 60 free Professional Cloud Database Engineer questions, then a timed exam (Pro). For the exam overview, see the Professional Cloud Database Engineer study guide.

Official sources