How to profile PostgreSQL Database?

Yogi Yang 007 picture Yogi Yang 007 · Dec 13, 2008 · Viewed 31.7k times · Source

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?

Answer

rebra picture rebra · Dec 13, 2008

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