PostgreSQL

pgBackRest: Enterprise Backup for PostgreSQL

Rakesh Mamidala·Founder & Lead Engineer··7 min read

pg_dump Is Not a DR Strategy

A logical dump is perfect for migrations and single-table restores, but it is not disaster recovery for a large database — restoring it means re-running every INSERT and rebuilding every index. For real DR you want physical backups plus point-in-time recovery, and pgBackRest is the tool that does it properly. Think of it as PostgreSQL’s RMAN.

What it gives you over a hand-rolled script

  • Full, differential and incremental backups that chain together — so daily backups are small.
  • Parallel, compressed, optionally encrypted — fast on large clusters.
  • A repository on local disk or S3 / Azure / GCS, with retention policies.
  • WAL archiving + PITR, backup verification (checksums), and delta restore that copies only changed files.

The setup, in RMAN terms

A stanza is pgBackRest’s name for a configured database + its repository (roughly, an RMAN catalog entry). You point PostgreSQL’s archive_command at pgBackRest so every WAL segment is shipped to the repo, then take backups:

bash
# postgresql.conf: ship WAL to the repo (enables PITR)
#   archive_mode = on
#   archive_command = 'pgbackrest --stanza=app archive-push %p'

pgbackrest --stanza=app stanza-create        # one-time init
pgbackrest --stanza=app --type=full backup   # weekly full
pgbackrest --stanza=app --type=diff backup   # daily differential
pgbackrest --stanza=app --type=incr backup   # hourly incremental
pgbackrest --stanza=app check                 # verify archiving works

Point-in-time recovery

The payoff: recover the whole database to a specific moment — the instant before a bad deploy or a DROP TABLE. pgBackRest restores the right base backup and replays WAL up to your target:

bash
pgbackrest --stanza=app --type=time \
  --target='2026-07-16 14:29:00' restore
# then start PostgreSQL — it replays WAL to that timestamp and stops.

Where it fits with logical dumps

Keep both. pgBackRest is your DR and PITR for the running database; a periodic logical pg_dump is still handy for portable snapshots, single-table restores, and moving between major versions. Different jobs — run both.

A database worth backing up properly

DBMigrateAIPro lands your data on PostgreSQL with per-partition proof it arrived intact — so your first pgBackRest full backup is of a database you trust. Free for Year 1.