Locate your postgresql.conf
locate postgresql.conf
Assuming you are a highly skilled super user who fully understands and is responsible for all configuration changes s/he makes, edit postgresql.conf
vi postgresql.conf
Find the section with the log_min_duration_statement option:
/log_min_duration_statement
For the purpose of finding out what to improve, I set mine like this:
log_min_duration_statement = 250 # -1 is disabled, 0 logs all statements
# and their durations, in milliseconds.
A reload is all that is necessary to cause pg to use the new duration - at least after uncommenting the line. I used restart a few times and then successfully tried reload.
Since I am using Debian:
/etc/init.d/postgresql-8.1 reload
My postgresql logs are here:
tail -f /var/log/postgresql/postgresql-8.1-main.log
After finding and fixing some long running queries, be sure to edit your postgresql.conf again and set the
log_min_duration_statement = -1
to turn off the function. Just commenting pg conf file settings out does not guarantee they will return to default, according to pg references I have read.
Be sure to reload and tail the log file to ensure that settings are back to performance mode.
See Power PostgreSQL website for more performance tuning info.
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
Search
Categories
Recent Photos
Recent Visitors
Cristian - Thu 19 Feb 2009 01:10 AM PST
April Lorenzen - Fri 11 Apr 2008 08:31 AM PDT
kitchen - Wed 23 May 2007 11:00 PM PDT
Al Turtle - Fri 24 Mar 2006 04:52 PM PST
Lelain - Sun 19 Feb 2006 10:17 PM PST
Recent Entries
Recent Comments
This Month
Month Archive
Login
|
How to log long running queries in postgresql
Comments
No comments found.
Trackbacks
TrackBack URL: |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||