Upgrading the major PostgreSQL version in Yandex Managed Service for PostgreSQL
To upgrade the major PostgreSQL version in Managed Service for PostgreSQL, select a suitable time and version and start the update.
To upgrade a major version, the following must be free:
- For disks with a capacity of 100 GB or less: At least 10% of the storage volume.
- For disks with a capacity of over 100 GB: At least 10 GB.
Before upgrading, we recommend creating a backup of the cluster and then testing the update on a test cluster to ensure it runs correctly. You can deploy the test cluster from the backup.
You can only upgrade a major version step by step, one version at a time.
For example, if you need to update a cluster from version
14to16, first update it from14to15, and then from15to16.
Note
Upgrade from a standard version to a 1С:Enterprise version (e.g., 14 to 14-1c) is not supported.
The update process runs automatically and includes the following steps:
-
Checking that the upgrade is possible.
-
Upgrading extensions.
-
Preparing the master:
- Disabling
autovacuum. - Updating the statistics collection settings.
- Stopping the master.
- Disabling
-
Configuring the master settings.
-
Performing a binary update of the master.
-
Checking the master after the binary update and updating the configuration.
-
Starting the master in restricted mode.
-
Collecting reduced statistics using the
vacuumdbcommand with the--analyze-in-stagesand--alloptions. The command runs with a timeout of 300 seconds.Statistics collection is performed in three stages. In the first stage, preliminary statistics are collected with
default_statistics_target=100. In the second and third stages, full statistics are collected. -
Sequential replica update. The order of replica updates is determined randomly.
-
Switching the master to normal mode.
The master is unavailable for reads and writes during the major version update. No role switching occurs. Each replica is only unavailable for reads during its own update. As a result, the cluster is unavailable for writes during the update. Read availability depends on the number of hosts in the cluster:
- A cluster with a single host is unavailable for reads.
- A cluster with two hosts is available for reads during the master update but unavailable during the replica update.
- A cluster with three or more hosts is always available for reads.
How long an upgrade takes depends on the number of affected databases and the number of objects in each of them. The more databases and objects there are, the longer your upgrade will take.
To learn about updates within the same version and host maintenance, see Maintenance.