Skip to content
RED SAGSkills
hardDatabase Administrator interview question

How would you migrate a 5 TB on-premises PostgreSQL database to a managed cloud service with less than 15 minutes of downtime?

What the interviewer wants to hear

  • Assess compatibility: version, extensions, superuser features and network
  • Initial bulk copy followed by continuous change replication (logical replication or DMS)
  • Validate data, sequences and performance on the target before cutover
  • Short cutover: freeze writes, wait for zero lag, sync sequences, switch connections
  • Keep a rollback path, such as reverse replication

Model answer

First I would check compatibility: the target version, the extensions we use, features that need superuser, and network bandwidth and latency to the cloud, because 5 TB takes time to copy. A dump and restore would take far too long, so I would use continuous replication: logical replication or a service like AWS DMS, with an initial copy followed by streaming changes. Tables need primary keys or replica identity, and DDL must be frozen or applied to both sides. While it runs I validate row counts and checksums on key tables, test application performance on the target, and rehearse the cutover. On the day I stop writes, wait for lag to reach zero, sync sequences, switch the connection strings or DNS and run smoke tests. If possible I set up reverse replication so we can roll back.

Can you answer it under time pressure?

Take a timed hard round and get scored on every answer.

Start mock interview

More hard Database Administrator questions