Tom Lane wrote:
> Gaetano Mendola <mendola@bigfoot.com> writes:
> > P.A.M. van Dam wrote:
> >> I'm looking for a command or method to find out what queries are
> >> currently being serviced by the database.
>
> > select * from pg_stat_activity;
>
> ... having first remembered to turn on stats_command_string; and
> thou shalt also be superuser.
And 7.5 will print out a more helpful message if you forget to set
these:
test=> select * from pg_stat_activity;
datid | datname | procpid | usesysid | usename | current_query | query_start
-------+---------+---------+----------+----------+------------------------------+-------------
17227 | test | 15527 | 100 | guest | <command string not enabled> |
17227 | test | 15574 | 1 | postgres | <insufficient privilege> |
(2 rows)
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073