Verifying PostgreSQL backups and testing restores

A backup you have never restored is a hope, not a control. This page covers how to verify PostgreSQL backups, run restore drills, time recovery against RTO targets and keep evidence for auditors.

On this page

Why teams need to prove PostgreSQL backups restore

If you run self-hosted PostgreSQL against a recovery point objective and a recovery time objective, a backup job that reports success tells you very little. What you need is evidence that the copy you hold can be turned back into a working database within the time you have promised, and that the chain of WAL files needed to reach your target moment is complete. PostgreSQL's continuous archiving model is the thing under test: a base backup plus the archived WAL files written after it. Point-in-time recovery only works if both halves exist, are readable, and connect without gaps, so each restore test has to exercise that whole chain rather than one file.

Verification covers four separate questions. Backup integrity asks whether the files match the manifest written when the backup was taken, which is what pg_verifybackup checks against a backup directory. Pgbackrest's verify command checks the repository it manages. WAL continuity asks whether every segment between the base backup's start and your target time is present. Restorability asks whether the cluster actually starts and passes basic queries after recovery. Timing asks how long that took, measured against your RTO. Verification does not prove that your application data is correct, that the restored database has the access controls you expect, or that DNS, connection strings and dependent services will switch over. Those need their own checks in the restore runbook.

Teams usually need this work at four points: before go-live, after changing a backup tool or repository, on a recurring schedule, and before an audit or customer review that asks how recovery is tested. Confirm with your own environment how much data a full restore touches, how long your storage takes to read it, and who has permission to run a restore into a scratch host. Those answers, not generic figures, determine whether a drill can finish inside a maintenance window and whether your timing evidence is credible.

How backup verification fits the recovery path

The flow starts at the primary PostgreSQL server, which writes base backups and archived WAL to a backup repository. Verification then runs against that repository: checking the backup manifest and file checksums, and confirming WAL continuity from the base backup forward. A scheduled restore drill copies the backup into an isolated host that has no route back to production. Timing the restore against your recovery time target and recording the results form the evidence an auditor will ask to see.

Backups flow from the primary through verification into an isolated restore drill.

Which verification method checks which risk

A backup manifest is a record written alongside a base backup taken with pg_basebackup. pg_verifybackup reads that manifest and checks the backup directory against it, so you learn whether files are present, whether sizes match and whether the record itself is intact. It works on the files on disk without starting a server, which makes it a fast first gate after each backup job.

  • Proves: the files in the backup directory match the manifest written when the backup finished, including file presence and recorded sizes.
  • Cannot prove: that the database in those files starts, that the WAL needed for recovery was archived, or that the data was correct when it was written.
  • Incremental backups: an incremental backup has its own manifest, but its files only become a usable data directory after pg_combinebackup rebuilds it from the full backup and each incremental in order. Verify the rebuilt result as well.
  • Coverage: run it after every base backup and keep its output with the job log.

Confirm in the PostgreSQL documentation for your major version which manifest options and checksum settings your backup method writes, because those settings determine how strong the file-level check is.

What page checksum validation does and does not prove

Page checksums catch some storage-level corruption, and only if they were enabled when the cluster was initialized. PostgreSQL data checksums are a cluster-level setting, chosen when the cluster is created with initdb (or changed later with an offline tool, which you should confirm against the version you run). A backup taken from a cluster without data checksums carries no page-level protection, so the first thing to confirm is whether the source cluster has checksums enabled, by checking the data_checksums setting with SHOW data_checksums;. Do not assume it from the installation script or the team's standard template. Where checksums are on, pg_verifybackup and the backup tool's own verify command can flag pages that fail validation, which is useful evidence that the copy was read without detected damage.

A clean checksum result does not prove the backup restores to a usable state or that the application data is correct. Checksums test that individual pages match what was written, not that the WAL needed for point-in-time recovery is complete, that the restore command works in your environment, or that the database starts and serves the right rows. They also cannot detect logical errors such as a bad migration, a deleted table, or an application writing wrong values, because those pages are checksummed faithfully. Treat the checksum result as one input to a restore test, not as the test itself. The restore drill described elsewhere on this page is what shows the database opens, replays WAL to the target time and passes your own row-count and application checks.

