Review Alibaba Cloud RDS PostgreSQL duration logging

Record completed SQL statement durations for operational analysis.

Description

On RDS PostgreSQL, log_duration records how long completed statements take.

Potential impact

Without timings, it is harder to identify when queries slowed down. Duration logging alone omits the SQL text.

Remediation

Set log_duration to ON where supported. Run a test query and check for a duration entry. If you also need the SQL text for slow statements, set the threshold with log_min_duration_statement. Review log volume, retention costs and access to sensitive query data.

Examples

Supply a supported database version, instance type and storage for the target environment.

Before

hcl
resource "alicloud_db_instance" "default" {
  engine              = "PostgreSQL"
  engine_version      = var.postgresql_version
  instance_type       = var.db_instance_type
  instance_storage    = var.db_instance_storage

  parameters {
    name  = "log_duration"
    value = "OFF"
  }
}

After

hcl
resource "alicloud_db_instance" "default" {
  engine              = "PostgreSQL"
  engine_version      = var.postgresql_version
  instance_type       = var.db_instance_type
  instance_storage    = var.db_instance_storage

  parameters {
    name  = "log_duration"
    value = "ON"
  }
}

References