Skip to main content
⚑ OpenDevDocs
PostgreSQL
databasepostgresqlReferenceIntermediate

Restore PostgreSQL Database (pg_restore)

Restore a PostgreSQL database from an archive file created by pg_dump using the pg_restore CLI.

Verified: 2026-09-30
Tested on:postgres 16.x
Platforms:
linuxmacoswindows
#postgresql#pg_restore#backup#restore#cli

Command

pg_restore -h localhost -U postgres -d database_name -v backup.dump


Short Description

pg_restore restores a PostgreSQL database from an archive created by pg_dump in non-plain-text formats (such as custom -F c or directory -F d).


Examples

1. Restore with Clean / Drop Existing Schema First

pg_restore -U postgres -d production_db --clean --if-exists -v backup.dump

2. Multi-Threaded Parallel Restore (4 Cores)

pg_restore -U postgres -d production_db -j 4 -v backup.dump

3. Restore Only Specific Tables

pg_restore -U postgres -d production_db -t users -t orders backup.dump

On this page