Skip to content

Chat

Migration plan: Postgres 15 to 17

Prism Reason · 2 messages · 268 tokens

Plan a zero-downtime upgrade of our primary database from Postgres 15 to 17. About 900 GB, one primary and two replicas.

Prism Reason

The safest route at this size is logical replication into a fresh 17 cluster, then a short cutover. An in-place pg_upgrade is faster but gives you only one rollback point .

  1. Prepare. Stand up a Postgres 17 cluster, load the schema with pg_dump --schema-only, and verify extensions are available.
  2. Replicate. Create a publication on 15 and a subscription on 17. Initial copy of 900 GB takes roughly 6 to 10 hours on comparable hardware.
  3. Verify. Compare row counts and checksums on the 20 largest tables, then replay a day of read traffic against 17.
  4. Cut over. Pause writes for about 30 seconds, wait for replication lag to hit zero, sync sequences, then repoint the application.
  5. Keep the way back. Leave 15 running with reverse replication for 48 hours.

The riskiest step is the sequence sync, since logical replication doesn't carry sequence values. Rehearse it in staging twice before the real window .

Sources

  • 1Upgrading a PostgreSQL clusterpostgresql.org · documentation
  • 2Logical replication restrictionspostgresql.org · documentation

Prism can make mistakes. Check important information.