PostgreSQL 18 · Backup and restore

Back up a database

Write a compressed custom-format dump that pg_restore can restore selectively.

pg_dump -U postgres -d mydb -F c -f mydb.dump

Official PostgreSQL 18 documentation

More backup and restore commands

All backup and restore commands · PostgreSQL 18 cheatsheet

Was this page helpful?