Database selection and migration with Database Migration Service for the Professional Cloud Database Engineer exam
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
| Service | Data model | Signals in the question |
|---|---|---|
| Cloud SQL (MySQL, PostgreSQL, SQL Server) | Relational | Existing OLTP app, one region, moderate scale, "minimal changes", lift-and-shift from on-premises |
| AlloyDB for PostgreSQL | Relational, PostgreSQL-compatible | PostgreSQL needing more performance, mixed transactional and analytical work, vector search for gen AI |
| Spanner | Distributed relational, strongly consistent | Global, very large scale, highest SLA, horizontal write scaling (practice question #8) |
| Bigtable | Wide-column NoSQL | Time series, IoT, clickstream, millions of writes per second, hundreds of TB, row-key access (question #46) |
| Firestore | Serverless document NoSQL | Web and mobile apps, flexible user profiles (question #17), offline sync (question #35) |
| Memorystore | In-memory key-value | Caching, sessions, sub-millisecond latency (question #40) |
| BigQuery | Analytical data warehouse | Analytics at scale, not OLTP |
| Bare Metal Solution / Oracle on Google Cloud | Commercial databases needing specific hardware or licensing | Oracle 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
- Is the data relational and does it need ACID transactions? Yes: Cloud SQL, AlloyDB or Spanner. No: Bigtable, Firestore or Memorystore.
- What scope and write scale? One region with moderate writes: Cloud SQL/AlloyDB. Multiple regions or writes beyond one machine: Spanner.
- 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 type | Characteristics | When |
|---|---|---|
| One-time (dump and load) | A single snapshot; no writes to the source during the move, so there is downtime | Small databases where downtime is acceptable |
| Continuous | Full dump, then ongoing CDC; cut over when in sync for minimal downtime | Production with near-zero downtime requirements |
| Homogeneous | Same engine, e.g. MySQL to Cloud SQL for MySQL | Lift-and-shift |
| Heterogeneous | Different engines, e.g. Oracle to Cloud SQL for PostgreSQL; schema and code conversion needed | Modernization, 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
- 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.
- Connectivity: pick the method (IP allowlist, reverse SSH tunnel, VPC peering or Private Service Connect) that fits the network.
- Create a Continuous migration job: DMS runs the full dump, then switches to CDC.
- Watch replication lag until it nears zero; test the app against the (read-only) target.
- Cut over: stop writes to the source, let CDC catch up, promote the target, repoint the app (question #29).
- 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
| Situation | Tool |
|---|---|
| One-time copy between Cloud SQL instances in different regions or projects | Export a SQL dump to Cloud Storage (serverless export or a temporary instance), then import (question #23) |
| Target is Spanner | Spanner migration tool for schema and data; revisit the schema since Spanner needs hotspot-aware keys |
| Target is Bigtable from HBase | The HBase client for Bigtable and import tools |
| CDC into BigQuery or Cloud Storage for analytics | Datastream |
| Oracle must keep its engine | Bare 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.