Overview
Before you choose to migrate your databases to Cloud SQL, make sure you consider known limitations for this migration scenario.
Known limitations for using a PostgreSQL database as a source include:
The
pglogical
extension doesn't support the replication of generated columns for PostgreSQL 12+.Changes to table structures (DDL) aren't replicated through standard DDL commands, but only with commands executed using the
pglogical
extension used for replication.For example,
pglogical
provides a functionpglogical.replicate_ddl_command
that allows DDL to be run on both the source database and replica at a consistent point. The user running this command on the source must already exist on the replica.In order to replicate data for new tables, you must use the
pglogical.replication_set_add_table
command to add the new tables to existing replication sets.To learn more about DDL replication while the migration is in progress, see the section on migration fidelity.
For tables that don't have primary keys, Database Migration Service supports migration of the initial snapshot and
INSERT
statements during the change data capture (CDC) phase. You should migrateUPDATE
andDELETE
statements manually.Database Migration Service doesn't migrate data from materialized views, just the view schema. To populate the views, run the following command:
REFRESH MATERIALIZED VIEW view_name
.The
SEQUENCE
states (for example,last_value
) on the new Cloud SQL destination might vary from the sourceSEQUENCE
states.UNLOGGED
andTEMPORARY
tables aren't and can't be replicated.Large Object data type isn't supported. More details in the section on migration fidelity.
Only extensions and procedural languages that Cloud SQL supports for PostgreSQL can be migrated. Database Migration Service doesn't migrate extensions that are unsupported by Cloud SQL. The presence of these extensions doesn't block the migration, but to ensure a smooth migration process verify that your objects or applications don't reference any unsupported extensions. We recommend removing these extensions and references from your source database before you proceed.
The
pg_cron
extension (or anycron
settings associated with the extension) isn't migrated by Database Migration Service, but it is supported in Cloud SQL for PostgreSQL destinations. If you use thepg_cron
extension in your source databases, you can re-install it on your destination instance after the migration is complete.
Database Migration Service doesn't support migrating from read replicas that are in recovery mode.
Database Migration Service doesn't support Amazon RDS sources where the AWS SCT extension pack is applied.
- User-defined functions written in C can't be migrated, except for functions that are installed in the PostgreSQL database when you're installing extensions that are supported by Cloud SQL.
If other extensions and procedural languages exist in the source database, or if their versions aren't supported, then when you test or start the migration job, it will fail.
Databases that are added after the migration job has started aren't migrated.
You can't select specific database objects (such as databases, tables, or schemas) when you migrate by using Database Migration Service. All tables from all databases and schemas are migrated as part of the database migration, except for the following schemas:
- The information schema (
information_schema
) - Any schemas beginning with
pg
(for example,pg_catalog
, which contains the system tables and all built-in data types, functions, and operators, and exists in all databases automatically). As a result, information about users and user roles isn't migrated. See the full list of schemas beginning withpg
.
- The information schema (
If encrypted databases require customer-managed encryption keys to decrypt the databases, and if Database Migration Service doesn't have access to the keys, then the databases can't be migrated.
However, if customer data is encrypted by the
pgcrypto
extension, then the data can be migrated with Database Migration Service (because Cloud SQL supports the extension).Database Migration Service also supports migrating data from encrypted Amazon Aurora or Amazon RDS databases because these databases handle decryption transparently in their services. For more information, see Encrypting Amazon Aurora resources and Encrypting Amazon RDS resources.
The destination Cloud SQL database is writable during the migration to allow DDL changes to be applied if needed. Take care not to make any changes to the database configuration or table structures which might break the migration process or impact data integrity.
Trigger behavior depends on how they were configured. The default behavior is they won't trigger, but if they were configured using the
ALTER EVENT TRIGGER
orALTER TABLE
statement and the trigger state is set to either replica or always, then they will trigger on the replica during replication.Functions with security definer will be created by
cloudsqlexternalsync
in Cloud SQL replica. When it's executed by any users, it will be executed with the privileges ofcloudsqlexternalsync
which hascloudsqlsuperuser
andcloudsqlreplica
roles. It's better to restrict use of a security definer function to only some users. To do that, the user should revoke the default PUBLIC privileges and then grant execute privilege selectively.Cloud SQL does not support customized tablespaces. All the data inside customized tablespaces is migrated to the
pg_default
tablespace in the Cloud SQL destination instance.
Limitations for migrations to existing destination instances
- Your existing destination instance must be empty or contain only
system configuration data. Migrating to existing destination instances
that contain user data (such as tables) isn't supported.
If you encounter issues due to extra data in your existing destination instance, clear the databases in your destination instance and re-try the migration job. See Clear extra data from your existing destination instance.
- You can configure only one migration job per destination instance.
- You can only migrate to standalone Cloud SQL instances. Migrating to external server replicas isn't supported.
- Migrating data to a Cloud SQL instance that has Private Service Connect enabled isn't supported.
- After you promote an instance, you must turn on point-in-time recovery.
- If your instance has customized backup settings (for example, a custom backup location), then after you promote the instance, you must customize your backup settings again. During the promotion process, Cloud SQL resets your backup settings to their default values.
- For Terraform users: Database Migration Service modifies the backup and recovery settings of your destination instance. This might cause your the destination instance settings to be different from the Terraform configuration you used for provisioning. If you experience this issue, follow the guidance in Diagnose issues.
Quotas
- Up to 2,000 connection profiles and 1,000 migration jobs can exist at any given time. To create space for more, migration jobs (including completed ones) and connection profiles can be deleted.
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 2024-10-30 UTC.