On 6/20/05, Dan Harris <fbsd@drivefaster.net> wrote:
> Also, I'm sure some people will respond with "turn on query
> logging".. I've explored that option and the formatting of the log
> file and the fact that EVERY query is logged is not what I'm after
> for this project.
You don't have to log every query. You can set
log_min_duration_statement in postgresql.conf to log only the queries
that exceed a certain amount of time.
From the manual at
http://www.postgresql.org/docs/8.0/static/runtime-config.html:
log_min_duration_statement (integer)
Sets a minimum statement execution time (in milliseconds) that
causes a statement to be logged. All SQL statements that run for the
time specified or longer will be logged with their duration. Setting
this to zero will print all queries and their durations. Minus-one
(the default) disables the feature. For example, if you set it to 250
then all SQL statements that run 250ms or longer will be logged.
Enabling this option can be useful in tracking down unoptimized
queries in your applications. Only superusers can change this setting.
George Essig