# Upgrade PostgreSQL

**URL:** <https://forums.percona.com/t/upgrade-postgresql/36415>\
**Category:** PostgreSQL\
**Created:** [January 30, 2025, 11:13am UTC](https://forums.percona.com/t/upgrade-postgresql/36415 "2025-01-30T11:13:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeids](https://avatars.discourse-cdn.com/v4/letter/j/c77e96/32.png) [@jeids](https://forums.percona.com/u/jeids)\
**Post date:** [January 30, 2025, 11:13am UTC](https://forums.percona.com/t/upgrade-postgresql/36415/1 "2025-01-30T11:13:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Robert\_Bernier](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/robert_bernier/32/1367_2.png) [@Robert\_Bernier](https://forums.percona.com/u/Robert_Bernier)\
**Post date:** [January 30, 2025, 2:48pm UTC](https://forums.percona.com/t/upgrade-postgresql/36415/2 "2025-01-30T14:48:28Z")

</div>

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.
