How to test that your Supabase backup actually restores

A restore test, also called a restore drill, takes an existing backup, restores it into a disposable database, and checks what came back: the restore completes, the tables exist, the data is there. It is the only way to know a backup works. A truncated dump, a dump taken with the wrong role, and a half-failed job all look the same as a good backup while they sit in a bucket. This guide covers three ways to run the test against a Supabase project: by hand in about fifteen minutes, with BackupDrill’s open-source CLI, or fully managed on a schedule.

Three ways to test a Supabase backup restore

By hand
Restore a pg_dump into a throwaway Docker Postgres, then check the tables and rows. About 15 minutes, free
Open-source CLI
backupdrill drill runs the same restore and checks in one command, on your machine or in CI. Free, MIT licensed
Hosted
BackupDrill restores your latest snapshot every day on paid plans and emails you a report every week. Free runs one drill, after the first backup

Checked November 2026.

Prefer watching? A one-minute video on where backups go and what a drill proves.

The manual restore test, step by step

You need a custom-format dump of your database, plus Docker and pg_restore on your machine. If you don’t have a dump yet, the backup options guide has a working pg_dump command. Nothing below connects to production.

Step 1: start a throwaway Postgres

Match your Supabase Postgres major version (run select version(); in the SQL editor; Supabase projects run PG 15 or 17):

TEST_PW="$(openssl rand -hex 16)"

POSTGRES_PASSWORD="$TEST_PW" docker run -d --rm --name restore-test \
  -e POSTGRES_PASSWORD \
  -p 127.0.0.1:55432:5432 \
  postgres:17-alpine

# Wait until it accepts TCP connections
docker exec restore-test pg_isready -h 127.0.0.1 -U postgres

The container is about to hold a copy of your production data, so it gets a new random password each time. Binding the port to 127.0.0.1 keeps the network out, but any account on the same machine can still connect to it. With -e POSTGRES_PASSWORD and no value, Docker reads the password from its own environment instead of taking it as a command-line argument.

The -h 127.0.0.1 matters: during initialization the official image briefly runs a temporary server that only listens on a Unix socket, so a default socket check can pass while TCP connections still get dropped mid-restore. Checking over TCP tells you the real server is ready.

Step 2: stub what Supabase provides, then restore the dump

A public dump leans on things only a Supabase project has: the API roles, and the auth helper functions that column defaults and policies call. Create simple stand-ins first. Skip this and a table defined with owner uuid default auth.uid() never gets created, its rows fail to load, and pg_restore reports the errors but carries on to the end, leaving that table unrestored. Among the expected Supabase errors this is easy to miss, so the restore looks finished while a table is missing.

export TEST_DB="postgresql://postgres@127.0.0.1:55432/postgres"

# stand-ins for what a Supabase project provides (auth.users left out on purpose)
PGPASSWORD="$TEST_PW" psql "$TEST_DB" --set ON_ERROR_STOP=1 -c "
  create role anon; create role authenticated; create role service_role;
  create schema auth;
  create function auth.uid()   returns uuid  language sql stable as 'select null::uuid';
  create function auth.role()  returns text  language sql stable as 'select null::text';
  create function auth.email() returns text  language sql stable as 'select null::text';
  create function auth.jwt()   returns jsonb language sql stable as 'select null::jsonb';" \
&& PGPASSWORD="$TEST_PW" pg_restore \
  --no-owner --no-privileges \
  --dbname "$TEST_DB" \
  backup-2026-07-10.dump

The password goes in front of each command instead of into TEST_DB, where the process list would show it, or into an exported PGPASSWORD, which would make later commands in that terminal, production ones included, use the test password instead of reading ~/.pgpass.

--no-owner --no-privileges is not optional: the dump records owners and grants for Supabase roles (anon, authenticated, service_role) that do not exist in a bare container, and without the flags you get a long list of ownership errors.

Even with them, expect some errors, and learn to sort them. Errors that reference auth.users (a foreign key into it, a policy or view that reads it) come from the sandbox, which deliberately has no users table, not from your backup. An error that a role or an auth function does not exist is different: it means a stub is missing, and the object it belongs to did not restore. Do not rerun pg_restore into the same database: tables that already loaded would load their rows a second time. Remove the container, start a fresh one, add the missing stub, and restore from scratch. The stricter two-pass version of this procedure, the one BackupDrill’s own drill engine uses, is in the manual backup guide. One more error you can ignore: schema "public" already exists. The dump recreates the public schema that every fresh Postgres already has. Errors naming your own tables, indexes, or constraints are real findings: that is your backup failing to restore, which is what this test is for.

