---
title: "Configure PostgreSQL Settings"
description: "Set PostgreSQL, PgBouncer, pglookout and TimescaleDB parameters on Managed PostgreSQL with the exo CLI or the API instead of postgresql.conf."
url: https://community.exoscale.com/product/dbaas/service-specific/postgresql/how-to/configure-settings/
product: "PostgreSQL"
section: product
last_updated: 2026-11-12
---
> For AI agents: the documentation index is at https://community.exoscale.com/llms.txt. Every page is available as markdown at `<page URL>index.md` or with `Accept: text/markdown`.

# Configure PostgreSQL Settings

Tune a Managed PostgreSQL service, for example to log slow queries or raise a memory setting. You
set parameters on the service with the `exo` CLI instead of editing `postgresql.conf`, from a
curated set of PostgreSQL, PgBouncer, pglookout and TimescaleDB parameters.

## Setting Namespaces

Parameters are grouped in namespaces. Each namespace has its own discovery argument and its own
update flag:

| Namespace | Discover with | Set with |
| --- | --- | --- |
| PostgreSQL | `exo dbaas type show pg --settings pg` | `exo dbaas update --pg-settings` |
| PgBouncer | `exo dbaas type show pg --settings pgbouncer` | `exo dbaas update --pg-bouncer-settings` |
| pglookout | `exo dbaas type show pg --settings pglookout` | `exo dbaas update --pg-lookout-settings` |
| TimescaleDB | `exo api get-dbaas-settings-pg` | `exo dbaas update --pg-timescaledb-settings` |

The TimescaleDB namespace has a single parameter, `max_background_workers`. `exo dbaas type show pg
--settings timescaledb` prints nothing, so read its definition from the API:

```bash
exo api get-dbaas-settings-pg -q 'settings.timescaledb'
```

pgaudit settings have no `exo dbaas update` flag. Set them through the API with the
`pgaudit-settings` field of `exo api update-dbaas-service-pg`.

## Discover the Available Parameters

Settings are a fixed catalog: a parameter that is not in it cannot be changed, and `ALTER SYSTEM`
is not available because `avnadmin` is not a superuser.

```bash
exo dbaas type show pg --settings NAMESPACE
```

Parameters:

- `NAMESPACE`: one of `pg`, `pgbouncer` or `pglookout`.

For example:

```bash
exo dbaas type show pg --settings pg
```

The output lists every key with its type and description. For the `pg` namespace, the description
gives the allowed range and default, and says whether changing the parameter restarts the service.

## Set a Parameter

```bash
exo dbaas update SERVICE_NAME -z ZONE -f --pg-settings='JSON_OBJECT'
```

Parameters:

- `SERVICE_NAME`: name of the Managed PostgreSQL service, for example `my-postgresql`.
- `ZONE`: zone the service runs in, for example `ch-gva-2`.
- `-f`: apply without asking for confirmation. Without it, `exo dbaas update` asks first, because
  some parameters restart the service. In a script or a CI job nothing answers the prompt and the
  change is not applied, so always pass `-f` when automating.
- `JSON_OBJECT`: a JSON object whose keys are parameter names from the `pg` namespace.

For example, to turn on I/O timing and log every statement slower than 500 ms:

```bash
exo dbaas update my-postgresql -z ch-gva-2 -f \
  --pg-settings='{"log_min_duration_statement":500,"track_io_timing":"on"}'
```

An update is merged into the stored configuration: parameters you do not send keep their current
value. To revert a parameter, send its default value explicitly.

Values must match the type declared in the catalog: integers unquoted, booleans as `true` or
`false`, strings quoted. Some parameters that take `on` and `off` are declared as strings, for
example `track_io_timing` and `track_commit_timestamp`, while `jit` is a boolean.

`autovacuum`, `bg-writer` and `wal` are nested objects in the `pg` namespace: the parameters they
group go inside them. For example:

```bash
exo dbaas update my-postgresql -z ch-gva-2 -f \
  --pg-settings='{"autovacuum":{"autovacuum_naptime":30},"wal":{"wal_sender_timeout":90000}}'
```

The other namespaces work the same way:

```bash
exo dbaas update my-postgresql -z ch-gva-2 -f \
  --pg-bouncer-settings='{"min_pool_size":5,"server_reset_query_always":true}'
```

## Read the Settings Back

```bash
exo dbaas show SERVICE_NAME -z ZONE --settings=NAMESPACE
```

Parameters:

- `SERVICE_NAME`: name of the Managed PostgreSQL service.
- `ZONE`: zone the service runs in.
- `NAMESPACE`: `pg`, `pgbouncer`, `pglookout` or `timescaledb`.

For example:

```bash
exo dbaas show my-postgresql -z ch-gva-2 --settings=pg
```

This returns, as JSON, the parameters stored in the service configuration, including a few set by
the platform.

To check the value in force inside the database, ask PostgreSQL:

```sql
SHOW log_min_duration_statement;
```

`pg_settings` also tells you where each value came from and how it can be changed:

```sql
SELECT name, setting, unit, context, source
FROM pg_settings
WHERE name IN (
  'log_min_duration_statement',
  'max_connections',
  'track_io_timing',
  'work_mem'
)
ORDER BY name;
```

The `context` column tells you how a parameter can be changed:

