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

From Andres Freund
Subject Re: query logging of prepared statements
Date
Msg-id 20190406011638.pgb7uxjz2hnhavsu@alap3.anarazel.de
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
Hi,

On 2019-04-04 16:01:26 -0300, Alvaro Herrera wrote:
> 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.

I'm not actually sure I buy this.  Consider e.g. log analysis for
workloads with long-running connections. If most statements are just
already prepared statements - pretty common in higher throughput apps -
the query will suddenly be either far away in the logfile (thereby
requiring pretty expensive analysis to figure out the corresponding
statement) or even in a different logfile due to rotation.

I'm sympathetic to the desire to reduce log volume, but I'm fearful this
would make log analysis much harder.  Searching through many gigabytes
just to find the query text of the statement being executed over and
over doesn't sound great.

I think deduplicating the logging between bind and execute has less of
that hazard.

- Andres



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Ordered Partitioned Table Scans
Next
From: Andres Freund
Date:
Subject: Re: New vacuum option to do only freezing