Re: JDBC, prepared queries, and partitioning

From: Kris Jurka <books(at)ejurka(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: PostgreSQL - JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC, prepared queries, and partitioning
Date: 2008-02-13 18:51:24
Message-ID: Pine.BSO.4.64.0802131348050.27322@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Wed, 13 Feb 2008, Josh Berkus wrote:

> Since JDBC always prepares and plan-caches queries, it makes it hard to use
> partitioning with a database connected to a JDBC connection pool; successive
> queries in the same session will select the wrong partition, or scan the
> whole partition set.
>

It will never scan the wrong partition. It will always scan all
partitions. The server is smart enough to not generate a plan that is not
valid for only one parameter set.

Using protocol version 2 will not prepare queries so constraint exclusion
can be used. Just append protocolVersion=2 to your URL.

Kris Jurka

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2008-02-13 19:18:54 Re: JDBC, prepared queries, and partitioning
Previous Message Josh Berkus 2008-02-13 18:05:30 JDBC, prepared queries, and partitioning