PostgreSQL: minor update or major upgrade?
The PostgreSQL docs draw a sharp line. Minor releases never change the internal storage format. You replace the executables while the server is down, restart, and the data directory stays as it was.
With a major release the storage format may change. The traditional route is dump and restore, which can be slow. pg_upgrade is the faster method, and replication methods exist too.
| Move | Example | Data |
|---|---|---|
| Minor | 10.0 to 10.6 | Directory unchanged |
| Major | Next major version | Dump and restore, pg_upgrade or replication |
Example
Illustrative. 2 clusters, a Saturday window of 4 hours. A minor update fits easily with both. A major upgrade gets one cluster per window, after a staging rehearsal that gives you a measured time.
Important
New major versions typically bring user-visible incompatibilities, so application changes may be needed. Read the release notes. Packaged versions may ship their own upgrade scripts, so check that documentation first.
Plan the window
- β Compare major numbers, not only the full version
- β Pick a method for each major upgrade
- β Time a rehearsal on staging
- β Read the release notes for changes
Gantt chart β tasks, owners, dates β
Source: postgresql.org, Documentation, Upgrading a PostgreSQL Cluster.