Step 3: verify what came back

# Table count — compare against the same query on production
PGPASSWORD="$TEST_PW" psql "$TEST_DB" -c "select count(*) from pg_tables where schemaname = 'public';"

# Spot-check tables that must never be empty
PGPASSWORD="$TEST_PW" psql "$TEST_DB" -c "select count(*) from public.users;"
PGPASSWORD="$TEST_PW" psql "$TEST_DB" -c "select count(*) from public.orders;"

# Is the backup recent? Check an append-heavy table
PGPASSWORD="$TEST_PW" psql "$TEST_DB" -c "select max(created_at) from public.orders;"

These answer three questions: did every table come back, did the important tables come back with data in them, and is the data recent. A backup job that has been failing unnoticed for a month passes the first two checks and fails the third.

Step 4: application-level check, then destroy

SQL checks prove structure and volume; they do not prove your application can use the data. Run the queries your app issues (the dashboard aggregate, the reporting join) against $TEST_DB, with the same PGPASSWORD="$TEST_PW" in front. Keep in mind that a --schema=public dump does not include the auth schema, so login flows will not work against the sandbox. Test the data paths, not the auth paths. Then:

docker rm -f restore-test

It takes about fifteen minutes and never touches production. The catch is that it only happens when someone remembers to do it, and the week nobody remembers can be the week before you need the backup.

Our restore drill slides cover the same test for pg_dump archives from other Postgres databases, including the version mismatches and exit codes that can hide a failed restore.

Automate it: the open-source CLI

The backupdrill CLI (MIT, github.com/backupdrill/cli) runs the loop above as one command against the latest snapshot in your backup bucket (the GitHub Actions guide shows how to produce those snapshots on a schedule). It needs Docker and pg_restore locally:

npm install -g backupdrill

backupdrill drill                    # restore latest snapshot into a throwaway
                                     # Postgres and verify it
backupdrill drill --snapshot "2026-08-23T04-00-00-000Z"   # a specific snapshot
backupdrill drill --verify-all-files       # checksum every Storage file

Each drill runs these checks:

  • Archive integrity. The downloaded dump’s sha256 must match the manifest; a mismatch fails the drill immediately, before any restore is attempted.
  • pg_restore completes. Schema and data restore first, and any error there fails the drill. Post-data objects (indexes, constraints, triggers) follow in a second pass.
  • Post-data objects restored. Your own indexes, constraints, and triggers must all come back; failures that only reference Supabase-managed objects the sandbox doesn’t have are recorded in the report as expected skips rather than failures.
  • Table count matches the manifest, and no table is missing: every table recorded at backup time must exist in the restore.
  • Populated tables came back. Any table that had rows at backup time must restore non-empty. This catches a database that was only partly backed up.
  • Storage file integrity. Backed-up files are read back from your bucket and their sha256 compared to the manifest: a random sample of up to 100 files per drill by default; --verify-all-files checks every file.

Since 0.1.2 the drill also pre-installs the extensions recorded in the manifest into the sandbox before restoring. When the backup contains pgvector columns, it swaps the sandbox image for one with pgvector built in, so vector-typed tables restore instead of failing. Extensions the sandbox cannot install (Supabase-managed ones like pg_graphql) are noted in the report and only fail the drill if the restore depends on them. Configuration and the rest of the commands are in the CLI docs.

Want to see what the output looks like before you run anything? A real drill report has the full terminal output of a drill against a 199 MB database with 1,000 Auth users and 250 Storage files. It shows every check, what each one proves and what it does not, and includes a script that reproduces the whole run on your machine.

Fully managed: drills on a schedule

The hosted service runs the same engine on a schedule, so nobody has to remember: daily restore drills on every paid plan, with a report emailed every week. If a drill fails, you get an email. Supabase’s own recovery upgrade is PITR at $100/month per project. It restores to a much more precise point in time, but as with the built-in backups, Supabase’s docs do not describe scheduled restore tests for it. The two solve different problems, and you can run both. If you would rather run the whole loop yourself, the open-source CLI above runs the same checks on your own server or in CI.

