Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id C157F9FB229 for ; Wed, 18 Oct 2006 09:11:26 -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 80404-06 for ; Wed, 18 Oct 2006 09:11:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from web56612.mail.re3.yahoo.com (web56612.mail.re3.yahoo.com [66.196.97.56]) by postgresql.org (Postfix) with SMTP id B432C9FA219 for ; Wed, 18 Oct 2006 09:11:21 -0300 (ADT) Received: (qmail 92556 invoked by uid 60001); 18 Oct 2006 12:11:20 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=dfYDex/cOjvnBxiSVrkwt2T4fUGkYFA5aohVjT1lWrIvWP5T3HSItMHhbtSGu5clLTqt07BZVxuxQcsMd6TJbuWqz0tvybZm84gyI7QvqwX9FmQ5pEaAmLarU+qfObQT4bzYD0NxSq1CHCz0rJodDVfQj1XwzDl22R6aOdi89Wg= ; Message-ID: <20061018121120.92554.qmail@web56612.mail.re3.yahoo.com> Received: from [203.115.30.220] by web56612.mail.re3.yahoo.com via HTTP; Wed, 18 Oct 2006 05:11:20 PDT Date: Wed, 18 Oct 2006 05:11:20 -0700 (PDT) From: Thusitha Kodikara Subject: Re: Finding current SQL activity To: Achilleas Mantzios , pgsql-admin@postgresql.org In-Reply-To: <200610181206.33958.achill@matrix.gatewaynet.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-919768445-1161173480=:92089" Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=3.753 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS, HTML_MESSAGE X-Spam-Level: *** X-Archive-Number: 200610/110 X-Sequence-Number: 23413 --0-919768445-1161173480=:92089 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Thank you Achilleas for the information. I'll check those points out. Regards, -Thusitha Achilleas Mantzios wrote: Στις Τετάρτη 18 Οκτώβριος 2006 11:06, ο/η Thusitha Kodikara έγραψε: > Hi, > > I would like to find the current (and very recent) SQL statements. I went > through 'pg_stat_activity'. But it showed only the current statement I was > issuing. Going through the defintion of 'pg_stat_activity' I came across > pg_stat_get_backend_activity(), and I thought if I could get the source of > this function I would be able to further. But I can't see the definition of > this function. > pg_stat_get_backend_activity() is an internal function, so in order to see how it works you must look .../src/backend/utils/adt/pgstatfuncs.c > Am I on the right direction, or is there an easier way? I would appreciate > if someone can give some suggestions. > However, the system can give only active queries, if you need recent queries then you should enable log_statement = true in postgresql.conf and kill -HUP where postmaster_pid is tail -1 ~postgres/data/postmaster.pid > Thanks in advance. > > -Thusitha -- Achilleas Mantzios ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings --0-919768445-1161173480=:92089 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Thank you Achilleas for the information. I'll check those points out.

Regards,
-Thusitha

Achilleas Mantzios <achill@matrix.gatewaynet.com> wrote:
Στις Τετάρτη 18 Οκτώβριος 2006 11:06, ο/η Thusitha Kodikara έγραψε:
> Hi,
>
> I would like to find the current (and very recent) SQL statements. I went
> through 'pg_stat_activity'. But it showed only the current statement I was
> issuing. Going through the defintion of 'pg_stat_activity' I came across
> pg_stat_get_backend_activity(), and I thought if I could get the source of
> this function I would be able to further. But I can't see the definition of
> this function.
>

pg_stat_get_backend_activity() is an internal function, so in order to see how
it works you must look .../src/backend/utils/adt/pgstatfuncs.c

> Am I on the right direction, or is there an easier way? I would appreciate
> if someone can give some suggestions.
>

However, the system can give only active queries, if you need recent queries
then you should enable
log_statement = true
in postgresql.conf and
kill -HUP
where postmaster_pid is
tail -1 ~postgres/data/postmaster.pid

> Thanks in advance.
>
> -Thusitha

--
Achilleas Mantzios

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

--0-919768445-1161173480=:92089--