I use PostgreSQL 14. My Postgres conf:
logging_collector = on
log_min_duration_statement = 400
log_connections = on
log_disconnections = on
log_duration = off
log_line_prefix = '%Q %r %d ' #%Q = query ID %r = remote host and port %d = database name
log_statement = 'all'
And i get log:
2022-06-24 10:08:36.668 UTC [92] LOG: statement:
UPDATE ***
SET ****
WHERE ***
Why it not have 'duration'? I want get log:
2022-06-24 10:08:36.668 UTC [92] LOG: duration: 5944.540 ms statement:
UPDATE ***
SET ****
WHERE ***
CodePudding user response:
Try setting log_statement = 'none'
, then all statements running for more than 0.4 seconds will be logged along with their duration.