From: Mark Lewis <mark.lewis@mir3.com>
To: Guy Rouillier <guyr@masergy.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Bind message
Date: Mon, 25 Sep 2006 12:23:18 -0700
Message-ID: <1159212198.9657.1713.camel@archimedes> (raw)
In-Reply-To: <D4D1632DC736E74AB95FE78CD609007923B0F7@mtxexch01.add0.masergy.com>
References: <D4D1632DC736E74AB95FE78CD609007923B0F7@mtxexch01.add0.masergy.com>
On Mon, 2006-09-25 at 14:00 -0500, Guy Rouillier wrote:
> Dave Cramer wrote:
> > Hi,
> >
> >
> > The default is not to re-use statements, you have add
> > prepareThreshold=n to the url where n is greater than 0. What this
> > means is that after n times of use the prepared statement will be
> > re-used..
>
> That's peculiar. The whole point of prepared statements is to obtain
> the optimization of statement reuse. If PostgreSQL is going to prevent
> that, I'd expect the prevention to be the exception rather than the
> rule. That is, programmers should reasonably expect that the default
> behavior is statement reuse.
Well, yes and no. Yes, the original intent of PreparedStatements was to
increase efficiency by reuse. But in practice, since there's no easy
way of specifying parameters programatically except by using the
PreparedStatement interface, most programs which construct one-time-only
SQL on the fly also use PreparedStatements.
There can be a significant benefit to NOT using generic prepared
statements in the one-shot (or few-shot) case; the planner can see real
parameter values instead of placeholders, and can thus make smarter plan
decisions.
-- Mark
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: mark.lewis@mir3.com, guyr@masergy.com
Subject: Re: Bind message
In-Reply-To: <1159212198.9657.1713.camel@archimedes>
References: <D4D1632DC736E74AB95FE78CD609007923B0F7@mtxexch01.add0.masergy.com> <1159212198.9657.1713.camel@archimedes>
* 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