PostgreSQL 17 introduces incremental backup support in the built-in tool pg_basebackup
, a long-awaited feature for database administrators seeking more efficient backup strategies.
🚀 Key Highlights
- New Feature:
- Incremental backup is now supported natively with
pg_basebackup
. - Efficiency:
- Only the data that has changed since the last backup is backed up—saving time and storage.
Optimal Backup Strategy:
📦 Weekly full backup- ♻️ Daily incremental backups
- 📚 Continuous WAL archiving
- 1.PostgreSQL 17 introduces a new feature called incremental backup with pg_basebackup
- 2.They provide flexibility and efficiency by only backing up the data that has changed since the last backup.
- 3.Ideal backup schedule might include one full backup weekly , daily incremental backup, and continuous write-ahead log backups.
- 4.Recovery process can be speed up considerably by taking regular full backup and adding incremental backup of replaying all the data changes (WAL) from last full backup.
Recovery combines the last full backup + incremental backups + WAL to restore to a specific point in time quickly.
🧪 Syntax
✅ Example:
pg_basebackup --incremental=/var/fullbackup/backup_manifest -D /var/incr_backup/
--incremental
: Path to the backup manifest from the last full or incremental backup.-D
: Destination directory where the incremental backup will be stored.
📄 What is a backup_manifest
?
- It’s a JSON file automatically created during a backup.
- Contains a list of files, checksums, and other metadata.
- PostgreSQL uses it to determine what changed since the last backup.
📌 Important Notes
- You must retain the manifest file from your previous backup for the next incremental run.
- Incremental backups require a full backup as a base.
- Make sure the destination directory (
-D
) is empty or non-conflicting.
🧰 Useful Tips
-
Use
--write-recovery-conf
withpg_basebackup
if you want to prepare a standby or restore-ready directory. - Combine with
pg_compresslog
orwal-g
for efficient WAL management.
No comments:
Post a Comment