Skip site navigation (1) Skip section navigation (2)

Re: Finding current SQL activity

From: Thusitha Kodikara <kthusi(at)yahoo(dot)com>
To: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Finding current SQL activity
Date: 2006-10-18 12:11:20
Message-ID: 20061018121120.92554.qmail@web56612.mail.re3.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-admin
Thank you Achilleas for the information. I'll check those points out.

Regards,
-Thusitha

Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)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


In response to

pgsql-admin by date

Next:From: Jurado, Hector R.Date: 2006-10-18 14:34:19
Subject: Need to repair Database
Previous:From: Achilleas MantziosDate: 2006-10-18 09:06:32
Subject: Re: Finding current SQL activity

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group