What a passed drill does — and does not — prove

A pass is useful, but it has limits:

  • The public schema is what gets tested. Backups cover the public schema by default, so that is what drills verify. Supabase-managed schemas (auth, storage metadata) are not in that dump. Auth users are saved separately as auth.dump in snapshots taken since November 5, 2026; a drill restores them too and checks their row counts, but that check does not change whether the drill passes.
  • Row counts are compared with the backup, not with production. Each ordinary table’s row count in the restore, partitions included, must equal its count in the dump, which pg_dump wrote from one consistent snapshot, so rows committed after that snapshot are in neither count. The drill counts rows rather than comparing their contents. Materialized views, partitioned parents and tables owned by an extension keep only the non-empty check.
  • Storage verification is a random sample of up to 100 files per drill by default (to keep egress down), and it checks the backup copies in your bucket against the manifest, not the live files in Supabase.
  • A pass is evidence, not a guarantee. It means this snapshot restored successfully in the verification environment at that time. That tells you much more than “the backup job exited 0”, but it is still not an unconditional promise about any future restore.

How often should you test?

How often to test is one part of a wider plan. The Supabase disaster recovery runbook covers the rest: which failures each backup type can and cannot save you from, and what to do before, during, and after an incident.

  • Production projects: weekly. Frequent enough that a broken backup gets caught within days, cheap enough (one restore of one snapshot) that there is no reason to skip it.
  • After every schema migration. Migrations are where restores tend to break unnoticed: a new extension the restore target lacks, a constraint that now depends on data order, a table moved out of the dumped schema.
  • Before major releases. That is when you are most likely to need a working rollback, so check that you have one.

In Kaseya’s 2025 survey of more than 3,000 IT professionals, 15% reported testing backups daily and another 25% weekly. More numbers on how often backups get tested, and how often restores come up short, are in our backup and restore failure statistics.

FAQ

How often should I test my database backups?

For a production database, test on a schedule (weekly is a good default), plus after every schema migration and before major releases. The failures a restore test catches (a dump taken with the wrong role, a pg_dump from a mismatched version, a table that stopped being backed up without anyone noticing) usually come with changes, so test when things change and on a schedule in between.

Does Supabase test my backups for me?

No. On the Pro plan Supabase takes daily backups of your database and operates the infrastructure they live on, but it does not restore-test your project's backups. Checking that a backup restores is up to you. The same is true of your own pg_dump archives: nothing checks that recovery works until you, or a tool acting for you, runs a restore. BackupDrill automates that step: it keeps backups in your own bucket or Google Drive and runs scheduled restore drills against them.

Is there a tool that automatically tests Supabase backup restores?

Yes. BackupDrill restores the latest snapshot of your Supabase project into a throwaway Postgres every day on paid plans (Free runs one drill, after the first backup). Each drill checks the archive checksum, that every table in the backup's manifest came back, and exact row counts for ordinary tables, plus a sample of Storage files when the snapshot has them. Passing drills are rolled into a weekly summary email, and if a drill fails, you get an email. To run the same checks on your own server or in CI, use the open-source CLI: backupdrill drill.

How do I test a pg_dump backup without touching production?

Restore it somewhere disposable: start a fresh Postgres in Docker, run pg_restore with --no-owner --no-privileges against the container, check the table count and spot-check the tables that must never be empty, then delete the container. The whole loop runs on your machine and never connects to production.

What should I check after restoring a database backup?

Four things, in order: the restore completed without errors on your own objects; the table count matches the source; every table that had data at backup time is non-empty; and the data is recent (check max(created_at) on an append-heavy table). If you also back up Supabase Storage files, verify a sample of them against checksums recorded at backup time.

Sources

  • Supabase docs — Database Backups
  • Supabase — Pricing
  • Supabase docs — Upgrading
  • PostgreSQL docs — pg_dump
  • PostgreSQL docs — pg_restore
  • Supabase docs — Migrate from Postgres to Supabase

Facts and prices last verified July 11, 2026 against the sources above. Written by the team behind BackupDrill.

Want the drills to run on a schedule, with reports in your inbox, without anyone having to remember? Start free (the free plan covers backups for one project; daily restore drills start on Solo), or run the open-source CLI yourself.