pg_stat_activity versus ps

Started by Jeff Amielover 21 years ago4 messagesgeneral
Jump to latest
#1Jeff Amiel
jamiel@istreamimaging.com

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Jeff Amiel (#1)
Re: pg_stat_activity versus ps

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

#3Jeff Amiel
jamiel@istreamimaging.com
In reply to: Tom Lane (#2)
Re: pg_stat_activity versus ps

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:

Show quoted text

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

#4Bruce Momjian
bruce@momjian.us
In reply to: Jeff Amiel (#3)
Re: pg_stat_activity versus ps

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