pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
About pg_stat_activity
3+ messages / 3 participants
[nested] [flat]

* About pg_stat_activity
@ 2011-02-02 15:21 Cesar Arrieta <cesar.cba@gmail.com>
  2011-02-02 17:15 ` Re: About pg_stat_activity Maciek Sakrejda <msakrejda@truviso.com>
  2011-02-02 17:24 ` Re: About pg_stat_activity Greg Smith <greg@2ndquadrant.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Cesar Arrieta @ 2011-02-02 15:21 UTC (permalink / raw)
  To: pgsql-performance

Hi, im César, im developing an app that saves information included in
"pg_stat_activity" view in order to monitor querys. The objective of this
app is to gather information about querys that take to long to finish and
overload the server. I was wandering if I could see somehwere the
implementation of "pg_stat_activity" view, in order to not save the
information in another table, I need to use historical information about
querys.
If you could help looking about this, or if you know about an app that
already do this, please let me know.

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

* Re: About pg_stat_activity
  2011-02-02 15:21 About pg_stat_activity Cesar Arrieta <cesar.cba@gmail.com>
@ 2011-02-02 17:15 ` Maciek Sakrejda <msakrejda@truviso.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Maciek Sakrejda @ 2011-02-02 17:15 UTC (permalink / raw)
  To: Cesar Arrieta <cesar.cba@gmail.com>; +Cc: pgsql-performance

>I was wandering if I could see somehwere the implementation of "pg_stat_activity" view

From psql

\d+ pg_stat_activity
---
Maciek Sakrejda | System Architect | Truviso

1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
www.truviso.com



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

* Re: About pg_stat_activity
  2011-02-02 15:21 About pg_stat_activity Cesar Arrieta <cesar.cba@gmail.com>
@ 2011-02-02 17:24 ` Greg Smith <greg@2ndquadrant.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Greg Smith @ 2011-02-02 17:24 UTC (permalink / raw)
  To: Cesar Arrieta <cesar.cba@gmail.com>; +Cc: pgsql-performance

Cesar Arrieta wrote:
> im developing an app that saves information included in 
> "pg_stat_activity" view in order to monitor querys. The objective of 
> this app is to gather information about querys that take to long to 
> finish and overload the server.

I hope you're already setting log_min_duration_statement, then analyzing 
the resulting logs using something like pgFouine.  If you have 
PostgreSQL 8.4 or later, possibly add loading the auto_explain module as 
well, or collecting the data using pg_stat_statements instead can be 
useful.  Trying to grab this info in real-time from pg_stat_activity 
instead is a lot of work and won't give you results as good.  If you're 
already doing something like that and are just looking to increase the 
amount of info you collect by also looking at pg_stat_activity, that can 
be worthwhile.

Maciek just gave the quickest answer to your main question; I'll just 
add that reading the source code to the file system_views.sql will show 
you how pg_stat_activity as well as other interesting built-in views work.

-- 
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books




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


end of thread, other threads:[~2011-02-02 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-02 15:21 About pg_stat_activity Cesar Arrieta <cesar.cba@gmail.com>
2011-02-02 17:15 ` Maciek Sakrejda <msakrejda@truviso.com>
2011-02-02 17:24 ` Greg Smith <greg@2ndquadrant.com>

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