Causes the duration of each completed statement to be logged if the statement ran for at least the specified amount of time. For example, if you set it to
250ms then all SQL statements that run 250ms or longer will be logged. Enabling this parameter can be helpful in tracking down unoptimized queries in your applications. If this value is specified without units, it is taken as milliseconds. Setting this to zero prints all statement durations.
-1 (the default) disables logging statement durations. Only superusers can change this setting.
This overrides guc-log-min-duration-sample, meaning that queries with duration exceeding this setting are not subject to sampling and are always logged.
For clients using extended query protocol, durations of the Parse, Bind, and Execute steps are logged independently.
When using this option together with log_statement, the text of statements that are logged because of log_statement will not be repeated in the duration log message. If you are not using syslog, it is recommended that you log the PID or session ID using log_line_prefix so that you can link the statement message to the later duration message using the process ID or session ID.
- PostgreSQL : Can I retrieve log_min_duration_statement as an integer?
- Whitelist statement from being logged by PostgreSQL due to log_min_duration_statement
- Cannot get log_min_duration_statement to work
- PostgreSQL: how to reset config parameter?
- Logging slow queries on Google Cloud SQL PostgreSQL instances