pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: adey <adey11@gmail.com>
To: Aaron Bono <postgresql@aranya.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Monitoring PostgreSQL Process
Date: Thu, 23 Nov 2006 13:02:13 +1300
Message-ID: <1c66bda80611221602w4a2766a1l3dff7b05eedac574@mail.gmail.com> (raw)
In-Reply-To: <bf05e51c0611212149q340c54cdj8763d117ae9f43eb@mail.gmail.com>
References: <bf05e51c0611212149q340c54cdj8763d117ae9f43eb@mail.gmail.com>

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@aranya.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.
>
> Thanks,
> Aaron
>
> --
> ==================================================================
>    Aaron Bono
>    Aranya Software Technologies, Inc.
>    http://www.aranya.com
>    http://codeelixir.com
> ==================================================================

view thread (9+ messages)  latest in thread

Message-ID: <1c66bda80611221602w4a2766a1l3dff7b05eedac574@mail.gmail.com>
Permalink:  ../1c66bda80611221602w4a2766a1l3dff7b05eedac574@mail.gmail.com/
Also on:    postgresql.org/message-id/1c66bda80611221602w4a2766a1l3dff7b05eedac574@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: adey11@gmail.com, postgresql@aranya.com
  Subject: Re: Monitoring PostgreSQL Process
  In-Reply-To: <1c66bda80611221602w4a2766a1l3dff7b05eedac574@mail.gmail.com>
  References: <bf05e51c0611212149q340c54cdj8763d117ae9f43eb@mail.gmail.com> <1c66bda80611221602w4a2766a1l3dff7b05eedac574@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox