Skip to main content

Time travel

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.

Time travel allows you to query your database as it existed at any point in the past within your restore window. This feature creates a new branch with your data from a specific point in time, so you can analyze historical states without affecting your production data.

When to use time travel

Use time travel when you need to:

  • Analyze data as it existed at a specific point in the past
  • Investigate changes made to your database over time
  • Recover specific data values from before recent modifications

Perform time travel

To query your data at a point in time:

  1. Navigate to the Lakebase App by clicking the apps switcher in the top right corner of your workspace.
  2. Identify your database project in the list.
  3. Click on the project name to get to the Project dashboard.
  4. In the Branches section of the left navigation, click Create branch.
  5. In the Create new branch dialog:
    • Enter a branch name (for example, time-travel-analysis or historical-data)
    • Select the Past data option
    • Use the date and time picker to select the desired date and time you want to query

Create a branch from past data

  1. Click Create to create the new branch with data from the selected point in time.

    note

    This creates a new branch with your data as it existed at the selected point in time, without affecting your production branch.

  2. After the branch is created, you're automatically taken to the Branch Overview page for your new time travel branch. A Connection details modal appears with the connection string for this branch.

    You have two options:

    • Use external tools: Copy the connection string to connect using psql, DBeaver, pgAdmin, or other Postgres clients
    • Use SQL Editor: Close the connection details modal and proceed to the next step
  3. To use the SQL Editor, close the connection details modal by clicking Close.

  4. In the left navigation, click SQL Editor.

  5. Query your database as it existed at the selected point in time.

  6. Write and execute SQL queries to analyze your historical data.

    For detailed information about using the SQL Editor, see Query your database from the Lakebase SQL Editor. For information about connecting with external tools, see Postgres clients.

Clean up time travel branches

When you've finished your historical analysis and no longer need the time travel branch:

  1. Navigate to the Branches page in the left navigation.
  2. Find the time travel branch you created.
  3. Click the Kebab menu icon. menu next to the branch name.
  4. Select Delete from the dropdown menu.
  5. Confirm the deletion to remove the branch and free up storage space.

Important considerations

  • Restore window: You can only travel back within your configured restore window. See Configure your restore window for information about adjusting this setting.
  • Branch isolation: The historical data branch is separate from your production branch, so you can safely query and analyze without affecting current operations.
  • Branch management: Delete time travel branches when you're finished with your analysis to avoid unnecessary storage usage.
  • Full database state: The branch contains all databases and schemas as they existed at the selected point in time.