Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlCxy-001kK4-L8 for pgsql-general@arkaria.postgresql.org; Tue, 26 Sep 2023 18:39:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qlCxx-00EGdu-8s for pgsql-general@arkaria.postgresql.org; Tue, 26 Sep 2023 18:39:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlCxw-00EGdg-Ow for pgsql-general@lists.postgresql.org; Tue, 26 Sep 2023 18:39:24 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlCxt-006mbf-DN for pgsql-general@lists.postgresql.org; Tue, 26 Sep 2023 18:39:23 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8D1A35C0113; Tue, 26 Sep 2023 14:39:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 26 Sep 2023 14:39:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1695753559; x=1695839959; bh=P7 FHcIWnTM4Xf9mU/NjfAFvcHspwMJhUfnIRITgAv3U=; b=KHthXFLR1N13YW4S8J P+/RqtJXZaf4MSuWfkZdUB24W0wsVl4WSLTY1W6on2cNYePDNmJ3/kvXenisKlQH ZhJQ/XAY5pMtkjjWAccBGJbWsxfSrhA9mEWY/EDSdo0qscTluJXMveyt+q0aQDjv d0isbuG2iMrW0BbcR29684IYAtiyXi36isU866XvMgIXYtwI6MDBY1bBHHHIy+GB yhbQ9p0Sd1jX7MdWAPw9oRh5Uzv3QtpH7xuhmQ9dJLxvVEQ3NtaIItVEc63+m3jj jAlJV80iPFDEhl6B1939Q7bDFO3fiNiN/U+dIETX+NWWcwYYmhwvNlA5jZTawngn yXdg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1695753559; x=1695839959; bh=P7FHcIWnTM4Xf 9mU/NjfAFvcHspwMJhUfnIRITgAv3U=; b=npKCkymtAQbO5JVYDXksl91mIGBUJ fqHUQRmRMmWwlGUiP7tuS9/Z6FtjUEmNkzzjz1l8J1p4uch0KG21WmncabVMxtHp sGWFIYrg66KdhoaJM4LWmPX6drrXxzxCvXvVwsANYgrdh8qY9b8L9QkVYO37xg/k FiAsif/M1igKtyY60fYykB5WT/G5jIiGBfURxsLh3OAH7+LfXYw9HEH4KW1bzTnf me9yM9OZSDSs0VxXbsz/zOLilyyLeA5iF0qXd3/H0weHt4jj9qYu3pfLAzaHUDsV 8rGk7zEfJqKjDhfEW+p1JgxsWu68Pn7Dwy8Wlpg9XJCN84M84buWdHhiQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvjedrtddtgdelkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpegtkfffgggfuffvfhfhjgesrgdtreertdefjeenucfhrhhomheptegurhhirghn ucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqe enucggtffrrghtthgvrhhnpeejgfdtuedufedvkeegleejveehueeljeduveegledugfek udeiudekleeltdevleenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghn rdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 26 Sep 2023 14:39:18 -0400 (EDT) Content-Type: multipart/alternative; boundary="------------JASkYPtAWainUr0b9sFiGfPb" Message-ID: <3cfeb936-a53c-7d67-2616-c9ccbf66f236@aklaver.com> Date: Tue, 26 Sep 2023 11:39:17 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: log_statement vs log_min_duration_statement Content-Language: en-US To: Atul Kumar , pgsql-general References: From: Adrian Klaver In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------JASkYPtAWainUr0b9sFiGfPb Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 --------------JASkYPtAWainUr0b9sFiGfPb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


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
--------------JASkYPtAWainUr0b9sFiGfPb--