pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Antony Paul <antonypaul24@gmail.com>
Cc: Silvio Bierman <sbierman@jambo-software.com>
Cc: PostgreSQL JDBC <pgsql-jdbc@postgresql.org>
Subject: Re: FW: PreparedStatement#setString on non-string parameters
Date: Thu, 10 Mar 2005 02:23:42 +1300
Message-ID: <422EF8DE.7040405@opencloud.com> (raw)
In-Reply-To: <2989532e050309011430062873@mail.gmail.com>
References: <2989532e05030819582e7c8d0a@mail.gmail.com>
	<JGEOKLDJHLJNAPFIBKBNCEIMDCAA.sbierman@jambo-software.com>
	<2989532e050309011430062873@mail.gmail.com>

Antony Paul wrote:
> The performance difference I noticed when it is scanning a table of
> 150k records with a long query containing a lot of or conditions. The
> difference is around 10-12 seconds. So I think it is not the time
> taken to prepare the statement. I wasnt interested in further
> investigation as we dropped the plan of upgrading still 8.x becomes
> 9-12 months old.

There are some performance implications of pushing parameter management 
to the server side: under 7.4.x, a prepared statement does not gain the 
benefit of knowing the concrete parameter values used in a particular 
query execution, which can affect the plan chosen (if a concrete value 
for a parameter isn't known, the index selectivity estimates may not be 
as good).

In theory this should not be an issue if you set prepareThreshold=0 
(either globally on the connection, or via setPrepareTheshold on the 
statement in question) to prevent reuse of server statements, and use an 
8.0.x server. 8.0 defers the planning of unnamed (not reused) statements 
until actual parameter values are available, which may improve the plan 
chosen for that particular execution.

If it's not that, I'd need a testcase to be able to investigate this 
further.

-O



view thread (14+ messages)  latest in thread

Message-ID: <422EF8DE.7040405@opencloud.com>
Permalink:  ../422EF8DE.7040405@opencloud.com/
Also on:    postgresql.org/message-id/422EF8DE.7040405@opencloud.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: oliver@opencloud.com, antonypaul24@gmail.com, sbierman@jambo-software.com
  Subject: Re: FW: PreparedStatement#setString on non-string parameters
  In-Reply-To: <422EF8DE.7040405@opencloud.com>
  References: <2989532e05030819582e7c8d0a@mail.gmail.com> <JGEOKLDJHLJNAPFIBKBNCEIMDCAA.sbierman@jambo-software.com> <2989532e050309011430062873@mail.gmail.com> <422EF8DE.7040405@opencloud.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