A configuration parameter determining whether to log duration of statements

log_duration is a configuration parameter determining whether to log the duration of each statement executed.

log_duration was added in PostgreSQL 7.2.

Default value

The default value for log_duration is: off.

Change history


If log_duration is set to on, each statement executed will result in a corresponding entry in the log file.

For example, executing:

postgres=# SELECT pg_sleep(1);
(1 row)

will generate an entry like the following:

[2021-11-11 17:10:55 UTC] psql postgres postgres LOG:  00000: duration: 1002.239 ms


GUC configuration item, Logging

See also

log_min_duration_statement, log_min_duration_sample, log_min_error_statement