Re: [HACKERS] [PATCHES] log_statement output for protocol - Mailing list pgsql-jdbc

From Bruce Momjian
Subject Re: [HACKERS] [PATCHES] log_statement output for protocol
Date
Msg-id 200608290233.k7T2XUu17676@momjian.us
Whole thread Raw
Responses Re: [HACKERS] [PATCHES] log_statement output for protocol
List pgsql-jdbc
bruce wrote:
> BTom Lane wrote:
> > Bruce Momjian <bruce@momjian.us> writes:
> > > Yes, I do.  I have applied the attached patch to fix this issue and
> > > several others.  The fix was to save the bind parameters in the portal,
> > > and display those in the executor output, if available.
> >
> > I have a feeling you just blew away the 4% savings in psql I've spent
> > the evening on.  What's the overhead of this patch?
>
> The only overhead I see is calling log_after_parse() all the time,
> rather than only when log_statement is all.  I could fix it by checking
> log_statement and log_min_duration_statement >= 0.  Does
> log_after_parse() look heavy to you?

OK, I applied this patch to call log_after_parse() only if necessary.
The 'if' statement looked pretty ugly, so the optimization seemed
overkill, but maybe it will be useful.

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/tcop/postgres.c,v
retrieving revision 1.500
diff -c -c -r1.500 postgres.c
*** src/backend/tcop/postgres.c    29 Aug 2006 02:11:29 -0000    1.500
--- src/backend/tcop/postgres.c    29 Aug 2006 02:29:48 -0000
***************
*** 871,877 ****
      parsetree_list = pg_parse_query(query_string);

      /* Log immediately if dictated by log_statement */
!     was_logged = log_after_parse(parsetree_list, query_string, &prepare_string);

      /*
       * Switch back to transaction context to enter the loop.
--- 871,879 ----
      parsetree_list = pg_parse_query(query_string);

      /* Log immediately if dictated by log_statement */
!     if (log_statement != LOGSTMT_NONE || log_duration ||
!         log_min_duration_statement >= 0)
!         was_logged = log_after_parse(parsetree_list, query_string, &prepare_string);

      /*
       * Switch back to transaction context to enter the loop.

pgsql-jdbc by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] [PATCHES] log_statement output for protocol
Next
From: "Vidas Makauskas"
Date:
Subject: outOfMemoryError