> ## Documentation Index
> Fetch the complete documentation index at: https://resources.athenaintel.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Athena-managed databases

> Create a Postgres database asset, manage branches, and recover data without replacing the current branch

A database asset is an Athena-managed Postgres database in your workspace. Use it to store application data, browse tables, and run SQL. Branches give you separate copies of the database, including recovery copies from an earlier point.

![Main branch timeline with a recovery branch created from an earlier point and a new branch from the current state, plus notes on restore in place and the privileged connection string.](https://mintcdn.com/athenaintelligence-e46bc9d3/6ueVSVCwufwDQRFe/images/diagrams/database-branches.webp?fit=max\&auto=format\&n=6ueVSVCwufwDQRFe\&q=85\&s=e1c7e029a22d20a1df05099844d75637)

A recovery branch copies an earlier point and leaves the main branch unchanged.

## Create and open a database

Database creation must be available for your account and deployment. The asset picker hides **Database** for self-serve accounts and when database creation is disabled.

1. In the **Create new** asset picker, choose **Database**.
2. Enter a name in **Database Name**.
3. If **Database source** appears, select **Athena managed**.
4. Select **Create Database**, or **Create database** in the dialog with a source selector.
5. The creation flow opens the new asset. Wait for provisioning before using it.

When you reopen the asset, these tabs provide the main data and recovery controls:

| Tab | Use |
| - | - |
| **Overview** | Review database information and connection details. |
| **Browser** | Browse tables and their schema when SQL access is available. |
| **SQL Editor** | Run SQL with edit access when SQL access is available. |
| **Branches** | Create branches and recovery branches. |
| **Settings** | Review and change database settings. |

## Create a branch

You need edit access to create or change branches. Reading the branch list and recoverable window requires view access. Branch actions become available after provisioning.

1. Open **Branches** and select **New branch**.
2. Enter a **Name** and, optionally, a **Description**.
3. Under **Branch from**, choose **HEAD (current)**, **Point in time**, or **Explicit LSN**.
4. For an earlier point, enter the timestamp or **Ancestor LSN**. An LSN is a Postgres log sequence number that identifies a position in database history.
5. Review **Schema only**, **Protected**, and **Auto-expire** as needed.
6. Select **Create branch**.

> [!NOTE]
>
> Branching and point-in-time recovery are marked **Experimental** in the database view. The retained history window determines how far back you can recover.

## Recover into a new branch

A recovery branch preserves an earlier state separately from the current branch. You need edit access to create it.

1. Open **Branches** and find the source branch.
2. Select its **Point-in-time restore** action.
3. Review **Recoverable window**, including **Earliest LSN**, **Latest LSN**, and **Retention**.
4. Under **Restore by**, choose **Timestamp** or **LSN**. Use **LSN** when timestamp restore is unavailable.
5. Enter **Restore to** or **Restore to LSN** within the recoverable window.
6. Optionally enter **Recovery branch name (optional)**.
7. Select **Create recovery branch** and check that the new branch appears in the list.

> [!WARNING]
>
> The separate **Restore** button at the top of **Branches** restores the main branch in place. It replaces the active timeline, keeps the outgoing main as a protected backup branch, and interrupts connections. Creating a recovery branch does not perform that replacement.

Previewing a branch as of an earlier time, as-of SQL reads, and **Time travel** are limited to Athena staff today.

## Use the connection role safely

In **Overview**, use **Copy URI** to retrieve the current connection string. Retrieving it requires edit access, and Athena fetches the current credentials when you copy it.

> [!WARNING]
>
> The returned connection string uses a privileged database role. It can write data, change schema, and bypass row-level security. Asset view access does not grant permission to retrieve this credential.

Create a separate Postgres role for each application and connect the application with that role. Grant it only the tables and operations the application needs. Keep the privileged connection string for administration.

## Related

* [Query in a notebook](https://resources.athenaintel.com/docs/pillars/applications/query-in-notebook.md)
* [Manage application releases](https://resources.athenaintel.com/docs/pillars/applications/manage-application-releases.md)
* [Legal holds and retention](https://resources.athenaintel.com/docs/getting-started/legal-holds-and-retention.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.