Confirm three things in your own environment before you rely on checksum results. First, whether data checksums were enabled at cluster creation and whether the standby and any restored cluster inherit that setting. Second, which verification commands your backup tool runs by default, and whether they read data pages or only file manifests, since a manifest check alone does not validate page contents. Third, where the verify logs are stored and who reviews them, because an auditor will ask for dated output tied to a specific backup set. Record the PostgreSQL version, the checksum setting and the verify output together so the evidence can be traced back to the backup it describes.

How to set up a scheduled restore drill

This sequence turns a one-time restore test into a repeatable drill that proves a PostgreSQL backup can be recovered to a chosen point in time, within the recovery time target, and leaves a record an auditor can read.

  1. Define the restore target and isolated environment

    Name the database cluster, the recovery point you will test (for example, the most recent commit or a specific timestamp), and the recovery time target the drill must meet. Provision a restore host that has no network path to production, no production credentials and enough disk for the data directory plus WAL replay. Confirm the isolation by attempting a connection from the restore host to a production database and checking that it fails. The step is done when the target, the timing goal and the isolation check are written into the drill record before any restore begins.

  2. Select the backup set and WAL for the target

    Identify the most recent full backup taken before the recovery target, any differential or incremental backups that the chain depends on, and the archived WAL files needed to reach the target time. Confirm that the WAL sequence has no gaps between the backup's start point and the target. If you use pgBackRest or another backup tool, list the backup set with its own info command and record the backup label, type and stop time. If you use pg_basebackup incremental backups, confirm the full chain is present, since pg_combinebackup needs every backup in it. The check is a recorded backup label and a WAL range that covers the target with no missing segments.

  3. Run the verification steps on the backup

    Before restoring, run the verification step for the backup tool in use. For a plain-format base backup, pg_verifybackup checks the backup manifest against the files on disk, and it can be run against the backup directory. For pgBackRest, run its verify command against the repository, which checks backup and WAL file integrity. Record the exit status and the output for each backup in the set. A failed verification stops the drill, and the failure becomes a finding to investigate before the backup is trusted again. The step is complete when each backup in the chain returns a clean result and the output is saved with the drill record.

  4. Restore to the isolated host with point-in-time recovery

    Restore the base backup to the isolated host, then configure recovery to replay archived WAL up to the target. Set the recovery target (time, transaction ID, or named restore point) and the recovery target action in the configuration, and place the recovery signal file so the server enters targeted recovery. Use the restore command provided by the backup tool so that WAL is fetched from the same repository production uses. The check is that the server reaches the target and logs the point at which recovery stopped, and that this point matches the target in the drill record.

  5. Start the instance and run data checks

    Start the restored instance and confirm it accepts connections and leaves recovery mode as configured. Run application-level checks, such as a read of a known customer record, a login through the application's test account, or a query that the application runs on its critical path. Compare row counts for the key tables against counts recorded at the same recovery point from production, or against a known checksum of a reference table if counts are not practical. Run a read-only check of the page checksum status if data checksums are enabled, and review the server log for corruption warnings. The step is complete when every check passes and each result is recorded with its query or script.

  6. Record start and end times against the recovery time target

    Log the time the restore began, the time the instance accepted application checks, and the time the last check passed. Subtract the start from the end to get the elapsed recovery time and compare it with the recovery time target written in step one. Note which phase took longest, such as copying the backup, fetching WAL or replay, so the next drill can be compared with this one. The check is a timed record that shows whether the target was met and where the time went, even when the drill passes.

  7. Tear down the environment and file the result

    Stop the restored instance, remove the restored data directory and any copied WAL from the isolated host, and confirm no production credentials remain on it. Write a drill record with the date, the backup label, the recovery target, the verification output, the check results, the elapsed time, the operator name and the outcome. Store the record in a location the audit and security teams can read, and open a tracked issue for any failed check or missed target. The drill is closed when the record is filed and the teardown check shows the host is clean.

Timing recovery against RTO targets

A recovery time objective is only as credible as the timings behind it. The cards below cover each stage of a restore that adds to the clock, from the drill itself to the people and connection changes that finish the job. Each one shows where a drill can understate or overstate real recovery time.

