Pcornel
Browse topics
Options
Recent
Favorites
Databases · Technical reference

Logical vs Physical Backups

Direct answer

Logical backups export SQL or data (pg_dump, mysqldump) — portable, slower, per database; physical backups copy data files and logs (pg_basebackup, Percona XtraBackup, SQL Server BACKUP) — fast and support PITR.

When to use this

Use it to choose a backup method.

First 30 seconds

1. Which method is used today?

2. Logical: pg_dump -Fc db > db.dump / mysqldump --single-transaction.

3. Physical: pg_basebackup / xtrabackup / BACKUP DATABASE.

4. Restore time measured?

5. Combine with log/WAL for PITR.

Operational verification

method chosen → consistent copy → stored → restore path

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
MariaDB / MySQL / PostgreSQL / Microsoft SQL Server concepts
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformMariaDB / MySQL / PostgreSQL / Microsoft SQL Server concepts
Scope / prerequisiteUse it to choose a backup method.
What next?2 suggested next steps
Evidence0
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 How to verify Verify boundary

Time a full restore and compare with the recovery time objective. Check backup logs for warnings.

Step 2 Common failures Narrow the fault

A logical backup of a large database can take longer to restore than the business can wait. Copying data files of a running database without a backup tool gives a corrupt copy. Backups stored only on the same host are lost with it.

Key points

Logical dumps are good for migrations and small databases; physical backups plus WAL/binlog/log backups for large databases and PITR. Use consistent snapshots (--single-transaction).

Key checks
  • pg_dump -Fc db > db.dump — first check for this topic
  • psql -c "SELECT now(), version();" — PostgreSQL reachable and version
  • mysql -e "SELECT NOW(), VERSION();" — MariaDB/MySQL reachable and version
  • sqlcmd -S <server> -Q "SELECT @@VERSION" — SQL Server reachable and version
ReferenceWhat it is1 section · depth on demand

How it works

Logical tools read rows through SQL and write them out; restore re-inserts and rebuilds indexes. Physical tools copy data files while tracking changes in the log so the copy can be made consistent.

ReferenceImportant terms & boundaries3 sections · depth on demand

Logical vs physical

LogicalPhysical
Toolspg_dump, mysqldump, mariadb-dump, mydumperpg_basebackup, pgBackRest, Barman, XtraBackup, Mariabackup, SQL Server BACKUP DATABASE
GranularityTable/database, portable across versionsWhole cluster/instance
Speed for large DBsSlow restoreFast
PITRNoYes (with logs)

Use physical backups + logs for recovery and logical dumps for migrations and selective restores.

In depth

Choosing a method by recovery need

NeedMethod
Move one database or schema, upgrade across major versionsLogical dump (pg_dump -Fc, mysqldump --single-transaction)
Restore a large cluster quicklyPhysical backup (pgBackRest, Barman, pg_basebackup, XtraBackup, MySQL Enterprise Backup)
Restore to a specific minutePhysical backup + continuous log archive (PITR)
Recover one table after a mistakeLogical dump, or restore physical backup elsewhere and copy the table

Restore time is the real constraint

A logical restore re-inserts every row and rebuilds every index; on a 1 TB database that can take many hours or days. A physical restore copies files and replays WAL, which is mostly limited by disk and network throughput. Measure the full restore time and compare it with the recovery time objective — do not estimate it from backup duration.

Consistent logical backups

pg_dump -Fc -j 4 -f shop.dump shop      # -Fc custom format allows parallel and selective restore
pg_restore -l shop.dump | head          # list contents without restoring
mysqldump --single-transaction --routines --triggers --events shop > shop.sql

--single-transaction gives a consistent InnoDB snapshot without locking; it does not protect MyISAM tables, and DDL during the dump can break it.

3-2-1 and immutability

Keep three copies on two kinds of storage, one off-site; at least one copy should be immutable (object lock, WORM) or offline so ransomware or a compromised admin account cannot delete it. Encrypt backups and store the key separately from the backup and from the server.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Common mistakes

  • Logical dumps of large databases with long restore times not tested.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
logical vs physical backupslogical physical backuppg_basebackup mariabackup
Confirmation

Confirm action

Continue?