Performing a major version upgrade of Postgres on Cloud Service
Using logical replication
Note
This procedure doesn't work with distributed high-availability Cloud Service instances.
Logical replication is a common method for upgrading the Postgres major version on Cloud Service instances, enabling a transition with minimal downtime.
By replicating changes in real time from an older version (source instance) to a newer one (target instance), this method provides a reliable upgrade path while maintaining database availability.
Important
Depending on where your older and newer versioned Cloud Service instances are located, this procedure can accrue ingress and egress costs from your cloud service provider (CSP) for the migrated data. Consult your CSP's pricing documentation to see how ingress and egress fees are calculated to determine any extra costs.
Overview of upgrading
To perform a major version upgrade:
- Create a Cloud Service instance.
- Gather instance information.
- Confirm the Postgres versions before migration.
- Migrate the database schema.
- Create a publication.
- Create a logical replication slot.
- Create a subscription.
- Validate the migration.
Create a Cloud Service instance
To perform a major version upgrade, create a Cloud Service instance with your desired version of Postgres. This is your target instance.
Ensure your target instance is provisioned with a storage size equal to or greater than your source instance.
For details on creating a Cloud Service instance, see Creating a cluster.
Gather instance information
Use the Cloud Service console to obtain the following information for your source and target instance:
- Read/write URI
- Database name
- Username
- Read/write host
Using the Cloud Service console:
- Select the Clusters tab.
- Select your source instance.
- From the Connect tab, obtain the information from Connection Info.
Confirm the Postgres versions before migration
Confirm the Postgres version of your source and target Cloud Service instances:
Output using Postgres 16:
Migrate the database schema
On your source instance, use the dt
command to view the details of the schema to be migrated:
Here's a sample database schema for this example: