Skip site navigation (1) Skip section navigation (2)

Postgres using 100% CPU

From: "Nik" <XLPizza(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Postgres using 100% CPU
Date: 2006-02-14 14:46:48
Message-ID: 1139928408.281298.232690@g44g2000cwa.googlegroups.com (view raw)
I have a fairly large (about 30Gb) PostgreSQL 8.1 database running on
Windows 2003 Server.
I noticed that CPU utilization on the server is 100% for past few days,
and postgres process is taking up most of that CPU (95%-100%). There is
only one connection to the database at the time and that one is not
doing any queries.

I turned off stats collector, and any row stat collectors, and I
increased the number of check points since I have been getting the
error about check point switches being to frequent. Postgres now uses a
bit less CPU (60-90%), which is still a lot considering that no
processing is being done. Is there anything else I can do to lower this
CPU utilization? Is there a way I can pinpoint exactly what part of
postgres is using this CPU?

Thanks.


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: "Nik" <XLPizza(at)gmail(dot)com>
Subject: Re: Postgres using 100% CPU
Date: 2006-02-15 17:04:21
Message-ID: 200602151804.21850.peter_e@gmx.net (view raw)
Nik wrote:
> I noticed that CPU utilization on the server is 100% for past few

100% CPU usage is not a problem.  When the number of waiting processes 
goes up, then you have a reason to start being concerned.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Nik <XLPizza(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres using 100% CPU
Date: 2006-02-15 17:25:07
Message-ID: b42b73150602150925o7cf398dbhdcda2ef61fa7c1c@mail.gmail.com (view raw)
n 14 Feb 2006 06:46:48 -0800, Nik <XLPizza(at)gmail(dot)com> wrote:

> I turned off stats collector, and any row stat collectors, and I
> increased the number of check points since I have been getting the
> error about check point switches being to frequent. Postgres now uses a
> bit less CPU (60-90%), which is still a lot considering that no
> processing is being done. Is there anything else I can do to lower this
> CPU utilization? Is there a way I can pinpoint exactly what part of
> postgres is using this CPU?

something is seriously wrong.  Fire up the task manager and determine
the pid of the process that is sucking cpu.  Then query
pg_stat_activity to determine who/what is doing it (you will have to
restore stats). consider setting statement logging to get the exact
offender.

Merlin

From: Nikola Ivanov <xlpizza(at)gmail(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Nik <XLPizza(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres using 100% CPU
Date: 2006-02-15 19:33:29
Message-ID: 66182b050602151133s671e380fnf9ec8e6a5a936d8b@mail.gmail.com (view raw)
I found the pid of the postgres process that was consuming all the CPU. I
turned the stats back on (and reloaded the conf file), but when I query
pg_stat_activity I get nothing back. No records.

On 2/15/06, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
>
> n 14 Feb 2006 06:46:48 -0800, Nik <XLPizza(at)gmail(dot)com> wrote:
>
> > I turned off stats collector, and any row stat collectors, and I
> > increased the number of check points since I have been getting the
> > error about check point switches being to frequent. Postgres now uses a
> > bit less CPU (60-90%), which is still a lot considering that no
> > processing is being done. Is there anything else I can do to lower this
> > CPU utilization? Is there a way I can pinpoint exactly what part of
> > postgres is using this CPU?
>
> something is seriously wrong.  Fire up the task manager and determine
> the pid of the process that is sucking cpu.  Then query
> pg_stat_activity to determine who/what is doing it (you will have to
> restore stats). consider setting statement logging to get the exact
> offender.
>
> Merlin
>
From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Nikola Ivanov <xlpizza(at)gmail(dot)com>
Cc: Nik <XLPizza(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Postgres using 100% CPU
Date: 2006-02-15 20:35:35
Message-ID: b42b73150602151235j57bbcb75uc885dcc5b759ed08@mail.gmail.com (view raw)
On 2/15/06, Nikola Ivanov <xlpizza(at)gmail(dot)com> wrote:
> I found the pid of the postgres process that was consuming all the CPU. I
> turned the stats back on (and reloaded the conf file), but when I query
> pg_stat_activity I get nothing back. No records.

did you restart server?  I think stats collector setting is only set
on server start.  You may want to consider using pg_ctl to kill that
pid.  I also think about leaving command strings stats on for a while
depending on your transaction volume.  There is some overhead but the
information it gives can be highly useful.

Merlin


Privacy Policy | About PostgreSQL
Copyright © 1996-2013 The PostgreSQL Global Development Group