Skip to content
RED SAGSkills
hardDatabase Administrator interview question

How would you upgrade a large production PostgreSQL database to a new major version with minimal downtime?

What the interviewer wants to hear

  • Read release notes for incompatible changes and test the app
  • Options: pg_upgrade with --link, or logical replication to a new cluster
  • Logical replication gives the shortest downtime but has limits (sequences, DDL, large objects)
  • Rehearse on a copy and measure timing
  • Run ANALYZE after upgrade and have a rollback plan

Model answer

First I read the release notes and test the application against the new version in staging, including extension versions. There are two main methods. pg_upgrade with --link mode is fast even for large databases because it reuses data files, but the database is down during the upgrade and rollback is harder once the new server starts. For minimal downtime I prefer logical replication: build a new cluster on the new version, copy the schema, subscribe to the old primary, and let it catch up. Logical replication does not copy DDL or sequence values, so I freeze schema changes and set sequences before cutover. At cutover I stop writes, wait for zero lag, sync sequences, and switch the connection endpoint. Managed services offer a similar blue-green deployment. I rehearse on a production copy, run ANALYZE afterwards, and keep the old cluster ready for rollback.

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