Skip to Content
Database

Database

Zenifra offers managed databases with PostgreSQL, MariaDB, and Valkey Key‑Value for teams that want to operate applications without manually managing database infrastructure. For event analytics and aggregated queries with ClickHouse, start at the Analytics section.

Choose the database

Each database has its own section with everything about it on Zenifra: how it works inside, how to create, connect, change settings, and see metrics.

DatabaseWhen to useSection
PostgreSQLRelational application data, with transactions, joins, and indexes. From 1 to 6 instances, with read replicas.PostgreSQL on Zenifra
MariaDBApplications built for MySQL or MariaDB, such as WordPress. Always 3 instances, with automatic failover.MariaDB on Zenifra
Valkey key-valueSessions, shared state, counters, and locks, with persistent storage. Not a relational database.Valkey key-value on Zenifra

For every database, see also the settings comparison, the plans, the automatic backups, and the benchmarks.

Required permissions

ActionMinimum scope
Create PostgreSQL or MariaDBdatabase.create on organization:*
Create Valkey key-value storagemanaged_service.create on organization:*
Read a projectproject.read on project:<project-id>
Read status or connectiondatabase.status.read or database.connection.read on database:<project-id>
Read metricsproject.metrics.read on project:<project-id>
Change the passworddatabase.password.rotate on database:<project-id>
Change the versiondatabase.version.update on database:<project-id>
Turn public access on or off (PostgreSQL, MariaDB, ClickHouse)database.exposure.update on database:<project-id>
Turn public access on or off (Valkey)managed_service.exposure.update on managed_service:<project-id>

An owner has full access in a user session. assistant, member, and organization API Keys need the specific grants. Creation requires the organization scope; later operations use the database project ID.

Supported databases

DatabaseSupported versions
PostgreSQL15, 16, 17, 18
MariaDB10, 11
Valkey Key‑Value9.1.1
ClickHouse (Analytics)26.8.6.5 — see the Analytics section

Valkey Key‑Value

Use this product for sessions, shared state, counters, locks, and atomic operations. It is durable, uses db-* plans, and is not a relational database: ad hoc queries, joins, and reports belong in the appropriate system. The connection uses VALKEY_URL, the default user, TLS, and a password revealed once during creation or rotation.

See the complete Key‑Value Database with Valkey guide and the shared connection guide.

Billing modes

PostgreSQL, MariaDB, ClickHouse, and Valkey (Key‑Value, Cache, and Queues) accept hourly, monthly, or yearly billing, chosen at creation. PostgreSQL, MariaDB, and Valkey Key‑Value start at db-starter (R$ 11.90/month per instance, plus storage), ClickHouse uses the analytics-* plans, and Cache and Queues have their own plans (cache-* and queue-*). The free db-free, cache-free, and queue-free plans are legacy plans, available only to organizations that already received the free plans; other organizations get an error when they try to use them. See prices in Database Plans.

Instances (PostgreSQL), storage, and plan can only be changed in hourly billing and outside the db-free plan.

What the platform provides

Video: creating a PostgreSQL database, from the form to the running database page.

Metrics tab of the database page, with CPU and memory over time and the PostgreSQL metrics

  • replication according to each engine's supported topology
  • automatic failover when there is more than one instance (PostgreSQL with 2 to 6 instances; MariaDB always)
  • a platform-generated password, shown only at creation or after a rotation
  • host, port, username, database, and connection URI in the console
  • TLS on connections: always required on MariaDB and required by default on PostgreSQL
  • persistent storage

For Key‑Value, the console shows hostname, port, default username, TLS, and a valkeys:// URI; the full password is not returned by the masked connection read.

Connection details

In the console, you can see:

  • host, in the format postgresql-<project-id>.managed.zenifra.com or mariadb-<project-id>.managed.zenifra.com
  • port
  • username app
  • database name app
  • a ready-to-copy connection URI

The password is generated by the platform and shown only once: on the creation completion screen or after a password rotation. Later reads show the URI with a masked password. If you lose the password, generate a new one in the project edit page. Applications that use the database are not updated automatically: update the connection variable of each one after the change.

Note: the port is assigned by the platform. Copy the values from the console instead of treating them as fixed.

The host and port are public by default and accept TLS connections. If public access is turned off, the connection card shows the Public access off notice and the database only accepts connections from your organization's private network.

For PostgreSQL with 2 to 6 instances, the console also shows a read-only URI that routes queries to the replicas. For MariaDB, the provided connection points to the primary instance.

ClickHouse has two ports per project, documented in the Analytics connections guide.

Public access

PostgreSQL, MariaDB, ClickHouse, and Valkey (Key‑Value, Cache, and Queues) accept connections on the public host and port by default. When the database only needs to serve applications in your own organization, you can turn public access off and use only private connections between applications.

