pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Finding current SQL activity
3+ messages / 2 participants
[nested] [flat]

* Finding current SQL activity
@ 2006-10-18 08:06  Thusitha Kodikara <kthusi@yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Thusitha Kodikara @ 2006-10-18 08:06 UTC (permalink / raw)
  To: pgsql-admin

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.

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

Thanks in advance.

-Thusitha

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Finding current SQL activity
@ 2006-10-18 09:06  Achilleas Mantzios <achill@matrix.gatewaynet.com>
  parent: Thusitha Kodikara <kthusi@yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Achilleas Mantzios @ 2006-10-18 09:06 UTC (permalink / raw)
  To: pgsql-admin

Óôéò ÔåôÜñôç 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 <postmaster_pid>
where postmaster_pid is 
tail -1 ~postgres/data/postmaster.pid

> Thanks in advance.
>
> -Thusitha

-- 
Achilleas Mantzios



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Finding current SQL activity
@ 2006-10-18 12:11  Thusitha Kodikara <kthusi@yahoo.com>
  parent: Achilleas Mantzios <achill@matrix.gatewaynet.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Thusitha Kodikara @ 2006-10-18 12:11 UTC (permalink / raw)
  To: Achilleas Mantzios <achill@matrix.gatewaynet.com>; pgsql-admin

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

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2006-10-18 12:11 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-10-18 08:06 Finding current SQL activity Thusitha Kodikara <kthusi@yahoo.com>
2006-10-18 09:06 ` Achilleas Mantzios <achill@matrix.gatewaynet.com>
2006-10-18 12:11   ` Thusitha Kodikara <kthusi@yahoo.com>

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