- `postmaster`: only when the server restarts.
- `sighup`: a configuration reload is enough.
- `user`: any role, `avnadmin` included, can also change it for a session, a role or a database.
- `superuser`: only a superuser can change it for a session, so `avnadmin` gets
  `permission denied` and has to use the service configuration.

## Use a JSON File

Long configurations are easier to keep in a file under version control. Write the object to
`pg-settings.json`:

```json
{
  "autovacuum": {
    "autovacuum_vacuum_cost_limit": 2000
  },
  "idle_in_transaction_session_timeout": 300000,
  "log_min_duration_statement": 500,
  "log_temp_files": 1024,
  "pg_stat_statements.track": "top",
  "track_io_timing": "on"
}
```

Then pass its contents:

```bash
exo dbaas update my-postgresql -z ch-gva-2 -f --pg-settings "$(<pg-settings.json)"
```

`$(<file)` works in bash and zsh. In other shells, use `$(cat pg-settings.json)`.

## Parameters That Require a Restart

> [!WARNING]
> Some parameters restart the service when they change. A restart closes every open connection,
> including pooled ones, and applications must reconnect. Apply these changes in a window you
> control.

In the output of `exo dbaas type show pg --settings pg`, the description of these parameters ends
with `Changing this parameter causes a service restart.` They include `max_worker_processes`,
`max_locks_per_transaction`, `max_prepared_transactions`, `max_replication_slots`,
`max_logical_replication_workers`, `track_commit_timestamp` and `track_activity_query_size`, as
well as `autovacuum_max_workers` in the `autovacuum` object and `max_wal_senders` in the `wal`
object.

## Session and Role Level Settings

Parameters whose `context` is `user` can be set without touching the service configuration. Use
this when only one application or one role needs a different value:

```sql
ALTER ROLE reporting SET work_mem = '64MB';
ALTER DATABASE analytics SET statement_timeout = '10min';
SET LOCAL statement_timeout = '30s';
```

`ALTER ROLE` and `ALTER DATABASE` settings apply when a server connection is opened, so they also
reach applications that go through a connection pool in `transaction` mode, where a `SET` issued
by the client would not stick.

## Other PostgreSQL Flags

A few tunables have flags of their own rather than keys inside `--pg-settings`:

```bash
exo dbaas update my-postgresql -z ch-gva-2 -f \
  --pg-work-mem=8 \
  --pg-shared-buffers-percentage=40
```

- `--pg-work-mem`: memory a single query operation can use before writing to temporary files, in
  MB.
- `--pg-shared-buffers-percentage`: share of the node memory used for shared buffers, from 20 to
  60.
- `--pg-backup-schedule`: start time of the daily backup, as `HH:MM`.
- `--pg-synchronous-replication`: `quorum` or `off`. `quorum` is not available on Startup,
  Business and Premium plans.

Run `exo dbaas update --help-pg` for the full list of PostgreSQL flags.

## Upgrade the Major Version

`exo dbaas update` has no flag to change the PostgreSQL major version: upgrades go through the
API. Check first that the service can be upgraded to the target version:

```bash
echo '{"target-version":"VERSION"}' | \
  exo api create-dbaas-pg-upgrade-check SERVICE_NAME -z ZONE
```

Parameters:

- `VERSION`: the target major version, for example `17`.

The response contains the `pg_upgrade` consistency checks, which end with
`*Clusters are compatible*` when the upgrade can proceed. The upgrade only starts if the most
recent check on the service passed for the same version. Then start the upgrade:

```bash
echo '{"version":"VERSION"}' | \
  exo api update-dbaas-service-pg SERVICE_NAME -z ZONE
```

> [!CAUTION]
> A major version upgrade cannot be reverted, and the backups taken before the upgrade are no
> longer available afterwards, so you cannot fork back to the old version. On Startup, Business
> and Premium plans, test the upgrade first on a fork of the service, see
> [Manage Backups and Restores](https://community.exoscale.com/product/dbaas/how-to/backups-restore/index.md).

## Troubleshooting

| Symptom | Cause | Fix |
| --- | --- | --- |
| A change made from a script or CI job is not applied | `exo dbaas update` waited for a confirmation that nothing answered. | Pass `-f`. |
| `jit: Invalid type. Expected: boolean, given: string` | The value does not match the declared type. | Check the type in `exo dbaas type show pg --settings pg`: integers unquoted, booleans `true` or `false`, strings quoted. |
| `Additional property ... is not allowed` | A parameter of the `autovacuum`, `bg-writer` or `wal` object was sent at the top level. | Put it inside its object. |
| A value of `null` is rejected | `null` does not revert a parameter. | Send the default value explicitly. |
| `permission denied` when running `SET` for a parameter | The parameter has the `superuser` context. | Set it on the service with `--pg-settings`. |
| `Synchronous replication not available for current plan` | `--pg-synchronous-replication=quorum` on a Startup, Business or Premium plan. | Leave it `off`. |
| `exo dbaas type show pg --settings timescaledb` prints nothing | The CLI does not list this namespace. | Read it with `exo api get-dbaas-settings-pg -q 'settings.timescaledb'`. |

## Related Pages

- [Manage Maintenance Windows](https://community.exoscale.com/product/dbaas/how-to/maintenance-windows/index.md)
- [Use Terraform for DBaaS](https://community.exoscale.com/product/dbaas/how-to/terraform/index.md)
- [Limits and Quotas](https://community.exoscale.com/product/dbaas/service-specific/postgresql/service-boundaries/limits-and-quotas/index.md)