Public accessBehavior
On (default)The public host and port accept TLS connections from anywhere.
OffThe public address stops accepting connections. The database is reachable only through private connections between applications, at <project>.<organization-id>.zenifra.local, or from inside the platform.
  • Turning it back on restores the same host and the same port. The external connection URI stays the same, so external clients do not need to be reconfigured.
  • Private connections between applications keep working in both states.
  • Password or credential rotation remains available while public access is off.
  • The change is made in the Public access card, on the database or Valkey edit page, and asks for confirmation. The database must be running, with no other operation in progress.
  • An owner has the permission. assistant, member, and organization API Keys need an explicit grant: database.exposure.update for PostgreSQL, MariaDB, and ClickHouse, and managed_service.exposure.update for Valkey.

Warning: once it is off, clients outside Zenifra, such as admin tools, local scripts, and applications hosted elsewhere, can no longer connect through the public address. Before turning it off, create the private connections for the applications that use the database and update their connection variable to the internal address.

The console steps are in Change PostgreSQL settings and MariaDB settings. To automate the change, see Databases — API and, for Valkey, Managed services — API.

How to connect your application

Zenifra does not automatically inject DATABASE_URL into your HTTP project.

The correct flow is:

  1. copy the URI or connection details from the console
  2. manually configure DATABASE_URL in the HTTP project

PostgreSQL with psql

The PostgreSQL URI provided by the console uses sslmode=require, which turns TLS on. Just copy the full URI:

psql "postgresql://app:[REDACTED]@<host>:<port>/app?sslmode=require"

On MariaDB, each driver turns TLS on in its own way: pick yours in the Driver selector of the Connection panel and copy the ready-made string. Always use the host provided by the console, not the IP address.

See the examples by language and driver in Connect your application to PostgreSQL and, with what to do when MariaDB answers Access denied with the right password, in Connect your application to MariaDB.

PostgreSQL

To see how it is configured inside (built for OLTP, 8 KiB pages, memory and connections per plan, encryption and replicas), read How Zenifra PostgreSQL works.

  • can operate from 1 to 6 total instances (the db-free plan always uses 1 instance)
  • with 1 instance, only the primary instance exists
  • with multiple instances, the primary handles writes and reads
  • extra instances act as read replicas
  • in hourly billing, the instance count can be increased or decreased later
  • in monthly and yearly billing, the instance count is fixed in the contract
  • requires TLS by default; you can stop requiring it at creation or in the TLS card of the database settings (see Require TLS on PostgreSQL)

MariaDB

To see how it is configured inside (3 instances, memory and connections per plan, replication, and TLS), read How Zenifra MariaDB works.

  • always runs with 3 instances: one primary and two replicas
  • does not allow increasing or decreasing the instance count
  • starts at db-starter
  • uses the InnoDB engine by default
  • always requires TLS

Database version

At creation time, the user can select any version available in the console.

During edit:

  • only forward upgrades are supported, to a version offered by the plan: PostgreSQL 16, 17, or 18; MariaDB 11
  • downgrades are not supported
  • the database must be running

Warning: version upgrades can cause a few minutes of downtime. Make this change during a low-traffic window.

Storage

Every database on Zenifra uses persistent storage.

Storage rules

  • storage can increase
  • storage can never shrink
  • changes are only available in hourly billing; on monthly and yearly contracts, capacity is fixed for the contract term
  • on the db-free plan, storage is fixed at 1 GB
  • increasing storage may cause temporary downtime

Failover and replication

PostgreSQL and MariaDB support automatic failover when replicas exist: if the primary instance fails, a replica can be promoted. For PostgreSQL this requires 2 to 6 instances; with 1 instance there is no replica to take over. MariaDB always runs with 3 instances.

By default, the primary confirms each write without waiting for the replicas, the fastest mode. To make each write also reach a replica before it is confirmed, turn on Write to 2 instances.

During a failover, open connections can be closed. Configure your application to reconnect and retry idempotent operations.

Backups

PostgreSQL and MariaDB have automatic backups included in the plan, with 3 to 30 days of retention. There is no console restore or point-in-time recovery yet: restores are requested from support (see Automatic backups). Replicas protect against instance failure, not against accidental deletion or data corrupted by the application.

Keep your own export routine, for example with pg_dump (PostgreSQL) or mariadb-dump/mysqldump (MariaDB), store the copies outside the project, and test restores periodically.

User access

The user does not have root or superuser access, but does have enough elevated access for normal database usage.

Metrics

PostgreSQL and MariaDB metrics are available on the db-premium and db-enterprise plans. They are shown per instance as a snapshot refreshed every 60 seconds, without history:

  • resources: CPU, memory, and storage usage/capacity
  • connections
  • activity (transactions or queries)
  • read cache
  • database size
  • locks and deadlocks
  • average latency and slow operations
  • health and replication

See the PostgreSQL metrics and MariaDB metrics guides.

Next steps

  1. Connect your application to PostgreSQL or to MariaDB
  2. Database Configuration
  3. Database Plans
  4. Key‑Value Database with Valkey
  5. Analytics and ClickHouse
  6. Create an HTTP project and configure ENVs manually

Last updated on

On this page