Skip to main content
fresh.dev Docs

Docs / Products / Managed databases

Managed databases_

PostgreSQL 18 on its own machine, on your private network, with TLS on every connection. Fresh installs it, watches it and restarts it if it stops responding. It costs exactly what a machine of the same size costs.

9 sections · 0:39 video Suggest an edit

Create a database

Only account owners can create billed resources. A card must be on file, as for machines.

Recorded from the console and regenerated when the console changes. Sample data.

  1. Open Databases and choose Create database. Give it a name: 3–40 lowercase letters, numbers and hyphens, starting with a letter. It names the database in your console; inside PostgreSQL the database and its owner are both called app.
  2. Choose a size. The sizes and prices are the same as machines; the storage is for your data. The summary shows the price and how long your remaining credit would last.
  3. The database is always on your private network. Turn on Public address only if something outside Fresh needs to connect, and list the trusted sources allowed to reach it. You cannot add or remove the public address later, so decide now.
  4. Create database. Installing PostgreSQL takes a few minutes; the page updates by itself. A failed install is not billed.
The Create a database form: name, engine, size cards and access switches, with the summary showing the price and how long your credit lasts The Create a database form in dark theme
Creating a database.

Connect

A running database: its private address, the connection string, the CA certificate download and the reveal-once password A running database in dark theme
A database's page once it is running.

Connect as app to the database app on port 5432. The page shows a ready-made connection string for each address the database has:

postgresql://app:YOUR_PASSWORD@10.128.0.2:5432/app?sslmode=verify-full&sslrootcert=fresh-database-ca.pem
  • From your machines: use the private address. Machines reach it over your private network without crossing the internet; create machines with Private network turned on.
  • From a trusted source: use the public address, if the database has one, from an address in its trusted sources.
  • TLS is required, and the connection string verifies the server (sslmode=verify-full) with the Fresh database CA certificate so nobody can impersonate your database. Choose Download CA certificate, save it as fresh-database-ca.pem next to your application, or give its path in sslrootcert.

Connections without TLS, connections as the PostgreSQL superuser, and connections from addresses that are not trusted are refused.

The password

The password for app is shown once. On the database's page, under Password, an owner chooses Reveal password and stores it in a password manager or secret store. Afterwards the page says it has been revealed. If it is lost, Reset password sets a new one, which can again be revealed once; the old password stops working as soon as the new one is set.

Public access and trusted sources

A database with a public address accepts PostgreSQL connections from the internet only from its trusted sources: IPv4 addresses or ranges (CIDR, /8 or narrower), one per line, at most 50. Your private network can always connect. With no sources listed, nobody can connect over the internet.

Change the list under Trusted sources on the database's page and choose Save trusted sources. The change is applied live within a few seconds; the page says Applying… until it is, and tells you if it could not be applied.

Query your data

The database's Query tab is a SQL editor in the console, for owners, admins and members. Queries run inside the database as app, the same role your application uses, never as PostgreSQL's superuser.

  1. Open the database and choose Query. The schema on the left lists your tables (with estimated row counts), columns, keys, views and functions; click a name to insert it, double-click a table to query it. The ⋯ beside a table selects its first rows, counts them, shows its definition, starts an ALTER TABLE, or writes a statement to empty or drop it for you to check and run.
  2. New creates a table: name it and its columns (type, not null, primary key, default), and Fresh writes the CREATE TABLE statement into a new tab. View, index and function templates are there too. The schema refreshes by itself after you change it.
  3. Write SQL in the editor. It highlights as you type and completes table, column and function names; Tab or Enter accepts a suggestion, ⌘/ comments lines in or out, and new lines keep their indentation. Each tab keeps its own query in your browser.
  4. Run (⌘↵ or Ctrl+Enter) runs everything in the editor; Run selection runs what you selected, or the statement the cursor is in. Explain shows the plan without running the statement; Explain analyze runs it and then rolls it back. Format tidies the SQL.
  5. Results show the rows of the last statement that returned some (switch statements with the arrows), the plan under Plan, and notices, errors and hints under Messages. An error is also marked in the editor. Copy, CSV and JSON export the rows you see; Chart draws the first number column.
  6. Save (⌘S) keeps a query by name for your whole team. History lists your own runs on this database for 90 days; choose one to open it again.
