liveBook · Manning

Pg_upgrade

As explained in PostgreSQL Mistakes and How to Avoid Them

pg_upgrade is a PostgreSQL utility that upgrades a database cluster to a newer major version while preserving its data.

Treating every PostgreSQL upgrade as prohibitively risky is a mistake. pg_upgrade provides a refined, highly reliable path for major-version upgrades, with dry-run modes for sanity checking. section 7.6

Plan the upgrade around these operational checks:

  • Check PostgreSQL version and platform compatibility, then verify that each extension version supports the target PostgreSQL release. section 7.6
  • Run pg_upgrade's dry-run mode before the real migration to expose problems without committing to the upgrade. section 7.6
  • Consider logical replication when near-zero downtime matters more than minimizing implementation effort. section 7.6

A safer major-upgrade plan

Before moving a production cluster to a new major PostgreSQL release, validate platform and extension compatibility, run pg_upgrade in dry-run mode, and use logical replication instead when downtime must approach zero. section 7.6

How PostgreSQL Mistakes and How to Avoid Them covers it

How deep it goes
Explains reliability, dry-run validation, extension compatibility, and logical-replication alternatives without detailing execution steps.
Examples
Uses dry-run sanity checks, extension compatibility reviews, and logical replication for near-zero-downtime upgrades.
What it assumes
Check PostgreSQL platform compatibility and confirm that installed extensions support the target PostgreSQL version.
What you can do after
Operate pg_upgrade for a safer major-version migration after checking compatibility and validating the plan.
How it connects
Connects PostgreSQL upgrades with extensions, logical replication, release notes, and REINDEX requirements.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of PostgreSQL Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.