Skip to content
Rested
All guides
9 min readWritten and maintained by Rested

PostgreSQL backup strategy for small teams

Design a PostgreSQL backup strategy using logical dumps, encrypted storage, retention, monitoring, and restore rehearsals.

Rested PostgreSQL repository overview showing a Docker Postgres backup recipe, recent runs, storage, schedule, and snapshots.
Database recovery starts with a database-aware recipe and evidence that the resulting recovery point exists.

Choose a recovery target

Start by deciding how much data loss and downtime the application can tolerate. Periodic logical dumps are portable and straightforward, but their recovery point is the last completed dump. Systems that need point-in-time recovery require a physical backup and write-ahead log strategy in addition to or instead of periodic dumps.

Write separate targets for data loss and service restoration. A team may be able to create a dump every hour yet still need half a day to retrieve it, rebuild PostgreSQL, restore extensions, load the data, and validate the application. Backup frequency addresses only part of that path.

Classify databases by impact rather than applying one schedule to every instance. Development data that can be recreated, a customer-facing transactional database, and an audit store may justify different retention, recovery points, and test frequency. Name an owner for each decision.

    Use database-aware backups

    Use PostgreSQL tools such as pg_dump for a single database or pg_dumpall when the recovery plan requires every database and global objects. A database-aware dump produces a consistent logical representation while PostgreSQL is running.

    Do not rely on copying a live PostgreSQL data directory as an ordinary filesystem backup. Without the required consistency and write-ahead log handling, the copy may not be recoverable.

    Logical and physical backups solve different recovery problems. A dump is well suited to selective restore and forward migration, while a physical base backup plus continuous write-ahead log archiving supports recovery to a chosen point between scheduled backups. Work backward from the required recovery point rather than treating one method as universally better.

      Account for roles, extensions, and versions

      A single-database dump does not by itself capture cluster-wide roles and tablespaces. Decide whether those global objects will be exported separately or recreated from managed configuration. During a rehearsal, check ownership and privileges rather than stopping when the tables appear.

      PostgreSQL documents logical dumps as a path for moving data to newer server versions, but backward restore into an older major version is not guaranteed. Use a dump tool that is compatible with the source server, read upgrade notes for extensions, and test the exact source-to-target version path before an incident.

        Protect and observe each dump

        Send dumps into encrypted off-site backup storage and avoid leaving unencrypted exports on disk longer than necessary. Record whether the dump command and the storage backup both succeeded, because either stage can fail independently.

        • Alert when an expected backup does not arrive.
        • Track output size so unexpectedly empty dumps are visible.
        • Keep database credentials out of command logs.
        • Retain several generations to survive delayed discovery of corruption.

        Rehearse the complete restore

        Restore a selected dump into a disposable PostgreSQL instance and run application-level checks. Confirm roles, extensions, ownership, and version compatibility. Measure the duration so the recovery time estimate reflects evidence rather than hope.

        Use a target that is isolated from production and large enough for indexes, temporary files, and write-ahead logs created during recovery. Capture restore errors and validate representative queries or application flows. A row count alone may miss broken permissions, missing functions, or extension differences.

          Measure backup impact and duration

          Logical dumps read the database and consume CPU, storage I/O, and network capacity. On a growing database, a job that once fit overnight can begin overlapping the next run or competing with production traffic. Track duration and output size so the team sees that trend early.

          Large databases may justify directory-format parallel dumps, physical backups, a replica as the backup source, or a different recovery architecture. Make that change because measured recovery and workload targets require it, not because a database crossed an arbitrary size threshold.

            Technical basis

            First-party references

            Technical claims and limitations in this guide were checked against these primary sources. Confirm version-specific behavior when designing a production recovery process.

            Related from Rested

            Common questions

            Frequently asked questions

            Is pg_dump safe to run on a live database?

            Yes. pg_dump creates a consistent export while the database remains available, although it consumes resources and should be scheduled and monitored on busy systems.

            When should I use pg_dumpall?

            Use pg_dumpall when you need all databases and cluster-wide objects such as roles. For flexible parallel backup and restore of a large single database, pg_dump's custom or directory formats may be more suitable.

            How long should PostgreSQL backups be retained?

            Retention depends on recovery and regulatory needs. Keep enough recent and historical generations to cover accidental deletion or corruption that may not be noticed immediately.

            Does pg_dump include PostgreSQL roles?

            A single pg_dump covers one database and does not include cluster-wide roles or tablespaces. Capture required global objects separately with PostgreSQL tooling or recreate them from controlled configuration, then test ownership and permissions during restore.