views:

2911

answers:

6

I want to profile (keep an Eye on) all the activities that goes on in a Database which is in PostgreSQL.

Is there any such utility which will help me do this?

+3  A: 

Well, if you're looking at what's going on, regarding selects, updates, deletes, and so on, there are a few tables in the pg_catalog schema, I mainly use pg_stat_user_tables and pg_stat_user_indexes but there are many more, all within pg_stat*.

There also is the pg_stat_activity view which tells you what's running on your server right now.

I've hacked together four munin plugins that uses the user_tables and user_indexes, they're available there

mat
+1  A: 

Have a look at Nagios-Plugin script or check_postgres.pl

Endlessdeath
+9  A: 

"Keep an eye on" and "profile" are two quite different tasks in my view.

For profiling (not a live view on what's going on right now, but to see which queries take most time etc), check out pgFouine:

http://pgfouine.projects.postgresql.org/

This will let you see which queries are resource intensive, and take appropriate action: Add missing indexes, rewrite queries using other techiques etc.

rebra
A: 

By 'Eye On' I mean that I want to know as to what is happening at every single second in the database. I have to do this because we are using a software which is running on pgSQL and at times it performs very slowly and other times is performs a very high speed.

Want to diagnose as to what is the problem. Why does it slow down at times?

Yogi Yang 007
Please, edit your question, don't post answers.
mat
+6  A: 

For "keeping an eye", I use pgtop, a program which deliberately mimics Unix 'top' command.

bortzmeyer
To save someone a minute or two: I found this only under the package name ptop in Debian, though the command itself is called pg_top.
Gunnlaugur Briem
A: 

Thanks everyone

Yogi Yang 007
Edit your question, do not post answers. And read the comments, it was already said.
bortzmeyer