pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Shoaib Mir <shoaibmir@gmail.com>
To: Postgres <pgsql-admin@postgresql.org>
Subject: Re: Checking what is the current query running
Date: Tue, 25 Jul 2006 13:56:16 +0500
Message-ID: <bf54be870607250156g2dd3b85dvf484014108294797@mail.gmail.com> (raw)
In-Reply-To: <3f0d61c40607250115m5660c40cg6a5e1df9e531ff86@mail.gmail.com>
References: <3f0d61c40607250115m5660c40cg6a5e1df9e531ff86@mail.gmail.com>

You have to enable "stats_command_string' in your postgresql.conf file:

stats_command_string = on

After that is done you can view queries running on database server like
this:

select current_query from pg_stat_activity;

You can also get the query execution times and which queries were run, in
the database server logs files by enabling the following in postgresql.conffile:

log_duration = on
log_statement = 'all'

Hope this helps...

Thanks,

Shoaib Mir
EnterpriseDB


On 7/25/06, Marco Bizzarri <marco.bizzarri@gmail.com> wrote:
>
> Hi all.
>
> I've a postgresql where sometimes a process can remaing running a
> query for a very long time.
>
> Aside from logging the queries, is there a way to know which query is
> running in one particular moment?
>
> Regards
> Marco
>
> --
> Marco Bizzarri
> http://notenotturne.blogspot.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
>

view thread (6+ messages)  latest in thread

Message-ID: <bf54be870607250156g2dd3b85dvf484014108294797@mail.gmail.com>
Permalink:  ../bf54be870607250156g2dd3b85dvf484014108294797@mail.gmail.com/
Also on:    postgresql.org/message-id/bf54be870607250156g2dd3b85dvf484014108294797@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: shoaibmir@gmail.com
  Subject: Re: Checking what is the current query running
  In-Reply-To: <bf54be870607250156g2dd3b85dvf484014108294797@mail.gmail.com>
  References: <3f0d61c40607250115m5660c40cg6a5e1df9e531ff86@mail.gmail.com> <bf54be870607250156g2dd3b85dvf484014108294797@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