pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Timing problem wtih pg_stat_activity
2+ messages / 1 participants
[nested] [flat]

* Timing problem wtih pg_stat_activity
@ 2007-10-10 17:12 Donald Fraser <postgres@kiwi-fraser.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Donald Fraser @ 2007-10-10 17:12 UTC (permalink / raw)
  To: pgsql-admin

PostgreSQL 8.1.9, Linux Redhat ES 4

I am experiencing a timing issue with the following query:
SELECT count(procpid) FROM pg_stat_activity WHERE usename='someuser'

If I execute the above query by the client who is user "someuser" and it is executed immediately after connecting I am getting two different results depending on the speed of the connection. If I connect to the database on a local area network of 100Mb/s and immediately execute the statement, I see the result of 0. If I connect to the same database over a slow connection, for example 115kb/s and immediately execute the statement, I see the result of 1.

Is this normal behaviour?

Regards
Donald Fraser

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Timing problem wtih pg_stat_activity
@ 2007-10-10 17:22 Donald Fraser <postgres@kiwi-fraser.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Donald Fraser @ 2007-10-10 17:22 UTC (permalink / raw)
  To: pgsql-admin

Please ignore my previous question - I should have read the documents first!

The answer is here:
"When using the statistics to monitor current activity, it is important to 
realize that the information does not update instantaneously. Each 
individual server process transmits new block and row access counts to the 
collector just before going idle; so a query or transaction still in 
progress does not affect the displayed totals. Also, the collector itself 
emits a new report at most once per PGSTAT_STAT_INTERVAL milliseconds (500 
unless altered while building the server). So the displayed information lags 
behind actual activity. However, current-query information collected by 
stats_command_string is always up-to-date."

Regards
Donald Fraser 




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-10-10 17:22 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-10-10 17:12 Timing problem wtih pg_stat_activity Donald Fraser <postgres@kiwi-fraser.net>
2007-10-10 17:22 Timing problem wtih pg_stat_activity Donald Fraser <postgres@kiwi-fraser.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox