Description
Enable log_checkpoints on Flexible Server to investigate writes during checkpoints and restartpoints. PostgreSQL still runs checkpoints when this diagnostic setting is off.
Potential impact
Without checkpoint records, it is harder to relate disk writes to the database activity occurring during a slowdown.
Remediation
Set log_checkpoints to on and check its effective value on the target server. After the next checkpoint completes, look for its duration and buffer count in the log destination. Set retention and reader access, and configure connection or query audit logs separately if needed.
Examples
The first resource targets retired Single Server. The second uses server_id to configure an existing Flexible Server. Server creation and data migration are separate steps.
Before
resource "azurerm_postgresql_configuration" "example" {
name = "log_checkpoints"
resource_group_name = data.azurerm_resource_group.example.name
server_name = azurerm_postgresql_server.example.name
value = "OFF"
}
After
resource "azurerm_postgresql_flexible_server_configuration" "example" {
name = "log_checkpoints"
server_id = azurerm_postgresql_flexible_server.example.id
value = "on"
}