Re: How to list what queries are running in postgres?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gaetano Mendola <mendola(at)bigfoot(dot)com>, "P(dot)A(dot)M(dot) van Dam" <pam(at)ramoth(dot)xs4all(dot)nl>, pgsql-admin(at)postgresql(dot)org
Subject: Re: How to list what queries are running in postgres?
Date: 2004-07-06 02:27:13
Message-ID: 200407060227.i662REq15694@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Tom Lane wrote:
> Gaetano Mendola <mendola(at)bigfoot(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Bruno Wolff III 2004-07-06 05:04:39 Re: standard IDENTITY support (Was: Re: SERIAL type not autoincremented)
Previous Message Simon Riggs 2004-07-05 23:11:45 Re: Point in Time Recovery