Re: JDBC, prepared queries, and partitioning

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: josh(at)agliodbs(dot)com, Stephen Denne <Stephen(dot)Denne(at)datamail(dot)co(dot)nz>, Kris Jurka <books(at)ejurka(dot)com>, PostgreSQL - JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC, prepared queries, and partitioning
Date: 2008-02-14 07:13:23
Message-ID: 1202973203.16770.581.camel@ebony.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thu, 2008-02-14 at 12:23 +1300, Oliver Jowett wrote:
> Simon Riggs wrote:
>
> > What we need is a "send parameters inline" mode that can be set as an
> > option for a PreparedStatement. Nobody wants to use V2, we just want the
> > ability to re-plan a query every time. Perhaps that is best implemented
> > as a server side option that can be exposed via JDBC option, since this
> > is an SQL requirement and nothing to do with Java.
>
> Unfortunately you can't have your cake and eat it too. Many of the
> features specific to V3 *require* that parameters be sent out of line
> (e.g. parameter metadata, bytea streaming, possibly OUT parameters)
>
> As Kris said earlier in this thread what we really need is a way to tell
> the server "I will only ever use this statement once, with these
> particular parameter values, go ahead and optimize the plan on that basis"

But V3 supports having no parameters at all right?

All we have to do is create a new property called "reOptimize", whose
default value is false.

When reOptimize is true we
- use the code from V2 to fold parameters inline
- re-execute the protocol sequence for Parse/Bind/Execute just as if we
have never seen this SQL statement before (with the parameters inline,
we literally haven't)

We have the code already for this, so no complex coding required.

We can put in server side code for 8.4 to do this, as Tom suggests.

--
Simon Riggs
2ndQuadrant http://www.2ndQuadrant.com

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2008-02-14 07:18:19 Re: JDBC, prepared queries, and partitioning
Previous Message Oliver Jowett 2008-02-14 06:46:06 Re: JDBC, prepared queries, and partitioning