Measure restore duration in the drill

Start the timer when the restore command runs and stop it when the application passes its checks, not when the database reports ready. Record the base backup copy time separately from the total, because the two scale differently. Drill timings are the only honest input to an RTO claim. Treat estimates from backup size or disk speed as planning guesses until a drill confirms them.

Continuous archiving docs

Account for WAL replay time

Point-in-time recovery replays archived WAL from the base backup forward to the target. The replay volume depends on how much write activity sits between the backup and the target time, so a restore to the end of a busy day takes longer than one to an early-morning point. Measure replay throughput in the drill and check the worst case, such as a restore from the oldest retained base backup.

Size network and repository throughput

Restore speed is capped by the slowest link between the repository and the target host, whether that is object storage, a backup server or a network share. Test the read path under real conditions, including parallel restore jobs and any encryption or decompression overhead. Ask your storage team whether the drill ran on the same network path a real incident would use.

Match production data volume

A drill against a small or sanitized dataset will finish far sooner than production, and the gap is not linear once indexes, large tables and WAL volume grow. Restore a copy with production-scale data, or at least the same largest tables and database count. Record the data size next to every timing so the RTO claim can be tied to a specific volume.

Time application validation and client repointing

A database that starts is not a recovered service. Add the time for application smoke tests, data spot checks and reconnection, including connection poolers such as PgBouncer, which must point at the restored primary and drop stale connections. Confirm how the pooler configuration changes during recovery and whether that change is scripted or manual.

PgBouncer site

Time the human steps in the runbook

Declaring the incident, locating the right backup, approving the restore point and handing off between teams often takes longer than the restore itself. Walk through the runbook during the drill with the people who would be on call, and time each decision. Gaps that appear only at night or without the usual lead engineer belong in the RTO estimate.

Verification options and when each fits

This table compares four ways to check that PostgreSQL backups are usable: pg_verifybackup, pgBackRest verify, checksum validation and a full restore drill. Read each row for what the check proves, what it needs and what it leaves unproven, then combine options, since no single check covers the whole recovery path.

OptionWhat it checksWhat it needsWhat it cannot showWhen to use it
pg_verifybackupWhether files in a backup directory match the backup manifest, including sizes and checksums recorded at backup timeA backup taken with a manifest, plus access to the backup directory and the pg_verifybackup tool from your PostgreSQL versionWhether the cluster starts, replays WAL or serves correct data after restoreAfter each base backup or pg_basebackup run, and before copying backups to another location
pgBackRest verifyWhether files in the repository match stored checksums and whether WAL archives in the repository are present and validAccess to the pgBackRest repository and its configuration, with the stanza in placeWhether the database restores to a consistent state at a chosen point in time, or how long that takesOn a schedule against the repository, to catch missing or damaged files early
Page checksum validationWhether data page checksums stored in the cluster match page contents, which can reveal some on-disk corruptionData checksums enabled at cluster initialization or by a supported offline process, and a read of the data filesWhether the backup itself is complete, whether WAL is recoverable, or whether application data is logically correctOn a schedule for production clusters, and when storage or hardware errors are suspected
Full restore drill to an isolated hostWhether the backup restores, WAL replay reaches the target point, the cluster starts and key queries succeedA spare host or VM isolated from production, enough storage and compute for a restore, and a written runbookBehavior under production load, or recovery time for a failure you have not rehearsedAt a scheduled interval and after changes to backup tooling, PostgreSQL version or storage, with timings recorded against your recovery time target

Protecting restore drills and evidence

A restore drill proves recovery only if the environment, the copies and the records behind it are protected as carefully as production. The cards below cover the access, data handling and change controls that keep drills safe and their evidence credible to auditors.

Isolate the restore environment

Run restore drills in a network segment and account that cannot reach production databases, production secrets or production backup write paths. A drill host that holds production credentials turns a recovery test into a second attack surface. Confirm that the restored instance cannot send mail, call external APIs or reuse application passwords, and that restore hosts are rebuilt or wiped after each drill.

Continuous archiving docs

Limit access to repositories and keys

