Re: Monitoring PostgreSQL Process

From: "Aaron Bono" <postgresql(at)aranya(dot)com>
To: adey <adey11(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Monitoring PostgreSQL Process
Date: 2006-11-23 02:33:28
Message-ID: bf05e51c0611221833t1ffb48bal6dbbac8398ee946f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I queried pg_stat_activity a bunch of times and was able to tell what tables
were being queried. I finally honed in on the section of code causing the
problem and fix it and all is good on the server now - over 90% idle.

I think the reason some of the processes were showing high CPU usage was
that they are not reporting real time usage but some kind of average. My
guess is that some of the processes that showed high usage were not the
sources of the CPU problems I was currently having.

Thanks all.

On 11/22/06, adey <adey11(at)gmail(dot)com> wrote:
>
> The following query with the stats_command_string parameter turned on will
> give you some of the SQL per transaction:-
>
>
> SELECT
> datid,
> datname as "DB Name",
> substr(procpid,1,6) as "Procpid",
> substr(usesysid,1,5) as "UseSysid",
> usename,
> current_query as "SQL",
> query_start
> FROM
> pg_stat_activity
> order by
> procpid;
>
>
> On 11/22/06, Aaron Bono <postgresql(at)aranya(dot)com> wrote:
> >
> > I have a couple processes/connections to one of our databases that
> > appears to be eating up most of the CPU and we are trying to determine what
> > these processes are doing that is taking so much CPU time.
> >
> > Is there a way to monitor the SQL being run for a specific
> > connection/process?
> >
> > We are using PostgreSQL 8.1.5 on CentOS Linux.
> >
> >

--
==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com
http://codeelixir.com
==================================================================

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Richard Broersma Jr 2006-11-23 03:28:22 Re: PGSQL manager password lost.
Previous Message adey 2006-11-23 02:25:06 Re: PGSQL manager password lost.