October 17, 2006

Useful Postgres tip: log_min_duration_statement

In your $PG_HOME/postgresql.conf:

log_min_duration_statement (integer)

Logs the statement and its duration on a single log line if its duration is greater than or equal to the specified number of milliseconds. Setting this to zero will print all statements 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. </pre>

Next: Come December, it's all changing...
Previous: Reading: Don't Make Me Think