Re: Any way to *not* use server-side prepared statements in Postgresql?

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Yang Zhang <yanghatespam(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Any way to *not* use server-side prepared statements in Postgresql?
Date: 2011-07-19 03:40:00
Message-ID: CA+0W9LMZ1B1k0=NZcPsf7vi+jcL4QnO5sA4k3=Ca_vx63WCrdQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 19 July 2011 15:03, Yang Zhang <yanghatespam(at)gmail(dot)com> wrote:
> On Mon, Jul 18, 2011 at 7:50 PM, Oliver Jowett <oliver(at)opencloud(dot)com> wrote:

>> You can use the v2 protocol (which inserts parameter values as text,
>> rather than sending them out of line), but you will lose various other
>> bits of driver functionality that depend on the v3 protocol.
>
> Hmm...this sounded promising until I found that I'm using Python
> psycopg2.4. They wrap libpq and dropped v2 protocol support by
> psycopg2.3 (http://wiki.postgresql.org/images/7/77/Psycopg-2010-stuttgart.pdf),
> yet the statements that are being issued still appear as above. I'll
> still give the v2 protocol a shot, but something is inconsistent here.

Probably it is using the simple query protocol, not the extended query
protocol that the JDBC driver uses.

I would expect the simple protocol to perform essentially the same as
the extended protocol for an identical query string with no
driver-handled parameters.
If you're seeing differences, I suspect you're not actually doing what
you think you're doing. Perhaps you have driver-provided parameters?
There are some cases that tickle server-side query planning issues,
where using the unnamed statement with parameters doesn't result in
the same query plan as inserting the parameter values as text in the
query string yourself.

Oliver

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Yang Zhang 2011-07-19 03:47:26 Re: Any way to *not* use server-side prepared statements in Postgresql?
Previous Message Yang Zhang 2011-07-19 03:03:30 Re: Any way to *not* use server-side prepared statements in Postgresql?