PostgreSQL Backup and Recovery Quiz โ PG_Dump vs. PG_BackRest
Master PostgreSQL backup and recovery โ a critical skill for every
PostgreSQL DBA. This quiz compares the two most widely used backup tools:
pg_dump for logical backups and pgBackRest for physical,
incremental, and WAL-based backups. Understanding when and how to use each tool is
essential in production database environments.
pg_dumpvspg_dumpallโ use cases and limitations- pgBackRest full, differential, and incremental backup strategies
- WAL archiving and Point-in-Time Recovery (PITR)
- Delta restore and parallel backup/restore features
- High-availability backup considerations for replica setups
- Retention policies and repository management
PostgreSQL Backup & Recovery โ Key Concepts Every DBA Must Know
PG_Dump โ Logical Backups
pg_dump exports a single database into a SQL script or archive file. It is
platform-independent, making it ideal for migrations and schema transfers. Key flags to know:
-F cโ custom format (compressed, supports parallel restore)-F dโ directory format (best for large databases)pg_dumpallโ dumps all databases including roles and tablespacespg_restoreโ restores from custom or directory format dumps
Limitation: pg_dump takes a logical snapshot โ it does not support Point-in-Time Recovery (PITR) and can be slow for very large databases.
PG_BackRest โ Physical Backups at Scale
pgBackRest is a robust backup solution designed for large PostgreSQL deployments. It supports:
- Full backups โ complete copy of the data directory
- Differential backups โ changes since the last full backup
- Incremental backups โ changes since the last backup of any type
- Delta restore โ restores only changed blocks, dramatically faster recovery
- Parallel processing โ uses multiple CPU cores for faster backup/restore
- WAL archiving โ enables PITR to any point in time
PG_Dump vs PG_BackRest โ When to Use Which
| Feature | pg_dump | pgBackRest |
|---|---|---|
| Backup type | Logical | Physical |
| PITR support | โ No | โ Yes |
| Cross-platform | โ Yes | โ No |
| Large DB performance | Slow | Fast (parallel) |
| Incremental backup | โ No | โ Yes |
| Best for | Migration, small DBs | Production, large DBs |
Common DBA Interview & Exam Mistakes
- Assuming
pg_dumpsupports PITR โ it does not - Forgetting that pgBackRest requires WAL archiving to be enabled for PITR
- Not testing restores regularly โ backups are only valid when restore works
- Skipping retention policy configuration โ disk fills up silently
- Confusing
pg_dump(single DB) withpg_dumpall(all DBs + globals)
๐ Continue Practising โ Related PostgreSQL Quizzes
Want to practice more PostgreSQL topics?
โ Back to All PostgreSQL Quizzes