In order to simplify the database upgrades, there is a utility that is built into the community PostgreSQL software: pg_upgrade. We can avoid performing a globals dump or database dump and directly run the upgrade using a single command when using pg_upgrade. In this recipe, we shall see how this utility can be used to perform simple database upgrades.
Getting ready
In order to perform an upgrade using pg_upgrade, we need to have sufficient space in the server. If the upgrade is being performed within the same server, then we need to make sure that we have at least three times the space of the existing database cluster (excluding the space required by WAL segments and log files).
As an example, if we have a PostgreSQL 9.3 cluster of size 100 GB, we should have the following:
- 100 GB dedicated to the new PostgreSQL 13 cluster.
- An additional 100 GB for storing the backup dump generated using pg_dumpall.
- While performing...