HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMajor

Troubleshooting high CPU usage from postgres and postmaster services?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
postmasterpostgreshighusageservicestroubleshootingandcpufrom

Problem

I'm using an open source (RHEL 6.2) based machine running SIEM software. When I run the top command, I see postgres and postmaster both with 96% CPU usage. Is there a way to pin-point or see what causing these service to stack up?

Solution

You can match a specific Postgres backend ID to a system process ID using the pg_stat_activity system table.

SELECT pid, datname, usename, query FROM pg_stat_activity; can be a good starting point.

Once you know what queries are running you can investigate further (EXPLAIN/EXPLAIN ANALYZE; check locks, etc.)

Context

StackExchange Database Administrators Q#44084, answer score: 49

Revisions (0)

No revisions yet.