pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guillaume Smet <guillaume.smet@gmail.com>
To: Guillaume Cottenceau <gc@mnc.ch>
Cc: Mario Splivalo <mario.splivalo@megafon.hr>
Cc: pgsql-performance@postgresql.org
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [PERFORM] Query much slower when run from postgres function
Date: Mon, 9 Mar 2009 18:04:23 +0100
Message-ID: <1d4e0c10903091004m758d7ea2s91e33631be81215a@mail.gmail.com> (raw)
In-Reply-To: <87fxhmmygj.fsf@meuh.mnc.lan>
References: <49B51B60.6030600@megafon.hr>
	<27649.1236616294@sss.pgh.pa.us>
	<87fxhmmygj.fsf@meuh.mnc.lan>

On Mon, Mar 9, 2009 at 5:51 PM, Guillaume Cottenceau <gc@mnc.ch> wrote:
> Until it's possible to specifically tell the JDBC driver (and/or
> PG?) to not plan once for all runs (or is there something better
> to think of?), or the whole thing would be more clever (off the
> top of my head, PG could try to replan with the first actual
> values - or first xx actual values - and if the plan is
> different, then flag that prepared statement for replanning each
> time if the overall time estimate is different enough), I've
> opted to tell the JDBC driver to use the protocol version 2, as
> prepared statements were not so much prepared back then (IIRC
> parameter interpolation is performed in driver and the whole SQL
> query is passed each time, parsed, and planned) using
> protocolVersion=2 in the JDBC URL. So far it worked very well for
> us.

Unnamed prepared statements are planned after binding the values,
starting with 8.3, or more precisely starting with 8.3.2 as early 8.3
versions were partially broken on this behalf.

It's not always possible to use protocol version 2 as it's quite
limited (especially considering the exceptions returned).

-- 
Guillaume



view thread (26+ messages)  latest in thread

Message-ID: <1d4e0c10903091004m758d7ea2s91e33631be81215a@mail.gmail.com>
Permalink:  ../1d4e0c10903091004m758d7ea2s91e33631be81215a@mail.gmail.com/
Also on:    postgresql.org/message-id/1d4e0c10903091004m758d7ea2s91e33631be81215a@mail.gmail.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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: guillaume.smet@gmail.com, gc@mnc.ch, mario.splivalo@megafon.hr, pgsql-jdbc@postgresql.org
  Subject: Re: [PERFORM] Query much slower when run from postgres function
  In-Reply-To: <1d4e0c10903091004m758d7ea2s91e33631be81215a@mail.gmail.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