Skip to content
WebsiteHosting.com

comparison Data & storage

Logical database dumps versus physical backups

A logical dump can preserve one database’s objects and rows without its cluster-wide roles. A complete physical backup preserves the cluster as files, but direct use depends on a compatible PostgreSQL version and environment.

Latest recorded source check · P0233

What it means

A logical dump can preserve table definitions and rows for PostgreSQL to recreate. A physical backup preserves the database cluster as files. Choosing between them takes two questions: does the backup contain the state you need, and can the target use it?

Suppose the role shop owns the orders table. A PostgreSQL 18 pg_dump can record the table, its rows and its owner’s name without defining the owner role: the dump covers one database, while roles belong to the cluster. PostgreSQL 18: pg_dump With a physical backup, the recovery unit is the complete, consistent cluster. The files holding orders are not a standalone table backup. File system level backup

Try it

Use the synthetic choices in this local simulation; no database is read or changed.

Logical database dumps versus physical backups

Choose a synthetic restore goal, backup format and target-version/environment constraints; show which objects/state are included, excluded or require evidence.

Simulation

Local simulation only: no device, service, stored object or database is changed, and no real operation is authorized.

Modeled outcome: representation suitable

The requested table is represented by the declared schema/data dump; dependencies are separately supplied.

Logical database dumps versus physical backups: synthetic scenario inputs

Scenario: Starting example

Each preset replaces all fields. Editing any field preserves the other values exactly, including invalid entries.

Representation fit is not a restore test

Representation outcome
representation-suitable
Requested scope included
Yes

Evaluated evidence

Backup representation
logical
PostgreSQL source major
18
Target major assumption
18
Requested object scope
table
Required roles and extensions
verified
Physical environment compatibility
same

Representation fit is not proof of restore success. This model stipulates a complete consistent backup; versions, extensions and restoration need actual validation. No restore commands or PITR simulation.

About this model

Every input is local synthetic evidence. Numbers stay as raw text until this model validates them. The shown evaluated values come from the same result as the explanation.

Presets replace the entire scenario. Reset restores all starting fields, scenario selection and model state; it does not change the open or closed state of this help or article FAQ.

No external request, device command, stored-input history or measurement is performed.

Start with Backup representation set to logical and Requested object scope set to table. PostgreSQL source major and Target major assumption are both 18, Required roles and extensions is verified, and Physical environment compatibility is same. The declared dump contains the table definition and rows, and the target prerequisites are separately supplied. Requested scope included is true and Representation outcome is representation-suitable.

Change only Requested object scope to roles. Inclusion becomes false and the outcome becomes not-included. Supplying a role on the target helps with the table recovery goal; it does not put the role definition in the dump.

Reset returns all six choices to their defaults and clears the simulation’s comparison and history. With the request back at table, dependencies verified and the environment same, compare the target assumptions for a PostgreSQL 18 source:

Target major assumptionLogical schema-and-data dumpComplete, consistent physical copy
17Unknown: older-target import is not establishednot-directly-compatible
18representation-suitablerepresentation-suitable
19representation-suitablenot-directly-compatible

Try a different physical-backup major selects the physical 19 case. The table is still included; what fails is the assumption that a different major can start directly from those files. PostgreSQL’s physical log-shipping guidance identifies version and platform constraints. Inspect the evidence boundary selects the logical 17 case. Dump output is intended for the same or a newer target, not guaranteed to load on an older major. pg_dump: Notes That makes the older-target result unknown, not a prediction that the import will fail.

For this table request, choosing unknown for the target major also leaves compatibility undecided. That is a valid choice indicating missing evidence. A value outside the listed choices is invalid and produces no assessment.

In practice

If you need orders on another installation, check the dump for the table definition and rows, then check the target for its owner role and any required extensions. In the starting example, changing Required roles and extensions to missing leaves the table included but changes the outcome to blocked-dependencies. If those prerequisites are unknown, suitability remains unknown.

If you need every database and the cluster-wide roles together, the single-database dump is too narrow. pg_dump: Description The simulated physical copy includes that state because it is stipulated to be complete and consistent. Even with both majors at 18, setting Physical environment compatibility to different or unknown leaves physical suitability unknown: you still need evidence about the target architecture and physical format.

Choose the representation that contains the required state and fits the intended target. A filename establishes neither. Even representation-suitable is a reason to proceed to restore validation, not evidence that a restore succeeded. This comparison does not run a restore or simulate point-in-time recovery.

Frequently asked questions

Editorial questions based on the listed sources and explicitly labeled local examples.

Does a database dump include cluster roles?

A single-database PostgreSQL pg_dump does not include global cluster roles. The requested object scope must match the backup representation; a file called a database backup is not automatically a complete cluster backup.

Can physical files be opened by any version?

No arbitrary-version compatibility is assumed. The sample blocks direct physical use across different major versions and asks for environment evidence. Logical dump output has a different compatibility contract, including no guaranteed older-major import.

Why do extensions matter during restore?

A logical representation can refer to objects supplied by extensions and other prerequisites. In this model, known missing required dependencies block the restore goal even when format and version labels otherwise fit.

Is this a point-in-time recovery procedure?

No. It compares representation, object scope and compatibility prerequisites. It does not assemble a WAL chain, choose a recovery timestamp or run a restore.

Sources & model boundaries

Primary references used for this explanation. The interactive example is an educational model, not a live check.

  1. PostgreSQL pg_dump

    Description; Notes. pg_dump is single-database logical backup, not global-role backup; output is intended for same/newer targets, not guaranteed older-major targets.

    Checked .

  2. File system level backup

    Consistency requirements; complete database cluster. A usable physical backup requires a consistent complete database-cluster representation, not isolated copied relation files.

    Checked .

  3. Log-shipping standby servers

    Streaming replication; synchronous replication; compatibility. Standby progress and acknowledgment policies are separate; asynchronous progress can lag the primary. Physical log shipping has version/platform constraints.

    Checked .

Report an issue. Include the article URL and ID, not passwords or access keys.