A branch is one PostgreSQL database with its own data, roles and settings. It runs in its own microVM. Branches belong to a project, and projects belong to an organization.
Every branch is created from exactly one source:
| Source | Request field | Result |
|---|---|---|
| Template | template |
A clean database from a prepared starting point (for example pg18, or a dataset you registered). |
| Checkpoint | checkpoint |
A copy of a branch as it was when the checkpoint was taken. |
| Parent branch | parent |
A fork of another branch as it is now. Elefork checkpoints the parent and starts the fork from that checkpoint. |
Set count (up to 100 by default) to create many identical branches in one call. Their names get -1, -2, … suffixes.
States
Section titled “States”| State | Meaning |
|---|---|
creating |
The instance is starting. |
running |
Accepting connections. |
paused |
No CPU or memory in use; the data is kept. The next connection wakes it. |
failed |
The instance was lost (for example a host crash). Elefork recovers L0 branches automatically from their latest checkpoint. |
deleting → deleted |
Being removed; deleted branches disappear from the API. |
Lifecycle changes are operations. One operation runs per branch at a time; others queue behind it.
Pause and wake
Section titled “Pause and wake”A running branch with no connections and no activity for the idle timeout (60 s by default) is paused. Connecting through the gateway wakes it again. Waking typically takes well under a second, and the client just sees a slightly slower connect. While any connection is open, the branch is never paused.
You can also pause and wake explicitly: POST /v1/branches/{id}/pause and POST /v1/branches/{id}/wake.
Pause policy
Section titled “Pause policy”Each branch has a pause_policy:
| Policy | Behaviour |
|---|---|
idle (default) |
Paused after the idle timeout, as above. |
never |
Never paused automatically. Use it for long-lived databases behind a service, where the first request after a quiet spell should not wait for a wake. An explicit POST /v1/branches/{id}/pause still pauses it. |
Set it when creating or forking ("pause_policy": "never"; a fork does not inherit its parent’s policy) and change it at any time with PATCH /v1/branches/{id} and {"pause_policy": "idle"} or {"pause_policy": "never"}. A branch that is never paused keeps using compute while it runs.
Lifetime
Section titled “Lifetime”L0 branches expire 24 hours after creation unless you set ttl_seconds. ttl_seconds: 0 means “never expire”. Expired branches are deleted along with any checkpoints nothing else uses.
Generations
Section titled “Generations”Each branch has an instance generation. It increases when a branch is reset, recovered or (in the future) failed over, but not when it is paused and woken. Connections to an older generation are closed by the gateway, so a client can never keep talking to a database that has been replaced.