Re: query logging of prepared statements - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: query logging of prepared statements
Date
Msg-id 20190404190126.GA6155@alvherre.pgsql
Whole thread Raw
In response to Re: query logging of prepared statements  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: query logging of prepared statements
List pgsql-hackers
On 2019-Apr-04, Alvaro Herrera wrote:

> I think we could improve on this by setting a "logged" flag in the
> portal; if the Parse logs the statement, then don't include the
> statement in further lines, otherwise do.

Also: I think such a flag could help the case of a query that takes
long enough to execute to exceed the log_min_duration_statement, but not
long enough to parse.  Right now, log_min_duration_statement=500 shows

2019-04-04 15:59:39 -03 [6353-1] LOG:  duration: 2002.298 ms  execute <unnamed>
2019-04-04 15:59:39 -03 [6353-2] DETAIL:  parameters: $1 = 'joe''s place'

if I change the testlibpq3 query to be 
    "SELECT * FROM test1 WHERE t = $1 and pg_sleep(1) is not null",

Also, if you parse once and bind/execute many times, IMO the statement
should be logged exactly once.  I think you could that with the flag I
propose.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Shawn Debnath
Date:
Subject: Re: Retronym: s/magnetic disk/main data/
Next
From: Andres Freund
Date:
Subject: Re: COPY FROM WHEN condition