From: | George Essig <george(dot)essig(at)gmail(dot)com> |
---|---|
To: | Dan Harris <fbsd(at)drivefaster(dot)net> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: investigating slow queries through pg_stat_activity |
Date: | 2005-06-20 20:30:38 |
Message-ID: | 6744b38505062013302b4f1864@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On 6/20/05, Dan Harris <fbsd(at)drivefaster(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Rohit Gaddi | 2005-06-21 07:42:23 | index selection by query planner |
Previous Message | Tom Lane | 2005-06-20 19:11:44 | Re: investigating slow queries through pg_stat_activity |