Re: Differential backup

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Differential backup
Date: 2010-04-28 18:54:53
Message-ID: m2l407d949e1004281154q178bbec0l57f033536a534c9c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 27, 2010 at 8:15 PM, Craig Ringer
<craig(at)postnewspapers(dot)com(dot)au> wrote:
>
> Another avenue possibly worth investigating may be using the in-heap
> mvcc information to do SQL-level differential backups of individual
> tables or of the whole database. think:
>

You can't use the mvcc information to do incremental backups because
transactions don't necessarily commit or take snapshots in sequential
order. A row can be inserted by transaction id 500 and then later
updated by transaction id 400 and then later deleted by transaction id
300.

I think what you need to use is the LSN on the page. Normally when you
take a hot backup you note the LSN at the start and end of the backup
and know that you need to replay that range of logs to have a
consistent restore. An incremental backup would be the same except it
would only back up any blocks that have an LSN > the start of the last
backup. Then you could restore the previous backup, apply this
incremental to bring the restore up to the beginning of this backup,
then apply the logs for the range of this backup.

--
greg

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-04-28 18:57:38 Re: Add column if not exists (CINE)
Previous Message Heikki Linnakangas 2010-04-28 18:49:20 Re: pg_start_backup and pg_stop_backup Re: Re: [COMMITTERS] pgsql: Make CheckRequiredParameterValues() depend upon correct