Skip to content

Commit

Permalink
update postgresql parameters for db investigations
Browse files Browse the repository at this point in the history
  • Loading branch information
alismx committed Jun 7, 2023
1 parent a87238f commit 5616fda
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions ops/services/postgres_db/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,40 @@ resource "azurerm_postgresql_flexible_server_configuration" "pgms_wait_sampling_
server_id = azurerm_postgresql_flexible_server.db.id
value = "ALL"
}

# resource "azurerm_postgresql_flexible_server_configuration" "extensions" {
# name = "azure.extensions"
# server_id = azurerm_postgresql_flexible_server.db.id
# value = "PG_STAT_STATEMENTS"
# }

# AzureDiagnostics
# | where ResourceProvider =="MICROSOFT.DBFORPOSTGRESQL"
# | where Category == "PostgreSQLLogs"
# | where Message contains "duration:"

resource "azurerm_postgresql_flexible_server_configuration" "log_min_duration_statement" {
name = "log_min_duration_statement"
server_id = azurerm_postgresql_flexible_server.db.id
value = 0
}

# This is useful for finding queries that have the most impact on our system. It's disabled by default for performance reasons.

# Top 10 I/O intensive queries:
# select userid::regrole, dbid, query
# from pg_stat_statements
# order by (blk_read_time+blk_write_time)/calls desc
# limit 10;

# Top 10 time comsuming queries:
# select userid::regrole, dbid, query
# from pg_stat_statements
# order by mean_time desc
# limit 10;

resource "azurerm_postgresql_flexible_server_configuration" "pg_stat_statements" {
name = "pg_stat_statements.track"
server_id = azurerm_postgresql_flexible_server.db.id
value = "top"
}

0 comments on commit 5616fda

Please sign in to comment.