dbTalk Databases Forums  

Periodically backing up

comp.databases.postgresql comp.databases.postgresql


Discuss Periodically backing up in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
KM
 
Posts: n/a

Default Periodically backing up - 04-03-2009 , 01:42 PM






I have a database I would like to backup every hour. For a given hour,
if the database has not been modified since the last backup, I'd like to
skip this backup.

By 'modified', I mean any DML, DDL, grants or revokes that touch the
database, but not selects. If this is a reasonable concept, (how) can
one tell when a database was last modified?
--
KM

Reply With Quote
  #2  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Periodically backing up - 04-06-2009 , 05:37 AM






KM wrote:
Quote:
I have a database I would like to backup every hour. For a given hour,
if the database has not been modified since the last backup, I'd like to
skip this backup.

By 'modified', I mean any DML, DDL, grants or revokes that touch the
database, but not selects. If this is a reasonable concept, (how) can
one tell when a database was last modified?
This is not easy, because the database is also "modified" when you do
nothing at all, for example if there is an automatic checkpoint after
checkpoint_timeout has passed.

I recommend that you use normal online backup as described in
http://www.postgresql.org/docs/8.3/s...archiving.html

You would make a base backup every once in a while and backup the
archived WAL (transaction log) segments every hour. That will minimize
the amount of data you have to backup frequently, and in addition
you can recover to any point of time, not only to the full hours.

How frequently you make a base backup should among other things
depend on the amount of activity - if there is a lot of activity, base backups
should be more often, because otherwise recovery will take painfully long.

Hint: Use archive_timeout if there is little activity on your system, but
you still want WAL files to be archived regularly.

Yours,
Laurenz Albe




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.