Docs / PostgreSQL
Fork a PostgreSQL database to any minute
A fork is a new PostgreSQL database made from a snapshot or from a minute inside your recovery window. The original keeps running, untouched.
When to use a fork
A fork gives you real data to work on without putting the live database at risk. Four common uses:
- Investigate an incident: look at the data as it was before the problem, while the live database keeps serving your app.
- Rehearse a risky change: run a migration or a cleanup on the fork first, check the result, then run it in production.
- Give an AI agent a fork: let the agent work on the fork instead of the original, so its mistakes stay on the copy.
- Copy back only what was lost: read the rows a mistake removed from the fork and write them back to the live database.
Create a fork in the dashboard
Open the database and go to its Backups view. On the Restore calendar, pick a day, then a snapshot from that day or a time inside the point-in-time window. Under Target, choose Restore to new database. The button changes from Restore to Fork. Press Fork, and the dashboard confirms that a restored database fork is being created.
The Target selector starts on Restore in place, which replaces the live database, so check it before you press the button.
Create a fork through an AI agent
Ask a connected agent to fork the database to a snapshot or a minute. It calls databases.restore with target_mode set to fork. Fork mode keeps the source database as it is, so it does not need the confirm_inplace confirmation that an in-place restore requires. Like any restore request, it works within the access you authorize and your plan’s limits.
How a fork is named
A fork takes the source database’s name plus a stamp. A point-in-time fork of orders-db at 14:31 on 3 December is named orders-db-pitr-1203-1431: month and day, then the hour and minute you chose, written in UTC. A fork from a snapshot is named like orders-db-fork-1203-1431, stamped with the time the fork was created, in UTC.
What the fork gets
The fork lands in the same project and environment as the source, with the same engine, size and settings. Continuous backups are turned off on the fork. If you decide to keep it, open its Backups view and turn them on.
Switch your app over or copy rows back
A fork is not connected to your app. To move the app to it, bind the fork’s connection to the app as you would any database, then deploy. To recover only what was lost, read the rows from the fork and write them back to the live database yourself.
Cost and cleanup
A fork is a separate database while it exists. It is billed at the normal usage rates for CPU, memory and disk, from the same runtime credit, and creating one is checked against your plan like creating any database. Delete the fork when you are done. An agent can only prepare that deletion; a person approves it.
What a fork does not do
A fork stays in the source database’s project and environment. It is not instant: Resilis creates a new database and restores the data into it, and there is no guaranteed time for that. It is not connected to anything until you bind it.
A point-in-time fork needs continuous backups turned on before the minute you pick, and the minute must sit inside your recovery window: up to 7 days on Hobby and up to 365 days on Pro and Enterprise.
What is a database fork?
A fork is a new database restored from a snapshot or from a chosen minute of an existing one. The original keeps running and is not changed, so you can look, test and copy without risk to live data.
How do I test a migration on a copy of real data?
Fork the database to a snapshot or a recent minute, run the migration against the fork instead of the live database, and check the result. If it works, run it in production as a release command. Delete the fork afterwards.
The fork sits in the same environment as its source, so a fork of a production database holds production data. Treat it with the same care.
Should I fork or restore in place?
Fork when the live database must stay up, when you want to check what the restored data holds before you change anything, or when you only need some rows back. A fork leaves the live database alone.
Restore in place when you have decided the whole database should go back. Your app keeps using the same database, so there is nothing to switch over, but it is temporarily unavailable while the restore runs and every change after the chosen point is replaced.
Managed PostgreSQL on Resilis
Create a private PostgreSQL database in your project, bind it to your app and turn on continuous backups. The database draws from your runtime credit.