Upgrade methods compared
| Method | Downtime | Risk | Best for |
|---|---|---|---|
| Dump / restore | Minutes to hours | Low | Most users — safest path |
| pg_upgrade | Minutes (large DBs) | Medium | Large databases where dump is too slow |
Dump and restore (safest path)
- 1
Dump all databases from old version
# Dump all databases to a file:C:\> pg_dumpall -U postgres -f C:\backup\all_dbs.sqlPassword:# Wait for completion (can take minutes to hours) - 2
Install the new PostgreSQL version
Download and run the new installer. Install to a different directory (e.g.
C:\Program Files\PostgreSQL8). Use a different port (e.g. 5433) during setup to avoid conflict with the old version still running. - 3
Restore to the new version
# Connect to new instance (port 5433) and restore:C:\> psql -U postgres -p 5433 -f C:\backup\all_dbs.sqlPassword: - 4
Verify data and switch ports
Connect to the new instance, verify your data looks correct, then stop the old service, change the new service port to 5432, and start it. Update any connection strings in your applications.
- 5
Uninstall the old version
Once everything is confirmed working, uninstall the old PostgreSQL version from Settings → Apps.
pg_upgrade (in-place upgrade)
pg_upgrade copies or hard-links data files from the old cluster to the new one. It is faster than dump/restore for large databases but more complex to execute correctly.
Post-migration checks
Migration questions
Can I upgrade from PostgreSQL 14 directly to 18?
How long does the upgrade take?
Do my extensions need to be upgraded too?
ALTER EXTENSION extension_name UPDATE; for each extension in each database. Or use vacuumdb --all --analyze which also handles extension updates in recent versions.