Database

A PostgreSQL-compatible database in your VPC.

Create a Database resource, connect psql 16 or your PostgreSQL driver to the IPv6 address in its status, and use SQL within the limits below. Underneath is our own engine, not a PostgreSQL server. It runs as an Etorm process on your VPC and keeps its data in an encrypted bucket.

Creating a database

A Database names a VPC, a user and a database name.

kind: Database
metadata: {name: shop}
spec:
  vpcRef: {name: lan}         # required

Its short name is db, so this lists them:

kubectl get db

We generate the password when you create the database and show it to you once. The platform keeps only a SCRAM-SHA-256 verifier, so if you lose the password you set a new one: raise spec.passwordGeneration, and the response to that change shows the new password once. The old one stops working for new logins.

The primary is a process with an address on the VPC, and it answers on port 5432. A client on a member of the VPC logs in with SCRAM-SHA-256, and a wrong password is refused. There are two separate kinds of access here. Who may connect is decided by the database's own user and password. Who may create, change, read or delete the Database object is decided by roles on the project. There is a quickstart in the developer docs.

How much of PostgreSQL you get

We wrote our own engine rather than run PostgreSQL. Clients and drivers connect to it over the PostgreSQL version 16 wire protocol and dialect, and psql 16 and tokio-postgres work with it. From psql 16 you create tables, insert rows and run aggregates, index scans and interval arithmetic.

Writing it ourselves means compatibility comes in levels, and the engine is at level 2. Check the second row before you move an existing application over.

Level 2What it covers
IncludedTables with the core types, primary keys, NOT NULL, defaults and sequences; INSERT, UPDATE, DELETE and ON CONFLICT; joins, grouping, ordering and aggregates; transactions and savepoints; prepared statements.
Outside itArrays, time, COPY, LISTEN/NOTIFY, views, enforced check constraints, ON DELETE actions other than RESTRICT, and ranges, ordering and joins through indexes. Server-side C extensions and PL/pgSQL are not supported.

Where the data lives

There is no PostgreSQL server behind the endpoint and no disk. All data is in an encrypted bucket. Every commit is one object written to that bucket, and the commit is acknowledged only once the write has succeeded. An instance recovers its state by reading the bucket. You pay for that with one object write for every commit, and in return there is no local disk that can take acknowledged data with it.

Transactions and isolation

Every transaction reads one snapshot, and the first committer wins. A transaction fails with SQLSTATE 40001 if another one committed a write, after its snapshot, to a key it also writes. Your application should be ready to retry on that code.

The engine reports this level as REPEATABLE READ, and requests for READ COMMITTED or SERIALIZABLE get the same. Snapshot isolation does allow write skew across different rows: two transactions that each read the same rows and then write different ones can both commit.

If the storage or the primary goes away

What is lostWhat happens
The storage behind the bucketCommits fail with an error. Reads are served from memory where possible. Nothing is acknowledged before it is stored.
The primaryIn-flight transactions are aborted. A commit is acknowledged only when its write to the bucket has succeeded.
Memory above the instance's boundThe activation fails and the process restarts.
The Database object (deleted)Its processes and its bucket are deleted and the bucket's keys are destroyed. The data cannot be read again.

Sizes and limits

PropertyValue
Protocol and dialectPostgreSQL version 16 wire protocol and dialect. Works with psql 16 and tokio-postgres.
LoginSCRAM-SHA-256. Connections do not use TLS: a TLS request is declined. Cancel requests are not supported.
EndpointAn IPv6 address of the VPC, port 5432. The address is in the resource status.
InstancesOne primary, which serves reads and writes.
MemoryDefaults to 4 MiB per instance (memoryPower 6); a process may use at most 256 MiB.
CPUDefaults to 250 millicores per instance.

The database is a Compute process underneath; see Compute on the architecture page.

Request access