pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabi@logix-tt.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Bind message
Date: Tue, 26 Sep 2006 14:00:45 +0200
Message-ID: <4519166D.9040705@logix-tt.com> (raw)
In-Reply-To: <4518FF16.3050804@opencloud.com>
References: <D4D1632DC736E74AB95FE78CD609007923B0F7@mtxexch01.add0.masergy.com>
	<Pine.BSO.4.63.0609251417310.4350@leary2.csoft.net>
	<451846B0.6070906@logix-tt.com>
	<45184D61.3010007@opencloud.com>
	<4518E986.3030801@logix-tt.com>
	<4518FF16.3050804@opencloud.com>

Hi, Oliver,

Oliver Jowett wrote:

>> Ah. But usually, the other parameter values for the same prepared
>> statement produce similar query plans, because they're the same use case
>> on similar data.
> 
> For the "wrong" values though the plan might be pathologically bad.

Yes, I know, and that's why I'd like to retain the possibilitiy of
preparing a new statement with a different first parameter set for
different use cases, and introduce the option of switching back to the
current behaviour.

>> Maybe this behaviour should be configurable via some session
>> configuration variable?
> 
> Isn't this just a very roundabout way of overriding the planner? i.e.
> what you are really doing is saying "ignore your statistics, I know more
> about the parameter values I'm going to give you than I'm actually
> telling you"..

No, it's telling the planner "You can assume that all those queries for
my statement are similar enough that the same query plan will fit them,
so you can safe the overhead of both parsing and planning".

Don't forget that, in the current implementation, the query planner has
no choice but planning the query without any actual parameter values,
which is likely to give equal or worse results in most cases.

The use case I have in mind are geometric data lookup of mostly static
data (PostGIS objects) that are nicely distributed, and the queries all
fetch a small bounding box hitting a fraction of at most 1/1000th, more
likely 1/1000000 of the data. For them, the GIST index scan is the best
query plan.


Another option would be that the planner uses some self-learning
algorithm that analyzes the parameter sets for a given prepared
statement, and sees whether it's better to replan always, keep the same
plan, or even efficiently switch between a small set of fixed plans. But
that's out of scope for now, I'm afraid.

Thanks,
Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in Europe! www.ffii.org
www.nosoftwarepatents.org



view thread (18+ messages)  latest in thread

Message-ID: <4519166D.9040705@logix-tt.com>
Permalink:  ../4519166D.9040705@logix-tt.com/
Also on:    postgresql.org/message-id/4519166D.9040705@logix-tt.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: schabi@logix-tt.com
  Subject: Re: Bind message
  In-Reply-To: <4519166D.9040705@logix-tt.com>
  References: <D4D1632DC736E74AB95FE78CD609007923B0F7@mtxexch01.add0.masergy.com> <Pine.BSO.4.63.0609251417310.4350@leary2.csoft.net> <451846B0.6070906@logix-tt.com> <45184D61.3010007@opencloud.com> <4518E986.3030801@logix-tt.com> <4518FF16.3050804@opencloud.com> <4519166D.9040705@logix-tt.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