Runbook

High CPU Usage on PostgreSQL Server

Back to Runbooks

Overview

High CPU usage on a PostgreSQL server is a common incident that can impact overall system performance. This issue occurs when the server's CPU usage is abnormally high, which can lead to slow database queries, reduced server performance, and even downtime. Identifying the root cause of the high CPU usage and implementing effective mitigation measures are critical to resolving this incident.

Parameters

Debug

Check CPU usage by process ID (replace ${PID} with PostgreSQL process ID)

Check active queries on PostgreSQL database

Identify the query with the highest CPU usage

Check for any long-running queries

Check for any blocked queries

Check if there are any slow queries using pgBadger (replace <LOG_FILE_PATH> with PostgreSQL log file path)

An increase in the number of incoming requests to the PostgreSQL server, exceeding its processing capacity.

Insufficient memory allocation to the PostgreSQL server, leading to excessive swapping and increased CPU usage.

Repair

Consider upgrading the server hardware or adding more resources, such as CPU cores or memory, to tackle the high CPU usage.

Learn more

Related Runbooks

Check out these related runbooks to help you debug and resolve similar issues.