Azure Database for PostgreSQL flexible server
Azure Database for PostgreSQL flexible server agent setup
For an overview of how the DBtune agent works, see agent overview.
Prerequisites
Before starting the DBtune agent, there is some setup you are required to complete on your database.
Azure Database for PostgreSQL flexible server requires you to allow specific extensions explicitly before they can
be used, pg_stat_statements (which the DBtune agent requires) is one of these. First, allowlist the extension by adding it to the azure.extensions server parameter.
After pg_stat_statements is enabled, you will also need to update
the pg_stat_statements.track server parameter. By default this will be set to off, it needs to be set to either top or all for the extension to collect the information DBtune requires.
Once you have setup pg_stat_statements, ensure you have completed the remaining database setup steps.
Azure managed identity IAM permissions
The agent is setup to utilize the managed identity attached to an Azure Virtual Machine. The IAM role associated with those credentials is required to be able to perform the following actions:
"actions": [
"Microsoft.DBforPostgreSQL/flexibleServers/restart/action",
"Microsoft.DBforPostgreSQL/flexibleServers/read",
"Microsoft.DBforPostgreSQL/flexibleServers/providers/Microsoft.Insights/metricDefinitions/read",
"Microsoft.DBforPostgreSQL/flexibleServers/configurations/read",
"Microsoft.DBforPostgreSQL/flexibleServers/configurations/write",
"Microsoft.Insights/metrics/read",
"Microsoft.Insights/metricDefinitions/read"
]
Setting up the agent
Run the DBtune agent using Docker with PostgreSQL flexible server-specific configuration:
docker run --restart always \
-e DBT_POSTGRESQL_CONNECTION_URL="postgresql://..." \
-e DBT_AZURE_FLEX_SUBSCRIPTION_ID=your-subscription-id \
-e DBT_AZURE_FLEX_RESOURCE_GROUP_NAME=your-resource-group-name \
-e DBT_AZURE_FLEX_SERVER_NAME=your-flexible-server-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
For information about common environment variables (DBT_DBTUNE_* and DBT_POSTGRESQL_*), see agent overview - common environment variables.
Azure Database for PostgreSQL flexible server-specific environment variables
| Variable | Description |
|---|---|
DBT_AZURE_FLEX_SUBSCRIPTION_ID | The ID of the Azure subscription that your PostgreSQL Felible Server instance is in. |
DBT_AZURE_FLEX_RESOURCE_GROUP_NAME | The name of the Resource Group that your PostgreSQL Flexible Server instance is in. |
DBT_AZURE_FLEX_SERVER_NAME | The name of your PostgreSQL flexible server instance. |
Parameters tuned
DBtune supports multiple tuning modes that determine which parameters can be optimized. For a detailed explanation of tuning modes, see tuning modes.
Reload-only tuning mode
The following parameters are tuned in reload-only mode:
The following parameters are tuned in reload-only mode:
work_memrandom_page_costseq_page_costcheckpoint_completion_targeteffective_io_concurrencymax_parallel_workers_per_gathermax_parallel_workersmax_wal_sizemin_wal_sizebgwriter_lru_maxpagesbgwriter_delaydefault_statistics_targetmax_parallel_maintenance_workers
Restart tuning mode
Currently, restart tuning mode is not supported for Azure Database for PostrgeSQL flexible server.