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.