Stay organized with collections
Save and categorize content based on your preferences.
This page provides an overview of ways to migrate data into and out of
AlloyDB for PostgreSQL.
Importing data
You can migrate data into AlloyDB through two methods:
Manually importing files containing your data.
Using Google Cloud Database Migration Service to migrate the contents of a whole,
active PostgreSQL instance into a new AlloyDB cluster.
Import archived data from files
AlloyDB lets you import
data from files located in a Cloud Storage bucket.
AlloyDB supports a variety of file formats for data
import, including the following:
CSV, with the contents of one table
per file, loaded using psql.
DMP, a binary archive of a whole
PostgreSQL database, imported using pg_restore.
SQL, a plain-text reconstruction of a
PostgreSQL database, processed with psql.
Migrate an active instance with Database Migration Service
As an alternative to manually importing data-dump files, you can use
Database Migration Service for AlloyDB.
This service lets you migrate the entire contents of an
active PostgreSQL instance—including all of its databases and
metadata—into a new AlloyDB cluster. Database Migration Service can
help you transition your existing applications to using
AlloyDB as their new datastore with minimal downtime.
If the database you want to import into AlloyDB defaults
to a libc locale other than the two listed here, you can still import
your data, but that default won't carry over. To ensure that SQL queries
using ORDER BY sort their results properly, you might need to take
additional steps after importing your data.
We recommend allowing your new database to use the default locale for
AlloyDB: C.UTF-8, provided by libc. Then, associate
collations with any
columns that your application's queries might involve in ORDER BY
clauses, naming an appropriate ICU-based collation for each one. You can
do this through ALTER TABLE DDL
queries, such as the following:
A new AlloyDB cluster defines hundreds of collations
based on ICU-provided locales, and you can add more using the PostgreSQL
CREATE COLLATION facility. To
see the full list of ICU-based collation names defined on an
AlloyDB cluster,
run the following query on any of its instances:
In addition to ICU-based collations, AlloyDB supports the
PostgreSQL built-in collation named ucs_basic. This collation uses
the standard order of Unicode code points to enable especially efficient
sorting. We recommend its use with columns whose appropriate sort order
matches that of the Unicode code-point list.
Exporting data
You can use command-line utilities to export your AlloyDB
data into files stored on a Cloud Storage bucket, in a variety of formats:
[[["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-08-26 UTC."],[[["\u003cp\u003eAlloyDB for PostgreSQL supports two primary methods for data migration: manually importing data from files or using Google Cloud Database Migration Service to migrate from an active PostgreSQL instance.\u003c/p\u003e\n"],["\u003cp\u003eData can be imported into AlloyDB from files in CSV, DMP, or SQL formats, located in a Cloud Storage bucket, using \u003ccode\u003epsql\u003c/code\u003e or \u003ccode\u003epg_restore\u003c/code\u003e utilities.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Cloud Database Migration Service allows migrating an entire active PostgreSQL instance, including all databases and metadata, to a new AlloyDB cluster with minimal downtime.\u003c/p\u003e\n"],["\u003cp\u003eAlloyDB supports a range of locales, with a recommendation to use the default \u003ccode\u003eC.UTF-8\u003c/code\u003e locale and to define ICU-based collations for specific columns that require particular sort orders.\u003c/p\u003e\n"],["\u003cp\u003eData can be exported from AlloyDB to files in CSV, DMP, or SQL formats, stored in a Cloud Storage bucket, using \u003ccode\u003epsql\u003c/code\u003e or \u003ccode\u003epg_dump\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Migration overview\n\nThis page provides an overview of ways to migrate data into and out of\nAlloyDB for PostgreSQL.\n\nImporting data\n--------------\n\nYou can migrate data into AlloyDB through two methods:\n\n- Manually importing files containing your data.\n\n- Using Google Cloud Database Migration Service to migrate the contents of a whole,\n active PostgreSQL instance into a new AlloyDB cluster.\n\n| **Caution:** If your source database uses a default collation based on a locale provided by `libc`, you might need to add ICU-based collations to your tables after importing their data into AlloyDB. For more information, see [Supported locales for imported data](#locales).\n\n### Import archived data from files\n\nAlloyDB lets you import\ndata from files located in a Cloud Storage bucket.\nAlloyDB supports a variety of file formats for data\nimport, including the following:\n\n- [CSV](/alloydb/docs/import-csv-file), with the contents of one table\n per file, loaded using `psql`.\n\n- [DMP](/alloydb/docs/import-dmp-file), a binary archive of a whole\n PostgreSQL database, imported using `pg_restore`.\n\n- [SQL](/alloydb/docs/import-sql-file), a plain-text reconstruction of a\n PostgreSQL database, processed with `psql`.\n\n### Migrate an active instance with Database Migration Service\n\nAs an alternative to manually importing data-dump files, you can use\n[Database Migration Service for AlloyDB](/database-migration/docs/postgresql-to-alloydb).\nThis service lets you migrate the entire contents of an\nactive PostgreSQL instance---including all of its databases and\nmetadata---into a new AlloyDB cluster. Database Migration Service can\nhelp you transition your existing applications to using\nAlloyDB as their new datastore with minimal downtime.\n\n### Supported locales for imported data\n\nAlloyDB supports the following\n[locales](https://www.postgresql.org/docs/16//locale.html):\n\n- The full set of ICU-provided locales.\n- A limited set of locales provided by `libc`:\n - `C.UTF-8`\n - `en_US.utf8`\n\nIf the database you want to import into AlloyDB defaults\nto a `libc` locale other than the two listed here, you can still import\nyour data, but that default won't carry over. To ensure that SQL queries\nusing `ORDER BY` sort their results properly, you might need to take\nadditional steps after importing your data.\n\nWe recommend allowing your new database to use the default locale for\nAlloyDB: `C.UTF-8`, provided by `libc`. Then, associate\n[collations](https://www.postgresql.org/docs/16//collation.html) with any\ncolumns that your application's queries might involve in `ORDER BY`\nclauses, naming an appropriate ICU-based collation for each one. You can\ndo this through [`ALTER TABLE` DDL\nqueries](https://www.postgresql.org/docs/16//sql-altertable.html), such as the following: \n\n ALTER TABLE \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-k\"\u003eTABLE_NAME\u003c/span\u003e\u003c/var\u003e\n ALTER COLUMN \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-k\"\u003eCOLUMN_NAME\u003c/span\u003e\u003c/var\u003e\n SET DATA TYPE \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eCOLUMN_DATA_TYPE\u003c/span\u003e\u003c/var\u003e\n COLLATE \"\u003cvar translate=\"no\"\u003eCOLLATION_NAME\u003c/var\u003e\";\n\nA new AlloyDB cluster defines hundreds of collations\nbased on ICU-provided locales, and you can add more using [the PostgreSQL\n`CREATE COLLATION` facility](https://www.postgresql.org/docs/16//sql-createcollation.html). To\nsee the full list of ICU-based collation names defined on an\nAlloyDB cluster,\nrun the following query on any of its instances: \n\n SELECT collname FROM pg_collation WHERE collprovider = 'i';\n\nIn addition to ICU-based collations, AlloyDB supports the\nPostgreSQL built-in collation named `ucs_basic`. This collation uses\nthe standard order of Unicode code points to enable especially efficient\nsorting. We recommend its use with columns whose appropriate sort order\nmatches that of the Unicode code-point list.\n\nExporting data\n--------------\n\nYou can use command-line utilities to export your AlloyDB\ndata into files stored on a Cloud Storage bucket, in a variety of formats:\n\n- [CSV](/alloydb/docs/export-csv-file), exporting one table per file,\n using `psql`.\n\n- [DMP](/alloydb/docs/export-dmp-file), using `pg_dump` to create a\n portable, binary archive of your whole database.\n\n- [SQL](/alloydb/docs/export-sql-file), using `pg_dump` to create a list\n of DDL and SQL statements to reconstruct your database.\n\nWhat's next\n-----------\n\n- [Migrate data from a vector database to AlloyDB using LangChain](/alloydb/docs/ai/migrate-data-from-langchain-vector-stores-to-alloydb)."]]