Re: log_statement vs log_min_duration_statement - Mailing list pgsql-general

From Adrian Klaver
Subject Re: log_statement vs log_min_duration_statement
Date
Msg-id 3cfeb936-a53c-7d67-2616-c9ccbf66f236@aklaver.com
Whole thread Raw
In response to log_statement vs log_min_duration_statement  (Atul Kumar <akumar14871@gmail.com>)
List pgsql-general


On 9/26/23 11:31 AM, Atul Kumar wrote:
Hi,

I have a query about parameters  and log_statement

my postgres version is 12 and running on centos 7

my log_statement is set to "DDL".

and log_min_duration_statement is set to "1ms"

so technically it should log "ONLY DDLs" that take more than 1ms.

but to my surprise, postgres is logging DML as well which is taking more than 1ms.

What am I missing here to understand, because as per my understanding log_statement and log_min_duration_statement are correlated, postgres should log according to log_statement parameter.

Please advise me on this behavior.


https://www.postgresql.org/docs/12/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHAT


"

log_min_duration_statement (integer)

Causes the duration of each completed statement to be logged if the statement ran for at least the specified amount of time.

    <...>

Note

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.

"



Regards,
Atul

pgsql-general by date:

Previous
From: Atul Kumar
Date:
Subject: log_statement vs log_min_duration_statement
Next
From: Ron
Date:
Subject: Re: Ad hoc SETOF type definition?