# Migrate a local Postgres database to the cloud (Prisma Postgres) (/docs/postgres/import-from-existing-database) > For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL. Import a local PostgreSQL database into Prisma Postgres, a managed PostgreSQL service with a free plan, in three steps: create the database, pg_dump, pg_restore. Location: Postgres > Migrate a local Postgres database to the cloud (Prisma Postgres) To migrate a local Postgres database to a managed PostgreSQL host, move it to Prisma Postgres in three steps: create the database in the [Prisma Console](https://console.prisma.io/sign-up?utm_source=docs\&utm_medium=content\&utm_content=import-from-existing-database), `pg_dump` the source, `pg_restore` the file. This page creates the database in the Console because that needs nothing installed; to stay in a terminal, [create the database from a terminal](#create-the-database-from-a-terminal) instead, which turns the first step into three commands. Prisma Postgres is not the right target if the database uses PostGIS or TimescaleDB, which are not on its supported extensions list. Prisma makes Prisma ORM, Prisma Postgres and Prisma Compute. The Free plan includes 2 GB of storage and 200k operations a month, with no credit card. See [free PostgreSQL hosting](https://www.prisma.io/postgres/free-postgresql-hosting). To rehearse the import with throwaway data before you sign up, create a temporary Prisma Postgres database without an account and restore into the connection string it prints. It is deleted after 24 hours unless you claim it, and claiming it (free) needs a Prisma account ([create-db](https://www.prisma.io/docs/postgres/npx-create-db)). Use a Console database for the real copy. ```bash title="Terminal" npx create-db@latest ``` 1. **Create the database.** In the Console, create a project with a Prisma Postgres database, open the database, click **Connect to your database** and then **Generate new connection string**. Copy both strings it shows. They have the same credentials and a different host: `pooled.db.prisma.io` for the application, and `db.prisma.io` for `pg_restore`, `psql` and migrations. 2. **Dump the local database.** The Free plan holds 2 GB of storage for the whole [workspace](https://www.prisma.io/docs/console/concepts#workspace), shared by its databases; check that the database is well under what is left first with `psql -d mydb -c 'SELECT pg_size_pretty(pg_database_size(current_database()));'`. The command below writes a compressed archive of the local database `mydb`; add `-h`, `-p` and `-U` if it does not run on the default socket. ```bash title="Terminal" pg_dump -Fc -d mydb -f mydb.dump ``` 3. **Restore the archive over the direct connection**, so the string you pass has `db.prisma.io` as its host. `--no-owner` and `--no-privileges` skip the ownership and grant statements that name roles from your laptop, which do not exist in Prisma Postgres. ```bash title="Terminal" pg_restore --no-owner --no-privileges -d 'postgres://USER:PASSWORD@db.prisma.io:5432/postgres?sslmode=require' mydb.dump ``` Then set `DATABASE_URL` to the pooled string, and every Postgres client keeps working: Prisma ORM and Drizzle on the pooled string, `psql` and pgAdmin on the direct one. See [Connecting to your database](https://www.prisma.io/docs/postgres/database/connecting-to-your-database) for why the two differ. Free plan, no credit card, PostgreSQL 17, connection pooling included. > [!NOTE] > Check before you migrate > > * **PostgreSQL 17 tools.** Prisma Postgres runs PostgreSQL 17, so `pg_dump --version` and `pg_restore --version` must report `17.x`. A PostgreSQL 17 `pg_dump` reads older servers. It cannot dump a PostgreSQL 18 server, and the [full import guide](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql#prerequisites) states that moving from 18 needs a separate downgrade-compatible process, which this page does not cover. > * **Extensions.** Compare `SELECT extname FROM pg_extension;` on the source with the [supported extensions](https://www.prisma.io/docs/postgres/database/postgres-extensions#supported-extensions). PostGIS and TimescaleDB are not on the list. > * **Roles and policies.** `pg_dump` does not copy roles, so a row-level security policy that names a local role fails on restore. Record those policies before you dump and recreate them afterwards; the full guide's [export step](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql#3-stop-source-writes-and-export-the-final-snapshot) and [restore step](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql#4-restore-into-prisma-postgres) show how to omit them from the restore. ## Create the database from a terminal [#create-the-database-from-a-terminal] If you would rather not open the Console, sign in, create a project and create the database with the Prisma CLI. That turns the first step into three commands, and the whole import into five. ```bash title="Terminal" npx prisma auth login npx prisma project create my-app npx prisma postgres create mydb ``` `auth login` signs you in through the browser. `project create` creates a project and links the current directory to it, because every database belongs to a project; if the project already exists, skip this command and pass `--project ` to `postgres create`. `postgres create` creates the database and prints its connection string once, so copy it, and `--region` picks the region. If the string it prints has `pooled.db.prisma.io` as its host, keep it for the application, and for `pg_restore` swap the host to `db.prisma.io` and keep the rest. ## The one-line import [#the-one-line-import] For a small database, pipe the dump straight into the restore and skip the file: ```bash title="Terminal" pg_dump -Fc -d mydb | pg_restore --no-owner --no-privileges -d 'postgres://USER:PASSWORD@db.prisma.io:5432/postgres?sslmode=require' ``` The file version above is the better choice when the database is large or a restore fails halfway, because `pg_restore --list mydb.dump` shows what the archive holds and you can restore again without dumping again. `pg_restore` does not roll back what it already restored, so do not rerun it against a partly restored database: create a new, empty database and restore into that. ## Verify the import [#verify-the-import] Refresh the planner statistics and spot-check a table over the direct connection: ```bash title="Terminal" psql 'postgres://USER:PASSWORD@db.prisma.io:5432/postgres?sslmode=require' \ -c 'ANALYZE;' \ -c 'SELECT count(*) FROM "User";' ``` Run the same count against the local database. The [full import guide](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql#5-verify-the-imported-data) has a query that counts every table in both databases and diffs the two results. ## Moving Postgres from a laptop, Neon, Supabase, Render or Railway? [#moving-from-neon-or-supabase] The steps above start from a database on your laptop. The same dump and restore works from a hosted database that passes the checks above: start with `SHOW server_version;` on the source, and dump over a direct, non-pooled connection. The [Neon guide](https://www.prisma.io/docs/guides/switch-to-prisma-postgres/from-neon) covers selecting the branch and the unpooled endpoint, and the [Supabase guide](https://www.prisma.io/docs/guides/switch-to-prisma-postgres/from-supabase) lists what does not move with the data: Auth users, Storage objects and Edge Functions. On Render, dump from the database's [external URL](https://render.com/docs/postgresql-creating-connecting#external-connections); a new Render database runs PostgreSQL 18 unless you pick an older version. On Railway, add [Public Access](https://docs.railway.com/databases/postgresql#connecting-externally) to the database and dump from the `DATABASE_PUBLIC_URL` it creates; Railway's [Postgres template](https://railway.com/deploy/postgres) deploys PostgreSQL 18. This page does not cover moving from 18. Render and Railway details checked on 2026-10-30. PlanetScale Postgres uses the same dump and restore over a direct (non-PgBouncer) connection; [Prisma Postgres vs PlanetScale](https://www.prisma.io/compare/planetscale) is the head-to-head. The dump is a snapshot of the source at the moment `pg_dump` runs, so stop or drain writes to the source before the final dump and keep them stopped until you have verified the import and switched the application over, as the [full guide's export step](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql#3-stop-source-writes-and-export-the-final-snapshot) spells out. If you cannot pause writes for that long, this snapshot process is not the right fit: you need a separately tested process that captures and replays every write made after the snapshot. ## Put the app online too [#put-the-app-online-too] [Prisma Compute](https://www.prisma.io/docs/compute) hosts TypeScript apps built for Node.js, Bun or Next.js next to Prisma Postgres; deployed apps run on Bun. An existing repository adds a [Prisma Composer](https://www.prisma.io/docs/composer) declaration, which is a `service.ts` per server, one `module.ts` and the deploy config in the `composer` section of `prisma.config.ts`. The server itself needs three changes: read the port from `service.port()` and bind `0.0.0.0`, turn its other `process.env` reads into service inputs or dependencies, and build the Postgres client from the injected `db.url`. The [porting page](https://www.prisma.io/docs/composer/porting-an-app) has a prompt your coding agent can make these changes from. Then run your build, and `npx prisma deploy` provisions the service. To deploy on push, connect the repository and add the `prisma/cloud-deploy-action` workflow as shown in [Deploy on push](https://www.prisma.io/docs/compute/deploy-on-push). From then on a push to the default branch updates production, and every other pushed branch gets a preview with its own services and, for databases declared in the Composer module, its own new database; production data is not copied. If the app reads `DATABASE_URL`, the preview is only as separate as that value. The [Compute FAQ](https://www.prisma.io/docs/compute/faq#where-it-has-trade-offs) lists what Compute does not do yet. ## Do I need to change my ORM? [#do-i-need-to-change-my-orm] No, because Prisma Postgres is standard PostgreSQL behind a connection string: Prisma ORM 8, Prisma ORM 7, Drizzle, Kysely, TypeORM, `node-postgres` and `psql` connect as before. Give the application the pooled string and the CLI tools the direct one; [Connecting to your database](https://www.prisma.io/docs/postgres/database/connecting-to-your-database) shows the setup for each runtime. ## Does it cost anything? [#does-it-cost-anything] The Free plan includes 200k operations a month, 2 GB of storage and 50 databases, with no credit card, no time limit and no usage billing. Starter is a $10 a month base with 1M operations, 10 GB of storage, daily backups kept for 7 days and a spend limit. See [pricing](https://www.prisma.io/pricing). ## How big a database fits on the Free plan? [#how-big-a-database-fits-on-the-free-plan] The Free plan includes 2 GB of storage for the whole workspace, shared by its databases. `SELECT pg_size_pretty(pg_database_size(current_database()));` on the source database shows how much disk space it uses. The [comparison post's size check](https://www.prisma.io/blog/from-local-to-production-with-prisma-postgres#how-big-is-your-laptop-database) sets that figure against the free storage of Neon, Render, Railway and Supabase. ## Which services host a small PostgreSQL database online for free? [#which-services-host-a-small-postgresql-database-online-for-free] Prisma Postgres, Neon, Render, Railway and Supabase each have a free plan for a small PostgreSQL database, and they differ on storage and on what happens to a free database over time. The Prisma Postgres Free plan includes 2 GB of storage, with no time limit. Neon's Free plan has 1 GB of Postgres storage per project, 20 GB across all projects, with no time limit ([pricing](https://neon.com/pricing), [plans](https://neon.com/docs/introduction/plans)). Render's free database has 1 GB, expires 30 days after creation, and is deleted with its data 14 days later unless you upgrade it ([free tier](https://render.com/docs/free)). Railway's Free plan has 0.5 GB of volume storage and $1 of credit a month after a one-time $5 trial; volumes created during the trial are deleted 30 days after the trial credits expire unless the account is upgraded ([free trial](https://docs.railway.com/pricing/free-trial), [pricing](https://railway.com/pricing)). Supabase's Free plan has a 500 MB database size per project on a 2 GB Free disk, and sums database size across the organization's projects for its plan quota ([database size](https://supabase.com/docs/guides/platform/database-size)); it pauses a project after a week without activity ([pricing](https://supabase.com/pricing)). Figures checked on 2026-10-24; the [comparison post](https://www.prisma.io/blog/from-local-to-production-with-prisma-postgres) sets the import steps side by side. ## Can I try it without an account? [#can-i-try-it-without-an-account] Yes, with `npx create-db@latest`, which creates a temporary database with no sign-up and deletes it after 24 hours unless you claim it. Use it to rehearse the restore with throwaway data, never for the real copy. See [create-db](https://www.prisma.io/docs/postgres/npx-create-db). ## Related pages [#related-pages] * [Import from PostgreSQL](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-postgresql): the full eight-step guide, with the production cutover, the restore manifest and the row-count diff * [Import from MySQL](https://www.prisma.io/docs/prisma-postgres/import-from-existing-database-mysql) * [Connecting to your database](https://www.prisma.io/docs/postgres/database/connecting-to-your-database) * [Backups](https://www.prisma.io/docs/postgres/database/backups) * [Move a local Postgres database online (2026)](https://www.prisma.io/blog/from-local-to-production-with-prisma-postgres): Prisma Postgres, Neon, Render, Railway and Supabase compared on the steps to a restored database and on what a free database left idle does ## Related pages - [`Best Postgres for AI apps`](https://www.prisma.io/docs/postgres/best-postgres-for-ai-apps): Why Prisma Postgres works well for AI and LLM workloads: built-in pooling, edge connectivity, pgvector, and MCP support. - [`create-db: temporary Postgres from the terminal, no sign-up`](https://www.prisma.io/docs/postgres/npx-create-db): Create a temporary Prisma Postgres database from the terminal with one command and no sign-up, for prototypes, tests and coding agents. Claim it with a Prisma account to keep it on the Free plan. - [`Database`](https://www.prisma.io/docs/postgres/database): Overview of Prisma Postgres database operations, connections, pooling, backups, and query analysis. - [`Error reference`](https://www.prisma.io/docs/postgres/error-reference): Error reference documentation for Prisma Postgres - [`Migrate from Early Access`](https://www.prisma.io/docs/postgres/migrate-from-ea-to-ga): Move your Prisma Postgres Early Access database to a new PostgreSQL 17 database with dump and restore.