Re: Any way to see what queries are currently running?

From: adey <adey11(at)gmail(dot)com>
To: Chris Hoover <revoohc(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Any way to see what queries are currently running?
Date: 2005-08-16 04:07:40
Message-ID: 1c66bda80508152107a29330e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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(at)gmail(dot)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
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2005-08-16 04:35:17 Re: Any way to see what queries are currently running?
Previous Message Tom Lane 2005-08-16 01:33:10 Re: Any way to see what queries are currently running?