Database Backup and Restore Testing: The Backup You Have Never Restored
Database backup best practices start with the restore. How we test PostgreSQL and MySQL restores on a schedule, measure recovery time, and know the backups work before we need them.

Almost every team we meet has database backups. A job runs every night, a file lands in a bucket, and a dashboard somewhere shows a green tick. Ask when someone last restored one of those files into a working database, and the room usually goes quiet.
A backup that has never been restored is a hope, not a backup. You do not know whether the file is complete, whether the right people can reach it, how long it takes to bring back, or whether the application starts against it. You find out on the worst day of the year, under pressure, with customers waiting.
This post is about closing that gap: what to back up, what a restore test actually checks, and how to run one on a schedule so it stops being a ritual nobody has time for.
Decide what “recovered” means first
Before choosing tools, write down two numbers with the people who own the product, not only the engineers:
- Recovery point objective (RPO): how much data you can afford to lose. Last night’s backup means up to a day of lost orders, sign-ups or edits. Is that acceptable?
- Recovery time objective (RTO): how long the service can be down while you restore. An hour? A morning?
These numbers drive everything else. A nightly dump is fine if a day of loss is acceptable. If it is not, you need continuous archiving and point-in-time recovery. If the RTO is short and the database is large, a dump that takes hours to load will never meet it, however reliable it is.
Most teams have never agreed these numbers out loud. Agreeing them is often the most useful hour of the whole exercise.
The backups worth having
For PostgreSQL and MySQL, a sound setup usually has three layers:
| Layer | What it gives you | What it does not |
|---|---|---|
| Physical backups plus write-ahead logs (or binlogs) | Point-in-time recovery to any moment within the retention window | A quick way to restore a single table |
Logical dumps (pg_dump, mysqldump) |
Portable copies, single tables, moves between versions and providers | Fast restores of large databases |
| Managed provider snapshots | Simple, fast restores of a whole instance | Protection if the cloud account itself is lost or compromised |
On managed services such as Amazon RDS or Cloud SQL, automated backups and point-in-time recovery are a setting, and they should be on. On self-hosted PostgreSQL, tools such as pgBackRest or WAL-G handle base backups and WAL archiving.
Three rules apply whichever you use:
- Keep at least one copy outside the account the database runs in. If an attacker or a bad script can delete the database, they can usually delete snapshots in the same account too. A copy in a separate account or region, with deletion locked, is what saves you.
- Encrypt backups, and back up the keys separately. An encrypted backup you cannot decrypt is the same as no backup. Treat the key like any other production secret, as we describe in our secrets management order.
- Set retention on purpose. Long enough to notice silent damage, such as a bug that corrupted rows weeks ago, and no longer than your data rules allow.
What a restore test actually checks
“The backup job succeeded” tells you the job ran. A restore test tells you whether you can get your data back. A real one checks five things:
- The backup can be found and read by the people and roles who will need it during an incident, not only by the job that wrote it.
- The restore completes into a fresh instance, from the most recent backup and from an older point in time.
- The data is there. Row counts on key tables are close to production, the newest records are as recent as your RPO promises, and a few known records can be queried.
- The application works against it. Run the migrations check and a short smoke test, so you know the schema, extensions and users came back too.
- The time is measured. From “we decided to restore” to “the application answers”, written down and compared with your RTO.
The fifth check is the one teams skip, and it is the one that surprises them most. A database that dumps in twenty minutes can take far longer to load and reindex.
Make it a schedule, not a fire drill
A restore test done once, by hand, proves the backups worked that day. Backups break quietly: a bucket policy changes, a disk fills, a major version upgrade changes the tool, a new extension is not installed on the restore target. The only defence is to restore regularly and automatically.
The pattern we use looks like this:
- A scheduled job (a CI pipeline on a timer or a Kubernetes CronJob) creates a short-lived database instance from the latest backup, in an isolated network with no route to production.
- A verification script runs the data and application checks above and records the restore duration.
- The result goes where people look: a dashboard showing the last successful restore and how long it took, and an alert if a test fails or if no test has succeeded within the agreed window.
- The instance is destroyed at the end, so the test costs a few hours of compute, not a second database.
Restored copies contain production data, so treat them like production: same access rules, same encryption, and no copying them into a developer’s laptop “just for a look”. If you need realistic data for testing, that is a separate, masked dataset.
A worked case
Take a common setup: a single PostgreSQL database on a managed service, behind a web application, with automated snapshots switched on and nothing else.
A first review would usually find the same handful of gaps. Snapshots exist but live in the same account as the database. Point-in-time recovery is on, but nobody has tried it. The restore runbook is a paragraph in a wiki written by someone who has since moved on. RPO and RTO have never been written down.
The fix, in order:
- Agree RPO and RTO with the product owner.
- Copy backups to a separate account with deletion protection.
- Write the restore runbook as numbered commands, and run it once by hand during working hours, timing every step.
- Turn that runbook into the scheduled job above, so the test repeats without anyone remembering to do it.
- Add the “last successful restore” panel and alert to the monitoring the team already reads.
The first manual run is where most of the learning happens: a missing extension, a role that only existed in production, a step that only one person knew. Each one goes into the runbook, and then into the automation.
This is how our database work starts
Tested restores are the first item in how we run databases for clients. Our database service sets up backups and point-in-time recovery for PostgreSQL, MySQL, MongoDB and Redis, and tests restores on a schedule, so “the backups work” is something you can see on a dashboard rather than something you assume. You get the database configuration as code, a tested backup and restore procedure, dashboards and alerts, and upgrade and recovery runbooks your team can follow without us.
It starts with a health check of your configuration, backups and query performance, followed by a fixed-price proposal for the fixes. Engineers make the changes in stages, testing restores and rollbacks along the way, and every change that reaches production is approved by a person. Where AI helps, it reads slow query logs and schema changes and suggests improvements for engineers to check; it does not need your customer data to do that.
If you are wiring the verification into your existing pipelines, the same principles from our CI process apply: real dependencies, a clear pass or fail, and an owner for every red run. And if you want an agent to help with the investigation when a restore test fails, the limits we set for AI agents apply here too: read freely, propose, and leave the apply to a person.
Where to start this week
- Write down your RPO and RTO, even as a rough first guess.
- Check that at least one backup copy lives outside the account the database runs in.
- Restore last night’s backup into a throwaway instance and time it, start to finish.
- Note everything that surprised you. That list is your runbook.
If you would rather do the first restore with someone who has done it many times, book a free call and we will go through your backups with you.


