pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bodor Andras <bodri.mh3@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: binary patch problems
Date: Mon, 19 Sep 2011 17:15:51 +0200
Message-ID: <4E775CA7.3080303@gmail.com> (raw)
In-Reply-To: <4E7753F7.9090903@gmail.com>
References: <4E4ADB2A.5040902@gmail.com>
	<4E53FE39.40501@gmail.com>
	<4E6FA3DA.5090805@gmail.com>
	<CADK3HHKqdj0WOBRVjZCL3o+ss5gxYA4QBC47KeNMBOhM4mCXoQ@mail.gmail.com>
	<4E77155D.8050200@gmail.com>
	<4E7753F7.9090903@gmail.com>

Self correction: I did not read the documentation
carefully enough. prepareThreshold = 1 should be used.
Negative values are changed to 0 by the driver. But
it should be mentioned somewhere, that 0 switches it
off completely.

Bodor Andras wrote:
> You are right. But then it is a bug in either the code,
> or the documentation. It says:
>
> prepareThreshold = int
> Determine the number of PreparedStatement executions required before
> switching over to use server side prepared statements.
>
> I think, if zero executions are required, then the driver
> should use prepared statement immediately. Both permanently
> disabling and immediately enabling is a legitimate need of
> the users, it should be clearly documented, how to do them.
> Anyway, setting prepareThreshold = -1 will do what I meant.
> But it is more logical to me, that 0 means zero and -1 means
> infinity (even better: Integer.MAX_VALUE).
> For the ForceBinaryTransfers I vote for dropping it, as
> it adds unnecessary complications (and new bugs) to the
> code.
> Andras
>
>>> Why don't you set prepareThreshold to 0 for your test cases?
>>> In this case parameter passing starts immediately for the
>>> prepared statement, and ForceBinaryTransfers can be dropped.
>>> Andras
>>>
>  >AbstractJdbc2Statement:
>  > public boolean isUseServerPrepare() {
>  > return (preparedQuery != null && m_prepareThreshold != 0 &&
>  >m_useCount + 1 >= m_prepareThreshold);
>  > }
>  >
>  >If I read the above correctly then prepareThreshold of 0 disables
>  >prepared statements.
>  >
>  >-Mikko




view thread (20+ messages)  latest in thread

Message-ID: <4E775CA7.3080303@gmail.com>
Permalink:  ../4E775CA7.3080303@gmail.com/
Also on:    postgresql.org/message-id/4E775CA7.3080303@gmail.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: bodri.mh3@gmail.com
  Subject: Re: binary patch problems
  In-Reply-To: <4E775CA7.3080303@gmail.com>
  References: <4E4ADB2A.5040902@gmail.com> <4E53FE39.40501@gmail.com> <4E6FA3DA.5090805@gmail.com> <CADK3HHKqdj0WOBRVjZCL3o+ss5gxYA4QBC47KeNMBOhM4mCXoQ@mail.gmail.com> <4E77155D.8050200@gmail.com> <4E7753F7.9090903@gmail.com> <4E775CA7.3080303@gmail.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