X-Original-To: pgsql-admin-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 72C359FB1D6 for ; Tue, 25 Jul 2006 06:19:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 23429-08 for ; Tue, 25 Jul 2006 06:19:28 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.181]) by postgresql.org (Postfix) with ESMTP id 5CA079FB2E1 for ; Tue, 25 Jul 2006 05:56:17 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id b36so2349092pyb for ; Tue, 25 Jul 2006 01:56:16 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=hbXFFIBElOnvR748pZcX7v2OKKZepaaUgE+PNB61Qc8ObBcVisZ1+jHoRCe+V+iABrqOacUSKXFWC68OnUEQFS6HxR5JrEnV7m7d/l+27TOLNHoUrRsd2fRpEl2Zb9uN6y/CBM6+szsRYi/5HhnP8nXyCmDfQVScMC6mdhzIEIM= Received: by 10.35.27.2 with SMTP id e2mr9146278pyj; Tue, 25 Jul 2006 01:56:16 -0700 (PDT) Received: by 10.35.61.12 with HTTP; Tue, 25 Jul 2006 01:56:16 -0700 (PDT) Message-ID: Date: Tue, 25 Jul 2006 13:56:16 +0500 From: "Shoaib Mir" To: Postgres Subject: Re: Checking what is the current query running In-Reply-To: <3f0d61c40607250115m5660c40cg6a5e1df9e531ff86@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_99413_11802714.1153817776081" References: <3f0d61c40607250115m5660c40cg6a5e1df9e531ff86@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.354 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, HTML_30_40, HTML_MESSAGE, SPF_PASS X-Spam-Level: X-Archive-Number: 200607/199 X-Sequence-Number: 22445 ------=_Part_99413_11802714.1153817776081 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 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 > ------=_Part_99413_11802714.1153817776081 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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.conf file:

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

------=_Part_99413_11802714.1153817776081--