Grant read access to backup repositories and object storage buckets only to the identities that run restores, and separate write access used by backup jobs from read access used by drills. Keep a restorable copy of backup encryption keys in a controlled location, since a repository that cannot be decrypted is lost data. Check who can read or delete keys and whether those actions are logged.

Avoid exposing production data

Restore drills often run against full production copies, which moves personal or regulated data into a less controlled environment. Decide in advance whether the drill restores the full dataset, a masked subset or a schema-only check, and document the choice. Where full data is needed for timing, apply the same encryption, access rules and deletion timing that production uses, and delete the restored data when the drill ends.

Protect logs and evidence records

Store drill outputs, verification results, timing records and restore logs in a location the drill operators cannot silently edit, such as write-once storage or a log service with separate administrators. Record the backup set identifier, the PostgreSQL version, the restore start and end times and the person who ran the drill. An auditor will ask whether the evidence could have been changed after the fact, so check that the record can be traced to the run.

Put runbooks under change control

Keep restore runbooks, drill scripts and recovery time measurement procedures in version control with reviewed changes and a named owner. A runbook that changed without review can make a drill pass for the wrong reason, such as skipping a step that production recovery needs. Tie each runbook version to the drill results it produced, so that a reader can see which procedure was tested.

What evidence auditors ask for after a restore test

What records should a PostgreSQL restore drill leave behind?

Each drill should leave a dated record that another person can read without asking the engineer who ran it. The core set covers the drill date, the scope (which cluster, database or table set was restored), the backup set used, the WAL range needed to reach the target, the target time, and the verification output. Add the restore logs, the timings for each stage, the pass or fail criteria written before the drill, any issues found, and the retest record for each issue. Store the record in a location with access control and retention rules that your compliance team has approved, and keep the raw logs alongside the summary so the summary can be checked.

Why does the target time matter in a restore drill record?

The target time shows what the drill was trying to prove. Point-in-time recovery combines a base backup with archived WAL files, so a drill that restores to a chosen moment shows that the archive covers that moment. Record the exact target timestamp, the time zone, and the last WAL position the restore reached. Without these, a reviewer cannot tell whether the drill tested the recovery point your organization claims or only a convenient older backup. The timing of the restore against your recovery time target belongs in the same record.

Do pass or fail criteria need to be written before the drill?

Yes. Criteria written after the result are hard to defend, because they can be bent to fit what happened. Before the drill, write down what a pass means: the verification tool reports no errors, the restored database starts, row counts or checksums match agreed queries, the application smoke test succeeds, and the elapsed time is within the recovery time target. Record who approved the criteria and when. If a criterion changes after a failed run, record the change, the reason, and who agreed to it.

How should issues found in a drill be tracked to closure?

Each issue needs its own entry with a description, the step where it appeared, the severity, an owner, and the change made to fix it. Common findings include a missing WAL segment in the archive, a backup chain that depends on a removed full backup, or a runbook step that assumes a path no longer exists. The entry should link to the retest that confirmed the fix. An issue marked closed without a passing retest is a common gap that reviewers notice, so keep the retest record as its own artifact with its date and result.

What do auditors actually assess from restore test evidence?

Independent auditors and certification bodies decide whether controls operate as described, and the evidence above is what they sample. DeployOpen prepares the systems, the drill records and the evidence package, but it does not issue audit reports, attestations or certifications. Ask your auditor early which artifacts they want, in what format, and for what period. Confirm whether they expect drills on a fixed schedule, whether they accept raw logs or only summaries, and how long records must be retained under your applicable framework.

How do you keep restore test evidence tamper-evident?

Evidence is only useful if a reviewer can trust that it was not edited after the drill. Store the records in a system with write-once or versioned storage and restricted delete rights, and keep the people who run drills separate from those who approve results where your structure allows it. Record hashes of the verification output and the logs when they are generated. Keep the storage location and its access list in the record so the chain of custody can be explained. Confirm the exact controls with your security team and your auditor.

How much effort does preparing this evidence add to a drill?

Most of the added effort comes from setting up the template, the storage location and the approval step once, then filling in the record during each drill. The recurring work is the per-drill write-up, the issue tracking and the retest. Cost depends on how many clusters you run, how often you test, how many restore paths you cover, and whether your team can script the collection of logs and timings. Ask any partner for a quote that separates one-time setup, recurring drill execution, and evidence packaging for auditors, and that states what is included in each.

