Re: Automatic function replanning

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Lukas Smith <smith(at)pooteeweet(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Automatic function replanning
Date: 2005-12-22 21:11:28
Message-ID: 200512222111.jBMLBS828119@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Lukas Smith wrote:
> Bruce Momjian wrote:
>
> >> Maybe I am mixing up separate concepts (are bound variables and prepared
> >> statements different concepts?) here. I also do not really understand if
> >> that means that oracle does not store a query plan for a prepared query
> >> or if it just does some special handling in case it knows that a
> >> prepared statement column is known to have a highly varying selectivity
> >> per value.
> >
> > What the Oralce manual means I think is that the plan of the query is
> > delayed until the _first_ EXECUTE, so it has some values to use in the
> > optimizer. The problem is that later queries might use constants of
> > greatly different cardinality.
>
> ok .. which just goes to tell to not use prepared statements for a
> column with highly varying selectivity ..?
>
> or is there a realistic shot at fixing this use case?

It is an issue for all databases. We gave a TODO about it:

* Flush cached query plans when the dependent objects change,
when the cardinality of parameters changes dramatically, or
when new ANALYZE statistics are available

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lukas Smith 2005-12-22 21:14:15 Re: Automatic function replanning
Previous Message Jim C. Nasby 2005-12-22 21:10:54 Re: Automatic function replanning