Database snapshots or clones for staging and testing. - Mailing list pgsql-general

From Tim Uckun
Subject Database snapshots or clones for staging and testing.
Date
Msg-id CAGuHJrPriu82BwdeNAS-ASwi-gPK4GfppyZYM66Wv-+xbKvR0Q@mail.gmail.com
Whole thread Raw
Responses Re: Database snapshots or clones for staging and testing.  (Adrian Klaver <adrian.klaver@gmail.com>)
Re: Database snapshots or clones for staging and testing.  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-general
Hi all.

I have the following scenario I want to accomplish.

In order to test a new branch of code I want to create a snapshot of the live database into a testing database. The code will be deployed after that and it may run some migrations which will change the schema of the database.  The code is then tested using both automated testing and user acceptance testing (this stage may take hours or perhaps even days).  During that time the users can change the data.  After the branch is accepted by the users we would like to "reset" the database to the way it was before and perhaps test another branch.

One obvious way to do this would be to do a backup/restore but as the database grows larger that process is taking too long.  It would be great if we could do a streaming replica and then pause the replication, run our tests, and then reset the database to the point at which the replication was paused and restart the replication. Is that possible?

Another option would be the try and leverage PITR.  Create a checkpoint, run the migrations do your tests, roll back to everything to the start. This does seem possible to me although of course I am still stuck with the backup restore problem.

Anything I missed? Surely there is a super clever trick I am missing here.

pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Grep'ing for a string in all functions in a schema?
Next
From: Thomas Kellerer
Date:
Subject: Re: Grep'ing for a string in all functions in a schema?