PostgreSQLSlowQueries
>>>
avg
(
rate
(
pg_stat_activity_max_tx_duration
{datname!~"template.*"}[2m])) by (datname) > 2 * 60
The rule computes the average per‑database rate of queries whose maximum transaction duration (pg_stat_activity_max_tx_duration) exceeds the threshold over the past 2 minutes, and triggers the alert when that average is greater than 2 × 60 seconds (120 s) for a given datname (and its associated cluster).
Exporters Used
Related Alerts
PostgreSQLCacheHitRatio
PostgreSQLDown
PostgreSQLHighConnections
PostgreSQLMaxConnectionsReached
PostgreSQLQPS
Postgresql SSL compression active
Postgresql bloat index high (> 80%)
Postgresql bloat table high (> 80%)
Postgresql commit rate low
Postgresql configuration changed
Postgresql dead locks
Postgresql down
Postgresql exporter error
Postgresql high rate deadlock
Postgresql high rate statement timeout
Postgresql high rollback rate
Postgresql invalid index
Postgresql low XID consumption
Postgresql not enough connections
Postgresql replication lag
Postgresql restarted
Postgresql table not auto analyzed
Postgresql table not auto vacuumed
Postgresql too many connections
Postgresql too many dead tuples
Postgresql too many locks acquired
Postgresql unused replication slot