Re: Saving snapshots for later use

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Nikolas Everett <nik9000(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Saving snapshots for later use
Date: 2012-06-15 17:04:52
Message-ID: 29560.1339779892@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
> On 15.06.2012 06:19, Nikolas Everett wrote:
>> I'd like to be able to save the current snapshot and then at a later date
>> roll the entire database back to that snapshot, essentially erasing
>> everything that happened since the snapshot.

> To revert the database to the earlier state, you'll also need to somehow
> roll back all the already-committed transactions. At first sight, that
> seems easy - just modify clog to mark them as aborted. However, it's not
> that easy, because you'd also need to somehow clear hint bits that claim
> those transactions to be committed.

Not to mention prevent VACUUM from removing rows deleted by those
committed transactions. A saved snapshot of this sort would have to act
like an open transaction from the standpoint of resource reclamation,
which makes it (a) complicated and (b) very expensive if you intend to
hold that snapshot for a long time.

I wonder whether your actual use-case could be solved with 9.2's
exportable-snapshots feature, though.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2012-06-15 17:10:24 Re: Streaming-only Remastering
Previous Message Robert Haas 2012-06-15 16:48:35 Re: Strange behavior with pg_locks and partitioning