Is there a way in PostgreSQL 11.2 to log the duration only for the slow queries?
If I set
log_duration=off
log_min_duration_statement=2000
The slow statements are logged, but I have no idea how long they took. If I set:
log_duration=on
log_min_duration_statement=2000
then the duration of each statement is printed in the log.
There are no tags in the log_line_prefix
parameter to include query duration.
I found that the parameter log_statement was wrongly set to 'all', after setting:
log_statement = 'none'
log_duration=off
log_min_duration_statement=2000
The log correctly traces only long queries and also writes their duration (after the prefix)