← All guides

pg_dump formats: custom vs plain vs directory (pick custom)

The four pg_dump output formats compared — compression, parallel restore, selective restore — and why custom format is the right default.

The formats in one table

Plain (-Fp) writes SQL text: readable, greppable, but huge and restored single-threaded via psql. Custom (-Fc) is compressed, seekable, restorable in parallel, and supports selective restore. Directory (-Fd) is like custom split per-table and supports parallel DUMP too. Tar (-Ft) is legacy; skip it.

Why custom wins as a default

pg_dump "$URL" --format=custom --compress=6 --file=db.dump

One file, built-in compression, pg_restore --jobs=N for parallel restore, and pg_restore --list/--use-list to restore just one table — the thing you'll desperately want during an incident. Only reach for directory format when dump time itself is the bottleneck (--jobs needs -Fd).

Restore-side cheatsheet

pg_restore --list db.dump                    # what's inside
pg_restore --no-owner -d target db.dump      # full restore
pg_restore --table=users -d target db.dump   # just one table

A backup you've never restored is a hope, not a backup.

Firedrill restore-tests every backup it takes — on real infrastructure, with the report to prove it.