Thread: pg_stat_activity versus ps

pg_stat_activity versus ps

From
Jeff Amiel
Date:
I ran a home-grown self continuous stress test tool against my 7.4.2
database.

I banged 'ps' (running freebsd) while it was active and witnessed
several of the 'back end' postgres processes exeucting queries, commits,
inserts, etc....(the actual work the processes were doing was listed in
the 'ps' output)
however, if I checked pg_stat_activity during the same time period, I
saw nothing populated in the current_query column...ever.

Am I misunderstanding what the pg_stat_activity table is for?  I
confirmed that the procpid listed in pg_stat_activity was the same as
listed in my 'ps' process list....


Jeff

Re: pg_stat_activity versus ps

From
Tom Lane
Date:
Jeff Amiel <jamiel@istreamimaging.com> writes:
> however, if I checked pg_stat_activity during the same time period, I
> saw nothing populated in the current_query column...ever.

Did you have it turned on?  (stats_command_string config parameter)

Were you checking as superuser?

            regards, tom lane

Re: pg_stat_activity versus ps

From
Jeff Amiel
Date:
That was it. (not having it turned on.  duh).
Guess I should have read  section 23.2 of the docs..."The Statistics
Collector"
Thanks for the heads up.

Jeff


Tom Lane wrote:

>Jeff Amiel <jamiel@istreamimaging.com> writes:
>
>
>>however, if I checked pg_stat_activity during the same time period, I
>>saw nothing populated in the current_query column...ever.
>>
>>
>
>Did you have it turned on?  (stats_command_string config parameter)
>
>Were you checking as superuser?
>
>            regards, tom lane
>
>
>
>


Re: pg_stat_activity versus ps

From
Bruce Momjian
Date:
Jeff Amiel wrote:
> That was it. (not having it turned on.  duh).
> Guess I should have read  section 23.2 of the docs..."The Statistics
> Collector"

8.0 will give clear output showing it is not turned on our you don't
have permissions.

--
  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