PGV is built to handle the messiest parts of local database development. Here are common scenarios where PGV shines.
You are about to run a massive data migration that deletes columns, transforms data, and takes 5 minutes to run. You want to test it locally, but if it fails, you don't want to spend 20 minutes running pg_restore to fix your local DB.
- Save your state:
pgv checkpoint "before massive migration" - Run your migration (using Prisma, Drizzle, Flyway, etc).
- Did it fail? Roll back instantly:
Your database is back online exactly as it was, in 2 seconds.
pgv stop main pgv restore "before massive migration" pgv start main
You are reviewing a PR for "Feature A" which introduces a new orders table. You are actively coding "Feature B" which introduces a subscriptions table. You need to switch between them without the schemas clashing.
- Create branches from your clean main snapshot:
pgv branch snap_clean feature-a pgv branch snap_clean feature-b
- Start both branches:
pgv start feature-a # Runs on port 5541 pgv start feature-b # Runs on port 5542
- Switch contexts effortlessly:
You can point your application to
5541to test the PR, and point it to5542to continue your own work. The databases are physically isolated.
Generating massive amounts of seed data locally takes a long time.
- Write a script to generate 10GB of fake data. Run it on your
mainbranch. - Save this state:
pgv checkpoint "10GB seed data" - Now, whenever you need a fresh database full of data to test a new query, you can instantly branch off that snapshot without having to run the 10-minute seed script ever again:
pgv branch "10GB seed data" query-test-env