Re: log_statement vs log_min_duration_statement

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Atul Kumar <akumar14871(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: log_statement vs log_min_duration_statement
Date: 2023-09-27 08:12:45
Message-ID: 605173d4ea36cbd20d96c8f4695d00a558b4a543.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2023-09-27 at 00:01 +0530, Atul Kumar wrote:
> 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.

log_statement = 'ddl' will log all DDL.

log_min_duration_statement = 1 will log all statements that take longer
than a millisecond.

These settings are independent from each other. So PostgreSQL logs
all statements that are DDL *OR* that take longer than a millisecond,
rather than all statements that are DDL *AND* take longer than a
millisecond, as you seem to expect.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message dld 2023-09-27 08:51:37 Re: Early binding of CURRENT_SCHEMA (Was: CREATE FUNCTION ... SEARCH {, DEFAULT | SYSTEM | SESSION })
Previous Message Erik Wienhold 2023-09-27 02:03:32 Re: Early binding of CURRENT_SCHEMA (Was: CREATE FUNCTION ... SEARCH {, DEFAULT | SYSTEM | SESSION })