Overview
This migration method involves:- Creating a full backup of your source database using
pg_dump - Transferring the dump file to your local environment or staging area
- Restoring the database to PlanetScale Postgres using
pg_restoreorpsql
Prerequisites
Before starting the migration:- Ensure you have PostgreSQL client tools installed (
pg_dump,pg_restore,psql) - Have read access to your source PostgreSQL database
- Have connection details for your PlanetScale Postgres database from the console
- Ensure the disk on your PlanetScale database has at least 150% of the capacity of your source database. If you are migrating to a PlanetScale database backed by network-attached storage, you can resize your disk manually by setting the “Minimum disk size.” If you are using Metal, you will need to select a size when first creating your database. For example, if your source database is 330GB, you should have at least 500GB of storage available on PlanetScale.
- Verify sufficient storage space for the dump file
- Plan for application downtime during the migration
Step 1: Create Database Dump
For a complete database dump:
For a custom format dump (recommended for large databases):
Command options explained:
--verbose: Provides detailed output during the dump process--no-owner: Excludes ownership information from the dump--no-privileges: Excludes privilege information from the dump-Fc: Creates a custom format dump (binary, compressed)-f: Specifies the output file name
Step 2: Get PlanetScale Connection Details
From your PlanetScale console:Step 3: Restore to PlanetScale Postgres
For SQL format dumps:
For custom format dumps:
For parallel restoration (faster for large databases):
Step 4: Verify Migration
After the restore completes, verify your migration:Check table counts:
Verify data integrity:
Check for errors in logs:
Review the output from the pg_restore command for any errors or warnings.Troubleshooting
Common Issues:
Permission errors:- Ensure your PlanetScale user has appropriate permissions
- Check that connection details are correct
must be able to SET ROLE "some_role" when running CREATE DATABASE ... OWNER ... or during a restore, this occurs because your current user doesn’t have membership in the role you’re trying to assign as owner.
To resolve this, grant the role to your current user first:
--no-owner flag with pg_restore or pg_dump to skip ownership assignments entirely:
- Some PostgreSQL extensions may not be available in PlanetScale Postgres
- Review the extension compatibility guide
- If using large objects (BLOBs), add
--blobsflag to pg_dump
- For large databases, consider breaking the dump into smaller chunks
- Use custom format with parallel restoration
Performance Tips:
- Use custom format: Binary format with compression is more efficient
- Parallel jobs: Use
--jobsparameter for faster restoration - Network considerations: Ensure stable network connection for large transfers
- Disk space: Monitor available disk space during dump creation
Schema Considerations
Before migration, review:Next Steps
After successful migration:
For more advanced migration scenarios or larger databases, consider WAL streaming or Amazon DMS methods.
If you encounter issues during migration, please reach out to support for assistance.

