PostgreSQLCacheHitRatio
>>>
avg
(
rate
(
pg_stat_database_blks_hit
{datname!~"template.*"}[5m]) / (
rate
(
pg_stat_database_blks_hit
{datname!~"template.*"}[5m]) +
rate
(
pg_stat_database_blks_read
{datname!~"template.*"}[5m]))) by (datname) < 0.98
The query computes, for each non‑template database, the 5‑minute average cache‑hit ratio as hits / (hits + reads) (using pg_stat_database_blks_hit and pg_stat_database_blks_read). The alert fires when this averaged ratio falls below 0.98, indicating the database’s cache hit rate is too low.
Exporters Used
Related Alerts
PostgreSQLDown
PostgreSQLHighConnections
PostgreSQLMaxConnectionsReached
PostgreSQLQPS
PostgreSQLSlowQueries
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