Postgres using a lot of resources

Questions and answers regarding general SQL and backend databases

Postgres using a lot of resources

Postby jdbruijn » Thu Nov 17, 2016 5:53 pm

Lately we notice that one of our production servers has serveral postgres processes almost running with 20-30% cpu for extended periodes (sometimes multiple times per hour).
Is there anyway I can see if it are specific queries that make those processes use that much of the cpu?
Jos de Bruijn
Focus Feedback BV
Servoy Certified Developer
Image
jdbruijn
 
Posts: 492
Joined: Sun Apr 11, 2010 6:34 pm

Re: Postgres using a lot of resources

Postby ROCLASI » Fri Nov 18, 2016 11:18 am

Hi Jos,

You can check what connection are open and what queries are running using the following SQL:
Code: Select all
SELECT * FROM pg_stat_activity;

You can also see in the system process list if the process is a background worker process or a connection.
Of course all this means you have to check it the moment you have these loads.
Another way of (continues) tracking is to implement some monitoring using tools like Munin, Cacti, Nagios or Icinga.
I use Munin myself.

Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Postgres using a lot of resources

Postby jdbruijn » Fri Nov 18, 2016 11:33 am

Thanks for the tip Robert, I will look into those tools.
Jos de Bruijn
Focus Feedback BV
Servoy Certified Developer
Image
jdbruijn
 
Posts: 492
Joined: Sun Apr 11, 2010 6:34 pm


Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 7 guests