Skip to main content

Point-in-time restore

Beta

Lakebase Postgres (Autoscaling Beta) is the next version of Lakebase, available for evaluation only. For production workloads, use Lakebase Public Preview. See choosing between versions to understand which version is right for you.

You can restore from any point in time within your database project's restore window. This restore option lets you quickly recover from an accidental data loss or modification such as an unintended deletion or schema change.

When to use point-in-time restore

Point-in-time restore is best for unexpected events like data loss, unintended deletions, or accidental schema changes. Use this method when you need to quickly roll back to a specific moment in time to recover from recent issues.

Perform a restore operation

To perform a restore operation:

  1. In the Lakebase App, navigate to your database project and select Backup & Restore from the sidebar.
  2. Under Instant point-in-time restore, select your source branch and choose a restore point using the date & time picker. Optionally, click Preview data to verify the branch state before proceeding.

SQL Editor with preloaded sample SQL

  1. Click Restore to point in time, review the confirmation details, then click Restore.

Your current branch is automatically backed up as <branch_name>_old_<timestamp> before the restore, allowing you to revert if needed. The backup branch is available on the Branches page.

Configure your restore window

Lakebase retains a history of changes for all branches in your database project. This history enables point-in-time restore for recovering lost data, time travel queries for investigating data issues, and branching from past states for development workflows.

You can configure the restore window from 2 days up to 35 days, which defines how far back you can restore. Note that:

  • Extending the restore window increases your storage
  • The restore window setting affects all branches in your project

To configure the restore window for a project:

  1. Navigate to your database project in the Lakebase App and select Settings on the Project dashboard.
  2. Select Instant restore and choose the restore window length from 2 days up to 35 days.

Instant restore settings

Restore details

This section outlines key details about point-in-time restore.

Automatic backups

In case you need to roll back a restore, the branch's final state is preserved before the restore operation in an automatically created backup branch, which takes the following format:

{branch_name}_old_{head_timestamp}

You can use this backup to revert the restore operation if necessary. Backup branches are listed on the Branches page in the Lakebase App.

Overwrite, not a merge

When you restore a branch, you perform a complete overwrite, not a merge or refresh. Everything on your current branch, data and schema, is replaced with the contents from the historical source. All data changes from the selected restore point onwards are excluded from the restored branch.

Restores apply to all Postgres databases

Each branch is an instance of Postgres. A Postgres instance can have more than one database. Keep this in mind when restoring branches. For example, if you want to restore lost data in a given database and you restore your branch to an earlier point in time before the data loss occurred, the operation applies to all Postgres databases on the branch, not just the one you're troubleshooting.

Connections temporarily interrupted

Existing connections to the branch you're restoring are temporarily interrupted during the restore operation. However, your database connection details don't change. Applications can automatically re-establish their database connections as soon as the restore operation is finished.