Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id D96609FA2CA for ; Wed, 18 Oct 2006 06:06:41 -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 32004-09 for ; Wed, 18 Oct 2006 06:06:38 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from matrix.gatewaynet.com (host2.dynacom.ondsl.gr [62.103.35.210]) by postgresql.org (Postfix) with ESMTP id 28B509FA27F for ; Wed, 18 Oct 2006 06:06:37 -0300 (ADT) Received: from host3.dynacom.ondsl.gr ([62.103.35.211] helo=ip216.internal.net) by matrix.gatewaynet.com with esmtp (Exim 4.62) (envelope-from ) id 1Ga7Nj-0006ZG-9B for pgsql-admin@postgresql.org; Wed, 18 Oct 2006 12:06:35 +0300 From: Achilleas Mantzios Organization: Dynacom Tankers Mgmt To: pgsql-admin@postgresql.org Subject: Re: Finding current SQL activity Date: Wed, 18 Oct 2006 12:06:32 +0300 User-Agent: KMail/1.9.3 References: <20061018080606.90849.qmail@web56608.mail.re3.yahoo.com> In-Reply-To: <20061018080606.90849.qmail@web56608.mail.re3.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-7" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200610181206.33958.achill@matrix.gatewaynet.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.168 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/109 X-Sequence-Number: 23412 =D3=F4=E9=F2 =D4=E5=F4=DC=F1=F4=E7 18 =CF=EA=F4=FE=E2=F1=E9=EF=F2 2006 11:0= 6, =EF/=E7 Thusitha Kodikara =DD=E3=F1=E1=F8=E5: > 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=20 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=20 log_statement =3D true in postgresql.conf and=20 kill -HUP where postmaster_pid is=20 tail -1 ~postgres/data/postmaster.pid > Thanks in advance. > > -Thusitha =2D-=20 Achilleas Mantzios