Aiven for PostgreSQL
Aiven for PostgreSQL agent setup
For an overview of how the DBtune agent works, see agent overview.
Prerequisites
Before starting the DBtune agent, ensure you have completed the database setup steps and agent prerequisites.
For information about common environment variables (DBT_DBTUNE_*), see agent overview - common environment variables.
Aiven-specific environment variables
Ensure the Aiven API token’s validity is long enough to run the DBtune agent.
| Variable | Description | Find at |
|---|---|---|
DBT_POSTGRESQL_CONNECTION_URL | PostgreSQL connection URL | Go to the Aiven console > select Projects in the top bar > Go to your PostgreSQL specific project > Services > PostgreSQL service > Copy Service URI |
DBT_AIVEN_API_TOKEN | API token generated from the Aiven console, used by DBtune to authenticate and collect metrics from the Aiven service | Go to the Aiven console > User information (top right profile menu) > Tokens > Generate token |
DBT_AIVEN_PROJECT_NAME | Name of the Aiven project where the target PostgreSQL service is deployed | Go to the Aiven console > select Projects in the top bar > View all projects > Find the PostgreSQL project and copy the project name |
DBT_AIVEN_SERVICE_NAME | Name of the PostgreSQL service within the specified Aiven project | Go to the Aiven console > select Projects in the top bar > Go to your PostgreSQL specific project > Services |
Setting up the agent
Run the DBtune agent using Docker with Aiven-specific configuration:
docker run --restart always \
-e DBT_POSTGRESQL_CONNECTION_URL="postgresql://..." \
-e DBT_AIVEN_API_TOKEN=your-api-token \
-e DBT_AIVEN_PROJECT_NAME=your-project-name \
-e DBT_AIVEN_SERVICE_NAME=your-service-name \
-e DBT_DBTUNE_SERVER_URL=https://app.dbtune.com \
-e DBT_DBTUNE_API_KEY=your-dbtune-api-key \
-e DBT_DBTUNE_DATABASE_ID=your-dbtune-database-id \
public.ecr.aws/dbtune/dbtune/agent:latest
Parameters tuned
DBtune supports multiple tuning modes that determine which parameters can be optimized. For a detailed explanation of tuning modes, see tuning modes.
More parameters will be tuned by DBtune when Aiven opens them through their APIs. Check this page regularly for updates.
Reload-only tuning mode
The following parameters are tuned in reload-only mode:
work_membgwriter_delaybgwriter_lru_maxpagesmax_parallel_workersmax_parallel_workers_per_gather
Restart tuning mode
The following parameter is tuned in restart mode, in addition to all reload-only parameters:
shared_buffers
We use the Aiven API to modify parameters, which limits the set of available parameters that we would normally tune for restart tuning mode.
Aiven-specific monitoring details
Metrics are collected every 30 seconds, rather than the standard 5 seconds. This is due to Aiven's API limitations. DBtune gathers these metrics by reading from system tables, as well as calling the Aiven API.
DBtune queries system metrics to ensure production safety. For up-to-date details, you can refer to the open-source agent.