Christian
Christian

Reputation: 123

Export only new data since the last PostgreSQL database export

I have a decent sized PostgreSQL database (approx 6GB & growing). A full backup/export of the database is done every few hours via cron & pg_dump. Specifically, can I export only the changes to the database since the last export? Or perhaps run a utility that compares the two exports and appends the differences to the original, etc? I'm trying to save disk space and "cloud" transfer time.

Upvotes: 0

Views: 3312

Answers (3)

pphysch
pphysch

Reputation: 309

PostgreSQL 17 now natively supports incremental backups via the pg_basebackup command.

-i old_manifest_file
--incremental=old_manifest_file

    Performs an incremental backup. The backup manifest for the reference backup must be provided, and will be uploaded to the server, which will respond by sending the requested incremental backup.

https://www.postgresql.org/docs/17/app-pgbasebackup.html

Upvotes: 0

Tometzky
Tometzky

Reputation: 23910

Use differential backup solution, like for example free Duplicity.

But remember to store a database dump - don't store live database files, as your backup will be corrupted.

Upvotes: 0

Frank Heikens
Frank Heikens

Reputation: 127327

No, you can't. What you could do, is setting up WAL archiving to make incremental backups: http://www.postgresql.org/docs/current/static/continuous-archiving.html#BACKUP-ARCHIVING-WAL

This can only be done for the whole cluster, not for a single database.

Upvotes: 1

Related Questions