In the previous recipe, we discussed how pg_dumpall can be used for performing a major version upgrade.
We noticed that the dump file generated by pg_dumpall is a plain test file and the process may be time-consuming as it cannot be done in parallel. In this recipe, we shall see how we can use pg_dumpall to copy the globals but use pg_dump and pg_restore for migrating databases to a new version.
Getting ready
In order to perform a logical backup of a cluster, 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...