Limits to confirm in your environment

A restore test only proves what it actually exercised. The items below are the assumptions that most often make a passing drill misleading, so confirm each one against your own versions, repositories, data volumes and recovery targets before you record the result as evidence.

Major version and tool versions

Record the exact PostgreSQL major and minor version on the primary and every standby, along with the versions of pg_verifybackup, pgBackRest and any archiving tool. A backup taken with one version may not restore cleanly with another, and the restore drill has to run on the same versions production uses. Also confirm that the major version is still within its supported window, since its end-of-life date determines how long these restore procedures remain supported. Pin the versions in the drill record.

Support per major version
5 years
Versioning policy

Verify behavior on your repository

Confirm what verification actually reads for your repository type. Local disk, network file systems and object storage behave differently, and a check that reads only manifests or metadata will not catch damaged data files. Ask the vendor or the tool documentation exactly which files are read, whether checksums are recomputed, and how a failed check is reported to your alerting. Run one deliberately damaged copy in a test repository to see whether the failure is detected.

Incremental chains are tested

Restoring a full backup does not prove that a chain of incremental backups can be combined. Confirm that each incremental in the chain depends on a parent that is still retained, and that retention rules never delete a parent while children remain. Test a restore that starts from the newest incremental and walks the full chain, not only a restore from the last full backup. Record the chain length you tested, since a longer chain usually means longer restores.

Data checksums enabled

Check whether data checksums were enabled when the cluster was initialized, since this cannot be switched on later without a rebuild or a checksum-enabling step with downtime. Without checksums, a verification run can confirm that files are present and match their manifest, but it cannot detect silent page corruption that existed before the backup was taken. Record the result of the check on each cluster, and treat a cluster without checksums as a documented gap in the restore evidence.

Continuous archiving docs

Restore time at production volume

A drill on a small test database says little about recovery time for production. Confirm that the restore runs against a data volume close to production, on storage and network paths with similar throughput, and that the timing includes WAL replay to the target point, not only the base restore. Record how long the drill took, which steps dominated, and how much the result differs from your recovery time target. Repeat the drill when data volume or hardware changes.

Recovery target matches business RPO

Compare the recovery point your drills achieve with the data loss the business has agreed to accept. The achievable recovery point depends on how continuously WAL is archived, so a drill that restores to the last archived segment may show a gap larger than the target. Ask the business owner to confirm the figure in writing, and check that archiving frequency, standby placement and backup location all support it. Where they disagree, the agreed target governs, and the gap goes into the risk register.

How much effort and cost does restore testing take?

What drives the effort of a PostgreSQL restore test?

The effort follows the size and shape of what must be restored, not the number of backups you take. The main drivers are the cluster size and number of databases, the complexity of the backup chain (a full backup alone, or full plus differential or incremental backups that must be combined), how much isolated capacity is needed to restore without touching production, and how much application validation the drill includes. A single small database with a full backup and one repository is a short exercise. A multi-database cluster with incremental chains, encrypted repositories and several dependent applications needs more planning, more time per drill and more validation steps. Ask the provider to break the estimate down by these drivers so you can see which ones you can reduce.

What does the client need to provide for restore testing?

Restore testing depends on access and named people more than on tooling. Expect to provide read access to the backup repositories and their credentials or key management, a non-production environment with enough storage and compute to hold a full restore, and network paths that let the test environment reach the repository without reaching production databases. You also need named application owners who can confirm that restored data is usable, and a person who can approve the drill window. If repositories are encrypted, confirm early who holds the keys, because a drill blocked on a missing key wastes the whole window.

Can an internal team run PostgreSQL restore drills on its own?

Yes, many teams run restore drills in-house once the procedure is written and the environment exists. pgBackRest and other backup tools provide restore and verify commands, and PostgreSQL's own tools can check backup manifests. What in-house teams often underestimate is the work around the commands: keeping an isolated restore target available, scripting the timed run, validating application data beyond row counts, recording evidence in a form auditors accept, and fixing the runbook after each drill. Decide who owns each of these steps and whether that person has time on a recurring schedule. A partner is useful for the first drills, for the initial runbook, or when internal staff lack time, not as a permanent substitute unless you want one.

