pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Csaba Nagy <nagy@ecircle-ag.com>
Cc: Dave Cramer <pg@fastcrypt.com>
Cc: Postgres JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: Prepared statements, parameters and logging
Date: Tue, 26 Jun 2007 09:40:52 +1200
Message-ID: <46803664.3060701@opencloud.com> (raw)
In-Reply-To: <1182778475.13328.79.camel@coppola.muc.ecircle.de>
References: <1182768449.13328.60.camel@coppola.muc.ecircle.de>
	<6A182763-97EC-43C9-BD13-EE5375A83AC2@fastcrypt.com>
	<1182770018.13328.63.camel@coppola.muc.ecircle.de>
	<C8485EE8-2EA6-4C87-91CB-E5370A3BDC53@fastcrypt.com>
	<1182775348.13328.69.camel@coppola.muc.ecircle.de>
	<9537AA08-53BB-434E-9E62-F326AADED792@fastcrypt.com>
	<1182778475.13328.79.camel@coppola.muc.ecircle.de>

Csaba Nagy wrote:

> Before I was using prepareThreshold='1', and I was seeing only such
> entries in the server log:
> 
> duration: 5437.499 ms  statement: EXECUTE <unnamed>  [PREPARE:  SELECT
> ... ]
> 
> Note the <unnamed> in the log entry, it was always there for each
> statement.

I believe that's logging execution of an unnamed portal, not an unnamed 
statement. I'm not sure whether the current server logging actually lets 
you tell whether a named statement was used/reused or not (at least that 
was one of my complaints about early versions of it -- haven't checked 
what current versions do).

If the statement name is logged, it'd be something like "S_12345".

> After setting prepareThreshold='0', I started getting 2 kinds of log
> entries, the ones like above, and the likes:
> 
> duration: 2200.570 ms  statement: EXECUTE C_220047  [PREPARE:  SELECT
> ... ]
> 
> Note the C_220047, that's what's changed...

C_.... are portals ("cursors")

If you're using setFetchSize() to avoid pulling in the whole resultset 
at once, the driver has to use a named statement and named portal 
regardless of the prepare-threshold setting (because portals are closed 
when their creating statement is closed, and the unnamed statement gets 
closed when reused)

-O



view thread (12+ messages)  latest in thread

Message-ID: <46803664.3060701@opencloud.com>
Permalink:  ../46803664.3060701@opencloud.com/
Also on:    postgresql.org/message-id/46803664.3060701@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, nagy@ecircle-ag.com, pg@fastcrypt.com
  Subject: Re: Prepared statements, parameters and logging
  In-Reply-To: <46803664.3060701@opencloud.com>
  References: <1182768449.13328.60.camel@coppola.muc.ecircle.de> <6A182763-97EC-43C9-BD13-EE5375A83AC2@fastcrypt.com> <1182770018.13328.63.camel@coppola.muc.ecircle.de> <C8485EE8-2EA6-4C87-91CB-E5370A3BDC53@fastcrypt.com> <1182775348.13328.69.camel@coppola.muc.ecircle.de> <9537AA08-53BB-434E-9E62-F326AADED792@fastcrypt.com> <1182778475.13328.79.camel@coppola.muc.ecircle.de> <46803664.3060701@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox