pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Atul Kumar <akumar14871@gmail.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: log_statement vs log_min_duration_statement
Date: Tue, 26 Sep 2023 11:39:17 -0700
Message-ID: <3cfeb936-a53c-7d67-2616-c9ccbf66f236@aklaver.com> (raw)
In-Reply-To: <CA+ONtZ7dOdN4hdqcgrNeVAe1U2BDGyYDA53aG2FydbM5s1qJ1g@mail.gmail.com>
References: <CA+ONtZ7dOdN4hdqcgrNeVAe1U2BDGyYDA53aG2FydbM5s1qJ1g@mail.gmail.com>


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 
<https://www.postgresql.org/docs/12/runtime-config-logging.html#GUC-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 
<https://www.postgresql.org/docs/12/runtime-config-logging.html#GUC-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

view thread (5+ messages)  latest in thread

Message-ID: <3cfeb936-a53c-7d67-2616-c9ccbf66f236@aklaver.com>
Permalink:  ../3cfeb936-a53c-7d67-2616-c9ccbf66f236@aklaver.com/
Also on:    postgresql.org/message-id/3cfeb936-a53c-7d67-2616-c9ccbf66f236@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, akumar14871@gmail.com
  Subject: Re: log_statement vs log_min_duration_statement
  In-Reply-To: <3cfeb936-a53c-7d67-2616-c9ccbf66f236@aklaver.com>
  References: <CA+ONtZ7dOdN4hdqcgrNeVAe1U2BDGyYDA53aG2FydbM5s1qJ1g@mail.gmail.com> <3cfeb936-a53c-7d67-2616-c9ccbf66f236@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox