Which upgrade path, and how do you know the new version will not be slower?
Major upgrades come every year or two and are easy to put off until the old version is out of support. This page picks a side, shows each engine's paths, and lists what actually goes wrong: usually not the upgrade itself, but plans, settings and clients afterwards.
I prefer to build the new version next to the old one, keep it in step with replication, test against it, and switch over in a short window. The old primary stays untouched, so going back is a switch, not a restore, but only for data written before cutover. Once the new version accepts writes, switching back loses those writes, because no replication runs from the new version back to the old one. In-place upgrades are fine for small databases or when a short outage is acceptable, but they leave no easy way back.
Before any of it, I rehearse on a restored copy: run the upgrade, replay a sample of real queries, compare their plans and timings, and write down how long each step took.
In one line. New version beside the old, kept in step, tested with real queries, switched in minutes, with the old primary kept as the way back for data written before cutover only.
pg_upgrade. With --link (hard links) or --clone it takes minutes even for large databases, but the old cluster cannot be started again after the new one runs with --link.pg_upgrade did not carry planner statistics, so run vacuumdb --all --analyze-in-stages straight away. 18 keeps them, except extended statistics, which still need regenerating after the upgrade.util.checkForServerUpgrade() first. It lists removed features, reserved words and settings that will fail.setFeatureCompatibilityVersion. Until you set it, going back to the old binaries is possible.On managed services, the same ideas have product names: Amazon RDS and Aurora blue/green deployments build the new version beside the old with replication and switch in about a minute; Atlas upgrades replica sets in a rolling way.
| What happens | Why | What I do |
|---|---|---|
| Queries are slow for the first hour | Planner statistics missing after pg_upgrade (before 18) | Analyze in stages as the first step after starting. |
| A few queries are slower for good | The new optimizer picks a different plan | Capture plans for the top queries before; compare after, on the rehearsal copy. |
| Applications cannot log in | Authentication defaults changed: MySQL 8.4 disables mysql_native_password by default | Check client libraries and user plugins during the rehearsal. |
| The upgrade refuses to start | An extension, a removed setting, or a reserved word in the schema | Run the upgrade checks (pg_upgrade --check, util.checkForServerUpgrade()) weeks before. |
| No way back | In-place upgrade with links, or MongoDB feature compatibility already set | Keep the old primary or a backup taken just before; set FCV late. Either option loses writes made on the new version after cutover; the way back is only safe before cutover traffic. |
| Replication breaks during the switch | Writes still going to the old primary | Stop writes, wait for zero lag, then switch; check sequences and identity values. |
-- PostgreSQL: check, then upgrade with hard links
pg_upgrade --check -b /usr/lib/postgresql/17/bin -B /usr/lib/postgresql/18/bin \
-d /data/17 -D /data/18
pg_upgrade --link -b /usr/lib/postgresql/17/bin -B /usr/lib/postgresql/18/bin \
-d /data/17 -D /data/18
vacuumdb --all --analyze-in-stages # needed before 18
-- MySQL: what will fail?
mysqlsh -- util checkForServerUpgrade root@localhost:3306 --target-version=8.4.0
-- MongoDB: where is the cluster now?
db.adminCommand({ getParameter: 1, featureCompatibilityVersion: 1 })
db.adminCommand({ setFeatureCompatibilityVersion: "8.0", confirm: true })pg_upgrade, except extended statistics.setFeatureCompatibilityVersion needs confirm: true.nodetool upgradesstables when the release notes say the file format changed.A 3 TB PostgreSQL 14 database must move to 18. The business accepts 15 minutes of downtime. Which path, and what would you check first?
Write your answer down first. Then open mine.
Path: logical replication into a new 18 cluster, or a managed blue/green deployment if it is on RDS. pg_upgrade --link would also fit inside 15 minutes, but leaves no quick way back.
Check first: every table has a primary key or replica identity (logical replication needs it for updates and deletes); extensions exist for 18; large objects and DDL are not replicated; sequences need copying at the switch.
Then: rehearse on a restored copy, compare the top queries' plans, and keep the 14 primary running, read-only, as the way back until cutover traffic starts. Once the new version accepts writes, switching back loses them, so the rollback window closes at cutover.
The same mechanism, migrations and upgrades, elsewhere on the site: in real incidents, in measurements, and in designs.
Pick an answer. You will see whether it is right, and why.
1. Which way can MySQL replicate across versions?
A newer replica can read an older source's binlog. That is what makes upgrading through a replica work.
2. After pg_upgrade on PostgreSQL 17, queries are slow. What is the first thing to run?
Before 18, pg_upgrade did not carry planner statistics, so the planner is guessing until ANALYZE runs.
3. In MongoDB, what keeps a downgrade possible after upgrading the binaries?
New on-disk features are enabled only when the feature compatibility version is raised.
4. Why rehearse on a restored copy of production?
Small test databases rarely show the plan changes that real data sizes cause.
How do I run it in production? What to check when it is slow or broken, where it runs and what it costs, how big it must be, pooling, backups, security, upgrades and other changes made safely.