The Query tab: the schema on the left, a query in the editor with an autocomplete list, twelve result rows, and the history on the right The Query tab in dark theme
The Query tab.

Read-only is on by default. Every run is one transaction: with read-only on it is always rolled back, so nothing can change; a statement that would change something says so and offers Turn off read-only and run again. Turn it off to create tables or change data: the run is committed only if every statement succeeds, and rolled back if any fails, and committed runs are recorded in your account's activity. Because Fresh manages that transaction, BEGIN, COMMIT, ROLLBACK and changes to transaction settings are refused, as are psql's backslash commands and COPY to or from the client; statements that can't run in a transaction, like VACUUM or CREATE INDEX CONCURRENTLY, need psql.

Each statement stops after the timeout you choose (5, 30 or 60 seconds) and waits at most 5 seconds for a lock. Up to 100, 500 or 1,000 rows are shown per statement; the count of all rows is still reported. Results are kept for 15 minutes so the page can show them, then deleted; only the SQL stays in your history. Databases created before the editor was available don't have it; connect with psql instead.

Extensions

Fresh packages and tests 41 PostgreSQL extensions, among them vector (pgvector) for embeddings, PostGIS, pg_trgm, pgcrypto, pg_cron, pg_stat_statements and TimescaleDB. They are free: extensions don't change the plan's price.

  1. On the database's page, open the Extensions tab. Installed shows what the database has, with its version, schema, who enabled it and what uses it; Available lists the rest by category, and the search box finds one by name or purpose ("fuzzy search", "geo").
  2. Choose an extension to read when to use it, an example, and Fresh's notes for your plan size. The panel on the right shows the version, the schema, what else it brings with it, whether PostgreSQL restarts, and the exact statement it runs.
  3. An owner chooses Enable. Extensions go in the extensions schema, which is on the search path, so app uses them without qualifying their names. A few (pg_cron, pg_stat_statements, TimescaleDB, pg_hint_plan) load a library at start-up: enabling one restarts PostgreSQL once, dropping open connections for about ten seconds. The page says so before you confirm.
  4. When a newer packaged version arrives, Update appears beside the extension. Nothing changes until you choose it.
  5. Remove drops the extension, never anything of yours: one that your tables, columns or indexes still use cannot be removed, and the page names what uses it.
A database's Extensions tab: categories on the left, the installed extensions with version, schema, who enabled them and what uses them, a suggestion, and the available extensions The Extensions tab in dark theme
The Extensions tab.

Extensions are created by Fresh as PostgreSQL's superuser, which app is not; you can still create the extensions PostgreSQL marks trusted yourself with CREATE EXTENSION, and the tab shows those too. Extensions apply to the app database. Databases created before extensions were available don't have them; create a new database to use them.

Sizes and prices

A database runs on any machine plan and costs exactly what that plan costs: Fresh 4 at £8 a month maximum, Fresh 8 at £16, Fresh 16 at £30, including VAT, billed per second with the same monthly cap as machines. It appears on your invoice as PostgreSQL · name (plan). See Billing.

Restart, health and backups

  • Fresh checks the database continuously. If it stops responding, PostgreSQL is restarted; if that does not help, the machine is rebooted. Your data is kept.
  • Restart PostgreSQL under Actions restarts it yourself. Open connections are dropped; your data is kept.
  • Backups are not available yet. Keep your own copy with pg_dump from a machine on your private network. Point-in-time recovery, replicas, major-version upgrades and hostnames for databases are not available yet either; clients connect by address.

Delete a database

Under Delete database, type the database's name and confirm. This removes the database and all of its data, releases its addresses, and stops billing immediately. There are no backups, so this cannot be undone: export anything you need first.