Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to profile PostgreSQL Database?

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?

like image 406
Yogi Yang 007 Avatar asked Dec 13 '08 11:12

Yogi Yang 007


People also ask

What is profile in PostgreSQL?

EDB Postgres Advanced Server allows a database superuser to create named profiles. Each profile defines rules for password management that augment password and md5 authentication. The rules in a profile can: count failed login attempts. lock an account due to excessive failed login attempts.


2 Answers

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

like image 95
rebra Avatar answered Oct 08 '22 10:10

rebra


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

like image 27
bortzmeyer Avatar answered Oct 08 '22 09:10

bortzmeyer