Use it to choose a backup method.
Logical vs Physical Backups
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.
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.
method chosen → consistent copy → stored → restore path
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
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.
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).
pg_dump -Fc db > db.dump— first check for this topicpsql -c "SELECT now(), version();"— PostgreSQL reachable and versionmysql -e "SELECT NOW(), VERSION();"— MariaDB/MySQL reachable and versionsqlcmd -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
| Logical | Physical | |
|---|---|---|
| Tools | pg_dump, mysqldump, mariadb-dump, mydumper | pg_basebackup, pgBackRest, Barman, XtraBackup, Mariabackup, SQL Server BACKUP DATABASE |
| Granularity | Table/database, portable across versions | Whole cluster/instance |
| Speed for large DBs | Slow restore | Fast |
| PITR | No | Yes (with logs) |
Use physical backups + logs for recovery and logical dumps for migrations and selective restores.
In depth
Choosing a method by recovery need
| Need | Method |
|---|---|
| Move one database or schema, upgrade across major versions | Logical dump (pg_dump -Fc, mysqldump --single-transaction) |
| Restore a large cluster quickly | Physical backup (pgBackRest, Barman, pg_basebackup, XtraBackup, MySQL Enterprise Backup) |
| Restore to a specific minute | Physical backup + continuous log archive (PITR) |
| Recover one table after a mistake | Logical 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.
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
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.