How often should PostgreSQL restore drills run?

The right frequency depends on risk, not on a fixed rule. Systems with tight recovery point and recovery time targets, regulatory scrutiny or frequent schema and application change usually justify more frequent drills, and a full restore to an isolated environment is the most convincing test. Lower-risk databases may be covered by lighter verification on each backup run plus a periodic full restore. Set the frequency from the impact of a failed restore, and schedule a fresh drill after major changes such as a PostgreSQL major upgrade, a new repository location or a change in encryption. Record the frequency in your disaster recovery plan so auditors can see that it was chosen deliberately.

What should I ask for in a quote for restore testing?

Ask for a written scope that lists each database and cluster in the drill, the backup tools and repositories in use, the restore targets and whether they are isolated, and the validation steps for each application. The quote should state what is one-time (runbook design, first drill, evidence template) and what recurs (scheduled drills, retesting after changes, evidence retention). Ask which deliverables you receive: the timed restore log, the verification output, the findings and remediation list, and the updated runbook. Confirm which items depend on your environment, such as storage capacity or access approvals, and which assumptions would change the price if they turn out to be wrong. Ask how changes to scope are handled after the quote is accepted.

Which costs recur after the first restore drill?

The recurring costs are the ones that keep the evidence current. Scheduled drills consume environment capacity and staff time each cycle. Each PostgreSQL major or minor upgrade, backup tool upgrade, repository change or schema shift can invalidate an earlier drill and needs a retest. Evidence must be stored for the period your auditors or regulators expect, so there is ongoing storage and review work. The one-time costs are the initial runbook, the first isolated restore environment, timing baselines and the evidence template. Ask whether the isolated environment is a dedicated resource that stays in place or one that is rebuilt for each drill, because that choice moves cost between fixed and per-run.

Does restore testing need a separate non-production environment?

A separate environment is strongly preferred, and it is usually the largest single infrastructure cost in restore testing. Restoring over production or a shared staging system risks overwriting live data and makes timings unreliable. The environment must be large enough to hold a full restore, reachable to the backup repository, and isolated from production credentials and networks. Some teams restore to smaller hardware to save cost, but then timing results no longer predict production recovery time, so the recovery time target cannot be checked. Ask the provider how they will measure timing on a restore target that differs from production.

How do I keep restore test evidence for auditors?

Keep a dated record for every drill that shows what was restored, from which backup set, into which environment, by whom, how long each step took and what validation passed or failed. Store the verification output, the restore logs, the application sign-off and the remediation tickets together, so a reviewer can trace one drill from start to finish. Retention periods should match your compliance obligations, which your compliance lead must confirm. An independent auditor decides whether your controls are adequate; the evidence is what makes that review possible. Ask any partner to deliver this evidence in a format your team can keep under its own control.

How DeployOpen tests PostgreSQL restores

A restore drill starts with a written scope that names the backup tool, the repositories and WAL archive in use, the databases that matter most, and the recovery targets the drill must prove. DeployOpen agrees that scope before work begins, including which failure is simulated (a lost primary, a corrupted table, or an operator error requiring point-in-time recovery) and what counts as a pass. The scope also records who on the client side approves the isolated environment and who holds the credentials needed to read the backup repository, so that access is controlled from the first day.

DeployOpen then builds an isolated restore environment in infrastructure you control, separate from production networks and without write paths back to live systems. Backups are checked with pg_verifybackup and the pgBackRest verify command against their manifests, and restores are timed from the first command to the first successful application query. The team records each step, the elapsed time per phase, and any manual intervention, then compares the result against the recovery time objective agreed in the scope. Ongoing scheduled drills can be added as a retainer, so the timing baseline keeps pace with database growth.

Each engagement ends with a findings report, a runbook that a client engineer can follow without DeployOpen present, and an evidence pack: verification output, restore logs, timings and retained configuration. Confirm with your auditor which evidence formats they accept before the first drill, because the controls you are testing against may be assessed by an independent body that DeployOpen does not represent. Fixed-scope engagements keep the deliverables and timeline in writing, and the runbook is handed over so the next drill can run in your own team.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.