Issue
I don't see any Postgres backups available when I run heroku pg:backups
.
=== Backups
! No backups. Capture one with heroku pg:backups capture.
I thought my database had continuous protection? Where can I get my backups?
Resolution
Please note, Continuous Protection (a.k.a. database rollbacks) is only available on professional tier database plans. This feature is not available on hobby, mini, and basic tier database plans.
Conceptually the Postgres database is in two parts, the base data itself and a transaction log, which is what modifies the data.
Our continuous protection works the same way. When the database is initialized we take a "base backup" of the data, and then continuously copy the transaction log to a safe location. If we ever need to recreate the database then we:
- Restore that base backup
- Replay the transaction log over it
These base backups are stored internally and are not listed or accessible from heroku pg:backups
.
Why do it this way instead?
For production databases this is much more efficient than traditional timed backups. Transferring the transaction log constantly is much lower overhead on the database than copying all the data for a backup, and when restoring we can just restore to an individual moment in time in the transaction.
This system is running on an all standard/premium/private databases. You'll see it in heroku pg:info
as "Rollback". To restore data to a particular point in time it's actually a rollback database (it creates a new database from the transaction log rather than rolling back the existing database).
Read more about how to "roll back" your Postgres database here.