Database Migration
Using the SQL script format
pg_dump -U <username> -h <host> -p <port> -t <tablename> <databasename> -f dump.sqlpsql -U <username> -h <host> -p <port> -d <databasename> -f dump.sql
### Using the custom format
`pg_dump` can also be used to dump a database in an archived format. Archived formats cannot be restored using `psql`, instead `pg_restore` is used. This has some advantages like smaller filesize and bandwith savings, but also speedups in the restore process by restoring concurrently.
In this guide we will use the "custom" format. It is compressed by default and provides the most flexible restore options.
```bash
pg_dump -U <username> -h <host> -p <port> -F c <databasename> -f dumpLast updated
Was this helpful?