PostgreSQLCacheHitRatio

Description PostgreSQL low on cache hit rate on {{ $labels.cluster }} for database {{ $labels.datname }} with a value of {{ $value }}
Query for 5m
>>>
	
				
					
					
						avg
					
				
			
				
					(
				
			
				
					
					
						rate
					
				
			
				
					(
				
			
				
					
				
			
				
					{datname!~"template.*"}[5m]) / (
				
			
				
					
					
						rate
					
				
			
				
					(
				
			
				
					
				
			
				
					{datname!~"template.*"}[5m]) + 
				
			
				
					
					
						rate
					
				
			
				
					(
				
			
				
					
				
			
				
					{datname!~"template.*"}[5m]))) by (datname) < 0.98
				
			
    
Query Explanation

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

Get Alert
Download
Copy to Clipboard