Back up and restore
(Updated )
PlanetScale for Postgres databases include comprehensive backup and restore capabilities to protect your data. The backup system provides both automated scheduled backups and manual on-demand backups, as well as point-in-time recovery (PITR) support through Write-Ahead Log (WAL) archiving.
Automatic scheduled backups
Default backup schedule
All PlanetScale for Postgres databases include automatic scheduled backups that run every 12 hours for production and development branches. Default backups are created automatically and don't require any setup. There are no additional charges for these backups. These default backups remain available for up to 2 days from creation. WAL logs are retained for the same period as your oldest backup.
Both backups and WAL files are stored in highly durable, available, and secure storage off of your cluster, in the same cloud provider and region as the cluster.
Additional backups
Note
Custom backup schedules and manually created on-demand backups incur additional charges. See Additional Backup Pricing for more information.
Custom backup schedules
You can create additional custom backup schedules for more frequent backups or specific timing requirements. You must be an organization administrator or database administrator to create or modify a custom backup schedule.
- From the PlanetScale organization dashboard, select the desired database
- Navigate to the Backups page from the menu on the left
- Click Add new schedule
- Configure your schedule:
- Run every: Configure the frequency of the backup schedule based on hours, days, weeks, months
- Time: Specify when the backup should start. Depending on frequency pick either the offset of the hour, the time of the day, the day of the week and time of that day, or which day of the week of the month, and the hour of that day
- Retention: How long to keep backups (hours, days, weeks, months, or years)
- Name: The name for your custom backup schedule. If left blank, an auto-generated name will be created.
- Click Save schedule
Manual backups
You can create a one-off on-demand backup of your database branch:
- From the PlanetScale organization dashboard, select the desired database
- Navigate to the Backups page from the menu on the left
- Click Create new backup
- Select a branch
- Enter a name
- Select if this backup is an Emergency backup
- Specify how long you want to keep the backup (hours, days, weeks, months, or years)
- Click Create backup
Emergency backups
Emergency backups are available when you need an immediate backup regardless of database state or ongoing operations. Unlike regular backups, emergency backups do not rely on previous backups or previous WALs.
They also may use additional primary database resources during creation. They are only recommended when regular backups are failing due to WAL corruption or other issues.
Note
Emergency backups may impact database performance and should only be used in critical situations where immediate backup is required.
Viewing backups
Backup List
All backups can be viewed on your Backups page.
- From the PlanetScale organization dashboard, select the desired database
- Navigate to the Backups page from the menu on the left
- View all backups with details:
- Backup name
- Branch name
- Size
- Backed up (a timestamp will be displayed if backup has completed)
You can click into any backup to see the branch, expiration date, restore to a new branch, and to toggle preventing backup deletion.
Restoring from Backups
Creating a Restored Branch
Restore any backup to a new database branch:
- From the PlanetScale organization dashboard, select the desired database
- Navigate to the Backups page from the menu on the left
- Select the backup you wish to restore from
- Click Restore to new branch
- Configure the restored branch:
- Branch name: Name for the new branch
- Cluster size: Choose the desired size of the new cluster
- Click Restore backup
A new branch will be created based on this backup and will become visible under the Branches page.
Point-in-time recovery
PlanetScale for Postgres backups support point-in-time recovery using WAL files:
- Restore to any timestamp between the oldest backup creation and 5 minutes prior to the current time
- Specify the exact moment using ISO 8601 format:
2024-01-15T14:30:00Z
- Recovery uses the most relevant recent backup plus WAL replay to reach the target time
To learn more about PostgreSQL point-in-time recovery (PITR), plus see how to create a new branch with PITR see the PlanetScale for Postgres PITR documentation
Restored Branch Behavior
- Restored branches are independent database branches
- They include all data as of the restore point
- Database extensions are not restored - you'll need to reinstall any extensions
- Restored branches can be promoted to production or used for testing
- Backup expiration is automatically extended to ensure the restored branch can create new backups
Backup retention
The default, included backup schedule retains backups for 2 days. You can set a custom retention period for custom backup schedules and manual one-off backups.
Additionally, you can choose to protect any individual backup from deletion. Click on the backup you'd like to protect, and click the "Prevent backup deletion" toggle. Keep in mind that custom backups and included backups that are retained beyond the default retention policy will incur additional charges.
Additional Backup Pricing
User-scheduled backups are billed at $0.023 / GB / month.
If you need additional assistance, contact the PlanetScale support team.
Need help?
Get help from the PlanetScale Support team, or join our GitHub discussion board to see how others are using PlanetScale.