From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Martin Langhoff <martin(dot)langhoff(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: PITR - "Rewind to snapshot" scheme |
Date: | 2007-04-17 06:42:25 |
Message-ID: | 46246C51.8050807@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Martin Langhoff wrote:
> I have been following and experimenting a bit with PITR for a while,
> and I wonder whether it is practical to use the PITR hooks to roll
> back the database to a known state. The scenario is that I am
> developing a script that will be massaging data in a medium size
> database. A pg_restore of the pristine data takes ~35 minutes to
> complete, if I can take a snapshot right after pg_restore, and use it
> to later "rewind" to that point, I'll save 35 minutes every time I
> need to test it.
>
> The dev box where Pg runs has plenty of disk space to spare - and
> it'll be a dedicated Pg instance. I've already raised wal_buffers to
> 20000 and also disabled wal fsync.
>
> So my back-of-the-envelope plan is to
>
> - run pg_restore
> - setup wal archiving so that the logs aren't deleted
> - pg_start_backup('label'); cp -pr pgdata pgdata-snapshot ;
> pg_stop_backup('label')
> - somehow remeber the transaction identifier
If it's the only database in the cluster (or you can make it so) then
it's probably simpler just to:
1. Get database to state you want
2. Stop postgresql
3. Take file-level backup of everything in $PGDATA
4. Restart postgresql
5. Run tests
6. Stop postgresql
7. Restore file-level backup
8. Go to step 4
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Alexey Nalbat | 2007-04-17 07:15:31 | Re: deadlock |
Previous Message | marcelo Cortez | 2007-04-17 05:59:05 | Re: string fields helps |