How to track query execution time

From: "alan bryan" <alan(dot)bryan(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to track query execution time
Date: 2008-02-05 22:18:40
Message-ID: 892916310802051418u73bbbca8gf37d485d0db8c0d0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've got a web site (apache/php) with a postgres 8.2.5 database(s).

We're now getting some periods of high load. We have a lot of dynamic
queries so I'm not able to just tune and optimize a few known queries
ahead of time.

Is there a way that I can get a list of all the actually SQL queries
as passed to Postgres and the start/completed times (or even just
duration)?
This doesn't need to be real time, log parsing after the fact would
probably be fine too.

Then, I could look at the worst performers and figure out where in the
PHP code that query was built from and then try to tune from there.

Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Barnaby Scott 2008-02-05 22:21:31 mutli row/table constraints
Previous Message Shane Ambler 2008-02-05 22:03:25 Re: Lets get the 8.3 Announcement on the front page of Digg