Postgresql – n easy way to partially backup Postgres

backuppostgresql

I have a database running on postgres (8.4) and I want regular backups of parts of that data. We have very important data of which we need regular backups in case the hardware catches fire. But the same database contains a huge amount of binary data for each entry that grows really fast (easily more than a GB per day). Now, this data is not as critical. If we lose it, it is of course annoying, but it would be acceptable.

Is there an easy way to backup some of our tables with postgres, or do I have to manually write queries to copy everything somewhere before I can pgdump it?

Bonus: If the big binary table could just backup the last X entries, that would be perfect, but I am pretty sure I will have to do something as complex as this manually anway.

Best Answer

You can try the COPY command, but note that this sucks for incremental backups.

Another (possibly better depending) option may be a hot standby server that you shut down and take (filesystem-level) backups of periodically - This lets you use smarter tools which may take a binary diff of the DB table files and not have to suck down the whole thing every time you make a backup.
The other advantage is you have a well-knwon and well-supported recovery path this way :-)