PostgreSQL · Migration planning
PostgreSQL migration rehearsal: define the cutover limits early
Build a major-version migration rehearsal around compatibility, application validation and an explicit boundary for returning to the old system.
A PostgreSQL major-version migration plan should explain how to move the data, how to judge the result and when returning to the old system stops being straightforward. Rehearsal makes those boundaries visible before the production window.
The short version
What to take away
- Choose and rehearse a migration method against the actual source and target.
- Compatibility checks do not establish application correctness or acceptable performance.
- Define the return path before cutover; new writes and transfer modes can constrain it.
Establish compatibility and choose a method
Dump/restore, pg_upgrade and logical replication have different operational requirements. Choose against the actual database size, versions, environment and acceptable interruption, then rehearse that same method. Upgrading a PostgreSQL cluster.
Inventory extensions, drivers, scheduled jobs, authentication dependencies and application SQL. Review the compatibility notes for every major release crossed. For example, PostgreSQL 18 enables checksums by default for new clusters, while pg_upgrade requires source and target checksum settings to match. Treat this as a compatibility check, not a reason to change production settings without review. PostgreSQL 18 migration notes.
Rehearse more than the transfer
For a pg_upgrade path, run its check mode with the intended transfer-mode option and resolve reported issues. Matching extension libraries must be available for the target server. Successful cluster checks leave application testing and performance evaluation to the rehearsal.
Use representative data and the intended application build. Record elapsed stages, resource constraints, errors and recovery steps. Check critical queries, permissions, background jobs and business invariants, such as whether related records remain consistent. Define acceptable differences before comparing results.
For logical replication, explicitly account for schema changes, sequence state and large objects. Built-in logical replication does not copy DDL or sequence state, and it does not replicate large objects. Assign a tested treatment to each dependency before selecting this route. Logical replication restrictions.
Write down the cutover boundary
For a logical-replication handoff, plan how to stop source writers, verify final changes have applied, reconcile sequence state and then enable target writes. Give each gate an owner and measurable evidence. A low lag observation alone does not cover missing objects or application correctness.
Define abort criteria and the return path before the window. After the target accepts new writes, switching back requires a plan for those writes. With pg_upgrade link mode, the old cluster becomes unsafe to use once the new cluster starts, even before application traffic resumes. Preserve an appropriate recovery option and rehearse its use. pg_upgrade checks and return-path limits.
Sources and next step
This guidance references PostgreSQL 18. Keep the final runbook specific to your versions and chosen method.