Postgresql high rollback rate
warning

Description Ratio of transactions being aborted compared to committed is > 2 %
Query
>>>
	
				
					sum by (namespace,datname) ((
				
			
				
					
					
						rate
					
				
			
				
					(
				
			
				
					
				
			
				
					{datname!~"template.*|postgres",datid!="0"}[3m])) / ((
				
			
				
					
					
						rate
					
				
			
				
					(
				
			
				
					
				
			
				
					{datname!~"template.*|postgres",datid!="0"}[3m])) + (
				
			
				
					
					
						rate
					
				
			
				
					(
				
			
				
					
				
			
				
					{datname!~"template.*|postgres",datid!="0"}[3m])))) > 0.02
				
			
    
Query Explanation

The query computes, for each (namespace, datname) pair, the 3‑minute rate of rolled‑back transactions divided by the sum of rolled‑back and committed transaction rates (excluding template and postgres databases). The alert triggers when this rollback‑to‑total transaction ratio exceeds 2 % for any database, indicating a high abort rate.

Get Alert
Download
Copy to Clipboard