Stay organized with collections Save and categorize content based on your preferences.
This page describes how to migrate your data to an instance running a later version of PostgreSQL. Before proceeding with this method, consider upgrading the database major version in-place.
There are two ways to upgrade the database major version of your Cloud SQL for PostgreSQL instance by migrating your data.
The rest of this page discusses the second option.
Plan a major version upgradeChoose a target major version.
Consider the features offered in each PostgreSQL version and address incompatibilities.
New major versions introduce incompatible changes that might require you to modify the application code, the schema, or the database settings before you can upgrade your database instance. Review the release notes of your target major version to determine the incompatibilities that you need to address. If you're skipping major versions, address the incompatibilities listed for each version that you're skipping.
Test the upgrade with a dry run.
Perform a dry run of the end-to-end upgrade process with a test instance before you upgrade the production database. You might want to test the upgrade using a clone instead of your production database to avoid any performance impact from the export on your production workload.
In addition to validating that the upgrade completes successfully, run tests to understand the expected downtime of the upgrade, confirm your upgrade workflow, and ensure that the application behaves as expected on the upgraded database. If you haven't enabled automatic storage increases, take note of the disk storage used by the upgraded dry run instance to determine whether you need to increase the storage capacity for the production instance before upgrading.
Decide when you want to upgrade.
Note: Upgrades require the instance to become unavailable for a period of time. Be sure to schedule your upgrade when database activity is low.Migrating entails using the pg_dump
command to export the data from the source instance and the pg_restore
command to import the data into the target instance.
To migrate your data to a Cloud SQL instance running a more recent database version, follow these steps:
Create the target instance with the desired PostgreSQL version.
Make sure the target instance has:
For more information, see Creating an instance.
Confirm that you can connect to the new instance with your local PostgreSQL tools and update them, if necessary.
Export the current instance's data to a PostgreSQL dump file, following the instructions in Exporting data for Import into Cloud SQL.
Do not export the postgres
system database. The postgres
database is the default database you connect to before you have created any other databases. Once you create another database, switch to it in order to create tables and insert data. Don't use the postgres
database for your application's data.
Create a Cloud Storage bucket if needed, and upload your SQL dump file to the bucket.
Import the data to the target instance, following the instructions in Importing PostgreSQL databases from Cloud Storage.
Optional. After completing the upgrade process, set up replication between the source and target instances using pglogical
to update the target with all changes that have occurred since the initial dump was started. Once the two instances are in sync, you can promote the target instance.
For information about using pglogical
to implement continuous replication, see Configure your source.
Update your applications to connect to the new instance.
When you're confident that your new instance is operating successfully, delete the old instance.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-02 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4