|
Home > Archive > PostgreSQL Administration > October 2006 > Finding current SQL activity
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Finding current SQL activity
|
|
| Thusitha Kodikara 2006-10-25, 8:24 am |
| 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
| |
| Achilleas Mantzios 2006-10-25, 8:24 am |
| Στις Τετάρτη 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
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
| |
| Thusitha Kodikara 2006-10-25, 8:24 am |
| 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
|
|
|
|
|