Re: [HACKERS] Plan invalidation design

2007-02-21 Thread Andrew Hammond
On Feb 18, 9:35 am, [EMAIL PROTECTED] (Tom Lane) wrote: > Russell Smith <[EMAIL PROTECTED]> writes: > > > If you replan and immutable function, aren't you possibly messing up a > > functional index that is using the old function. Hey, if you change an > > immutable function that has an index, you

Re: [HACKERS] Plan invalidation design

2007-02-20 Thread Alvaro Herrera
Simon Riggs wrote: > On Sat, 2007-02-17 at 12:48 -0500, Tom Lane wrote: > > > Relcache inval casts a fairly wide net; for example, adding or dropping an > > index will invalidate all plans using the index's table whether or not > > they used that particular index, and I believe that VACUUM will al

Re: [HACKERS] Plan invalidation design

2007-02-19 Thread Simon Riggs
On Sat, 2007-02-17 at 12:48 -0500, Tom Lane wrote: > Relcache inval casts a fairly wide net; for example, adding or dropping an > index will invalidate all plans using the index's table whether or not > they used that particular index, and I believe that VACUUM will also > result in a relcache inv

Re: [HACKERS] Plan invalidation design

2007-02-18 Thread Russell Smith
Gregory Stark wrote: [snip] Hm. The set of output columns could change? How? If you prepare "select *" and add a column, you're saying the query should start failing? That seems strange given the behaviour of views, which is that once parsed the list of columns is written in stone. It seems

Re: [HACKERS] Plan invalidation design

2007-02-18 Thread Merlin Moncure
On 2/19/07, Tom Lane <[EMAIL PROTECTED]> wrote: Gregory Stark <[EMAIL PROTECTED]> writes: > If you prepare "select *" and add a column, you're saying the query should > start failing? Either fail or change output; which you like better? The whole point of this exercise is to support plpgsql fun

Re: [HACKERS] Plan invalidation design

2007-02-18 Thread Tom Lane
Gregory Stark <[EMAIL PROTECTED]> writes: > If you prepare "select *" and add a column, you're saying the query should > start failing? Either fail or change output; which you like better? The whole point of this exercise is to support plpgsql functions that do something like create temp

Re: [HACKERS] Plan invalidation design

2007-02-18 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > Russell Smith <[EMAIL PROTECTED]> writes: >> Tom Lane wrote: >>> 2. Given a handle for a previously stored query, check to see if the plan >>> is still up to date; if not, regenerate it from the raw parse tree (note >>> this could result in failure, eg if a

Re: [HACKERS] Plan invalidation design

2007-02-18 Thread Tom Lane
Russell Smith <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> 2. Given a handle for a previously stored query, check to see if the plan >> is still up to date; if not, regenerate it from the raw parse tree (note >> this could result in failure, eg if a column used by the query has been >> dropped)

Re: [HACKERS] Plan invalidation design

2007-02-18 Thread Russell Smith
Tom Lane wrote: I'm starting to think about the long-wanted plan invalidation mechanism. Here's a sketch --- anyone see any problems? * Create a new module, say src/backend/utils/cache/plancache.c, that we will put in charge of all long-lived plans --- or at least those cached by PREPARE, plpgsq

Re: [HACKERS] Plan invalidation design

2007-02-18 Thread Lukas Kahwe Smith
Tom Lane wrote: place. But the question to answer is why the re-plan won't yield just the same plan as before. oh and when the estimated cost repeatedly do not match the actual cost, we of course want to generate an email with all relevant information that is send to this list ;) regards,

Re: [HACKERS] Plan invalidation design

2007-02-18 Thread Lukas Kahwe Smith
Tom Lane wrote: Lukas Kahwe Smith <[EMAIL PROTECTED]> writes: I remember that there was discussion about invalidating plans who's estimated cost turn out to be severely off when executed. That's something we might think about after the infrastructure is in place. But the question to answer is

Re: [HACKERS] Plan invalidation design

2007-02-17 Thread Tom Lane
Lukas Kahwe Smith <[EMAIL PROTECTED]> writes: > I remember that there was discussion about invalidating plans who's > estimated cost turn out to be severely off when executed. That's something we might think about after the infrastructure is in place. But the question to answer is why the re-pla

Re: [HACKERS] Plan invalidation design

2007-02-17 Thread Lukas Kahwe Smith
Tom Lane wrote: Relcache inval casts a fairly wide net; for example, adding or dropping an index will invalidate all plans using the index's table whether or not they used that particular index, and I believe that VACUUM will also result in a relcache inval due to updating the table's pg_class r

[HACKERS] Plan invalidation design

2007-02-17 Thread Tom Lane
I'm starting to think about the long-wanted plan invalidation mechanism. Here's a sketch --- anyone see any problems? * Create a new module, say src/backend/utils/cache/plancache.c, that we will put in charge of all long-lived plans --- or at least those cached by PREPARE, plpgsql, and RI triggers