PostgreSQL duration logging needs review

PostgreSQL duration logs provide evidence for investigating slow operations and performance problems.

Description

Enable log_duration when you need the duration of every completed SQL statement. The setting alone does not record statement text.

Potential impact

Without timings from logs or another measurement tool, it is harder to locate a slowdown or compare the effect of query changes.

Remediation

On Flexible Server, set log_duration to on. Run a test statement and check for its duration in the logs. For slow statements only, leave log_duration off and choose a log_min_duration_statement threshold. Check log volume, performance impact and retention costs. Restrict access to sensitive SQL text if you collect it.

Examples

The first task targets Single Server, which retired on March 28, 2025. The second configures an existing Flexible Server using azure.azcollection 3.18.0 or later.

Before

yaml
- name: PostgreSQL 설정 변경
  azure.azcollection.azure_rm_postgresqlconfiguration:
    resource_group: myResourceGroup
    server_name: myServer
    name: log_duration
    value: "off"

After

yaml
- name: PostgreSQL 설정 변경
  azure.azcollection.azure_rm_postgresqlflexibleconfiguration:
    resource_group: myResourceGroup
    server_name: myServer
    name: log_duration
    value: "on"

References