Postgres Backup + Restore

Untested backups don’t exist. Practice the restore; build the muscle memory before the incident.

Step 1: pg_dump

pg_dump mydb > backup.sql

For larger DBs: pg_dump -Fc mydb > backup.dump (custom format).

Step 2: Verify backup

Step 3: Simulate loss

The restore drill only counts if it starts from real damage. Skip the simulation and you are testing the happy path, which is not the path that matters.

Step 4: Restore

The restore is the only step that proves the backup. Until restore completes successfully, the backup is theoretical.

Antipatterns

What to do this week

Three moves. (1) Run the tutorial end-to-end on your own laptop / sandbox. (2) Apply the pattern to one production workload. (3) Document the variations you needed; share with the team.