Database states, connection availability, persistence and deletion blockers
For the procedures, see Create and connect to a database, Branch a database, and Sleep, wake and delete a database.
States
state describes the database now. pending names the state a transition is
driving toward; null means no transition is pending.
nevia pg status shows a pending target with an
arrow, such as ready (→ sleeping).
| State | Meaning |
|---|---|
creating | The database or branch is starting. |
ready | The guest reports readiness. Check SQL access using the TLS connection URI. |
sleeping | The microVM is paused with RAM allocated; SQL connections are unavailable. |
failed | Creation or a lifecycle action failed. Read the error field. |
deleting | Deletion is in progress. |
deleted | Deletion is complete; the database is no longer available in normal reads. |
ready does not prove that the endpoint is reachable from your client or that
its TLS configuration works. A successful SQL query using the returned URI checks
that path.
Transitions
Starting a sleep, wake or branch requires an existing microVM, pending: null,
and no operation running on the source. A repeated sleep or wake returns the
existing matching operation when one has been recorded. Before that operation
exists, a pending transition returns 409 invalid_state; wait before retrying.
| Action | Required starting state | While in progress | Successful result |
|---|---|---|---|
| Create | No existing database with that name. | creating, pending ready | A new ready database. |
| Sleep | ready | ready, pending sleeping | The same database becomes sleeping. |
| Wake | sleeping | sleeping, pending ready | The same database becomes ready. |
| Branch | Source is ready or sleeping. | New database is creating, pending ready. | A new ready database; the source keeps its state. |
| Delete | A live database, subject to the blockers below. | deleting, pending deleted | The database and its data are removed. |
Failures can leave a database in failed. Sleep on an idle sleeping database
and wake on an idle ready database return it unchanged.
Sleep and wake return status 200 when the transition completes within the request.
When they need more time, status 202 includes an operation and pending target.
Repeating the same request returns 202 with that operation. Repeating a delete
while deletion is in progress also returns its existing operation; after deletion
finishes, the resource returns 404.
See the operation reference for shared wait behavior.
Connections and credentials
Every database runs the platform's managed Postgres (currently 18.6) with a fixed
size and 20 GiB of storage. The user is nevia_admin on database nevia, and a
connection pooler listens on port 6432 of the same host.
The platform sets the password and keeps it; the control plane never stores it.
Creation returns it when the database is ready and its credentials can be read
before the request answers. Otherwise the response has no connection. A replay
with the same idempotency key has none either. Resource reads and lists omit
credentials.
nevia pg connect reads the connection of a
ready or sleeping database without opening a SQL session. Machine readiness
and credential availability are separate: a fresh branch can be ready before
its credentials are available. During that gap, the connection read returns
409 invalid_state and asks you to retry the read in a few seconds. Other database
states also return 409 invalid_state.
nevia pg new --wait and nevia pg branch --wait read missing connection
details after the database becomes ready. If that read fails, the CLI still
prints the created database, followed by a separate error and a nevia pg connect
hint. It exits with the connection error's status. The create or branch has
already succeeded, so repeating it is not how to retrieve the credentials.
With --json, stdout is empty. The error document, the last line of stderr,
has partial: true, the nevia pg connect command in recovery, and the
produced body in result: database, any operations and operation fields
and connection: null. The exit status is the same as without --json. Direct
nevia pg connect failures keep their normal error output and exit status.
The CLI does not poll for credentials after a 409. Authentication and rate-limit
recovery follow the usual request retry policy.
password_status is tracked or untracked. If you change the password in SQL,
the platform no longer knows it: the connection reads untracked, with no
password and a URI that carries only the user. It stays that way until you reset
the credentials, which sets a new tracked password and stops the old one working.
A reset on a sleeping database applies when it wakes: until then the connection
reports reset_pending with no password.
Connection URIs require TLS, with sslmode=require or stricter. The host is the
name the platform assigns once the database is first ready.
SQL access is unavailable while sleeping. Open a new connection after wake, using the same credentials. Status and credential reads do not wake the database, and neither does a connection attempt; wake on connection is coming soon.
Persistence and branches
Sleep retains RAM without taking a snapshot. Sleep does not require snapshot support and is not a backup.
| Action | Data | Identity and credentials |
|---|---|---|
| Sleep, then wake | Kept, with memory retained in RAM and resumed at wake. | Same database ID, host and credentials. |
| Branch | Private copies of the source's data disks. Writes on the branch do not change the source. | New ID, host and password. The branch records the source as parent. |
| Delete | Removed. | The database is no longer available. |
A branch has the source's Postgres version. A branch of a running or paused
source starts Postgres from the cloned disks with fresh memory. Older machines
suspended to disk also appear as sleeping; a branch of one restores its saved
memory and paired disks. The current CLI pg suspend command pauses in memory
instead.
A running source can reuse a disk snapshot less than five seconds old. To include fresh writes, commit them and wait at least five seconds before branching. A fresh snapshot briefly freezes writes to the data filesystem.
Deletion blockers
Deletion requires protected: false and no running operation. Deleting a parent
leaves its branches running with their own data. Each branch's parent field
continues to name the deleted database's ID.
Protection blocks deletion without blocking sleep, wake or branch. New branches are unprotected unless you request protection; they do not inherit the parent's setting. Renaming and changing protection take effect without a restart or operation.
Database checkpoints and restoration from checkpoints are not supported in this build. See the database API reference for request fields and the workspace permissions required for database actions.