PostgreSQLSlowQueries

Description PostgreSQL high number of slow queries {{ $labels.cluster }} for database {{ $labels.datname }} with a value of {{ $value }}
Query for 2m
>>>
	
				
					
					
						avg
					
				
			
				
					(
				
			
				
					
					
						rate
					
				
			
				
					(
				
			
				
					
				
			
				
					{datname!~"template.*"}[2m])) by (datname) > 2 * 60
				
			
    
Query Explanation

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

Get Alert
Download
Copy to Clipboard