pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: adey <adey11@gmail.com>
To: Chris Hoover <revoohc@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Any way to see what queries are currently running?
Date: Tue, 16 Aug 2005 16:07:40 +1200
Message-ID: <1c66bda80508152107a29330e@mail.gmail.com> (raw)
In-Reply-To: <1d219a6f05081513546f6458b6@mail.gmail.com>
References: <1d219a6f05081513546f6458b6@mail.gmail.com>

You could try the following query after enabling the
stats_command_string parameter in the postgresql.conf file:-

-- displays current activity in the database
-- postgresql.conf parameter stats_command_string populates the
current_query -- column


select 	datid, 

	datname as "DB Name", 

	substr(procpid,1,6) as "Procpid", 

	substr(usesysid,1,5), 

	usename, 

	current_query as SQL, 

	query_start

from 

	pg_stat_activity

order by 

	procpid

On 8/16/05, Chris Hoover <revoohc@gmail.com> wrote:
> I'm running 7.3.4.  Is there anyway to see the actual sql being run by
> the database via a query?  I am having some problems with long running
> load causing querires from our reporting system.  I have sql logging
> turned on to log the sql statements to my postgres.log file.  However,
> these reporting queries do not appear to be logging the entire query.
> I am only getting the select clause (and I'm not sure if it's all of
> it) but no from or where clause.
> 
> Can I pull these queries out from postgres?
> 
> Thanks,
> 
> Chris
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>



view thread (6+ messages)  latest in thread

Message-ID: <1c66bda80508152107a29330e@mail.gmail.com>
Permalink:  ../1c66bda80508152107a29330e@mail.gmail.com/
Also on:    postgresql.org/message-id/1c66bda80508152107a29330e@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, revoohc@gmail.com
  Subject: Re: Any way to see what queries are currently running?
  In-Reply-To: <1c66bda80508152107a29330e@mail.gmail.com>
  References: <1d219a6f05081513546f6458b6@mail.gmail.com> <1c66bda80508152107a29330e@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