PostgreSQL

Create a PostgreSQL database, connect services to it, browse and query it, and reach it from your own machine.

Dekka runs PostgreSQL 16 or 17 in your project's region. A database is private, so only services you connect to it can reach it, unless you turn on its TCP proxy.

Create a database

On the canvas, choose Add, then PostgreSQL. Pick a name, a Version and how much Storage it needs, and choose Create database. A new database has 100 MiB of storage and 256 MiB of memory unless you choose otherwise.

The storage of every database in your organisation counts against one allowance: 100 MiB on Free, 1 GiB on Starter and 5 GiB on Growth. In Settings you can grow a database's storage and change its memory, and the dashboard only offers sizes larger than the current storage. The version is fixed once the database exists.

Connect a service

Drag from a service to the database. The service receives DATABASE_URL in the form postgresql://<user>:<password>@<host>:5432/<database>?sslmode=require, with credentials that belong only to it, and it restarts to pick them up. Two services connected to one database each get their own user. Most drivers read the whole URL:

import postgres from "postgres";

export const sql = postgres(process.env.DATABASE_URL!);

Browse tables and run a query

Select the database and open Data. Tables lists each table with an estimate of its rows and its size, and Query runs one read-only statement, such as a SELECT, WITH, EXPLAIN or SHOW. Dekka refuses anything that writes or changes the database, returns up to 500 rows and stops a query after 10 seconds. Each query is recorded in your organisation's Activity with its length and a hash, never its text or results.

Rotate credentials

Under Credentials on the Data tab, choose Rotate. Every connected service gets a new user and password and restarts with the new DATABASE_URL. To see a service's full URL, reveal its DATABASE_URL on the Environment tab.

Connect from your own machine

Turn on Public TCP proxy in the database's settings, stage the change and deploy it. Dekka gives the database a public host and a port between 10000 and 60000, and anyone with valid credentials can then connect, so turn it off again when you're done. TCP proxy shows how to find the address and connect with psql.

Backups and failover

Dekka takes a backup of each database every day and keeps it for seven days, and Back up now on the Data tab takes one straight away. Backups explains where they're kept and how to restore one.

During the pilot each database runs on a single server without automatic failover.

Delete a database

Disconnect every service first, then choose Delete database from the database's menu and type its name to confirm. Deleting a database removes it and everything in it, and Dekka never deletes one as a side effect of deleting something else.