Upgrade PostgreSQL

Hi,

I’ll need to upgrade production enviroment of PostgreSQL from version 12 to 15.

The production enviroment is in replica with pgpool-II and to the primary enviroment there is another replica with test enviroment.

In such an environment the best solution is to use pg_upgrade or create the new machines and restore with pg_dumpall?

I ask this question because it is critical for me to have a possible immediate rollback in case something goes wrong.

Regards

Hi,

If you want an immediate rollback then two methods come to mind both of which uses pg_upgrade:

  1. Use the “–copy” switch which creates the upgraded cluster by copying the original cluster. The disadvantage of course is downtime since the upgrade requires it be the only process accessing the cluster.
  2. Use the hardlinks option to upgrade i.e. “–link”. In the case of a rollback you would simply promote the replica which still hasn’t been upgraded. You can then rebuild your failed primary using pg_rewind.

Hope this helps.