Dimi Paun wrote:
> Folks,
>
> I am running into a problem with the postmaster: from time to time, it
> runs for a long time. E.g., from top:
>
> 23425 postgres 20 0 22008 10m 10m R 99.9 0.5 21:45.87 postmaster
>
> I'd like to figure out what it is doing. How can I figure out what
> statement causes the problem?
>
> is there a way I can log all SQL statements to a file, together with the
> time it took to execute them?
>
>
You can do one better: you can even explain the statements, based on the
execution time. There is a module called auto explain:
http://www.postgresql.org/docs/8.4/static/auto-explain.html
For the log files, you can parse them using pgfouine and quickly find
out the most expensive SQL statements.
--
Mladen Gogala
Sr. Oracle DBA
1500 Broadway
New York, NY 10036
(212) 329-5251
http://www.vmsinfo.com
The Leader in Integrated Media Intelligence Solutions