Pcornel
Databases · Backup, Restore & Recovery

Logical vs Physical Backups

Cheat sheet · https://pcornel.dk/topic.php?topic=6184

Back to the Topic

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.

Remember

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).

First 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

Verify in this order

method chosen → consistent copy → stored → restore path

Where it usually breaks

A logical backup of a large database can take longer to restore than the business can wait.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6184

Confirmation

Confirm action

Continue?