Re: plan invalidation vs stored procedures

From: Hannu Krosing <hannu(at)krosing(dot)net>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Asko Oja <ascoja(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Martin Pihlak <martin(dot)pihlak(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plan invalidation vs stored procedures
Date: 2008-08-06 14:29:38
Message-ID: 1218032978.9188.29.camel@huvostro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2008-08-06 at 15:41 +0200, Pavel Stehule wrote:
> 2008/8/6 Hannu Krosing <hannu(at)krosing(dot)net>:
> > On Wed, 2008-08-06 at 12:13 +0200, Pavel Stehule wrote:
> >> 2008/8/6 Hannu Krosing <hannu(at)krosing(dot)net>:
> >> > On Tue, 2008-08-05 at 16:17 +0200, Pavel Stehule wrote:
> > ..
> >> >> you cannot change header of function. It's same as change C header of
> >> >> function without complete recompilation.
> >> >
> >> > SQL is not C.
> >> >
> >> > You don't have to recompile the whole SQL database when you add columns
> >> > to tables, so why should you need to do it, when you add a column to
> >> > table-returning function ?
> >> >
> >>
> >> I thing, it's possible - but it's neccessary completly new dictionary
> >> with dependencies (some dependencies are dynamic - polymorphic
> >> functions) so it's dificult task.
> >
> > I think that you can safely err on the side of caution, that is, save
> > more dependendcies than actually affected.
> >
>
> > Or you even add dependencies from inside the pl, either at compile/check
> > or run time (cached of course), so that you hit the exact right function
> > oid and can reuse the function lookup already done.
> >
> actually functions doesn't see into SQL statements - but I though is
> could be hook on new item in plan cache, so there can be some
> registration that try to analyze all called functions from plan and
> add some info to some buffer. There is lot of some. Some have to write
> it :)

Actually I think we need a callback in either execute or verify methods
so that various pl-s can implement adding the dependency.

or maybe not even a callback, pl implementation could just add needed
entries to pg_catalog.pg_shdepend when doing direct function calls. And
it should inspect prepared plans for a list of called functions. the
latter probably needs some help from planner, so that it would be easy
to get a list of function oids used by a plan.

------------------
Hannu

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2008-08-06 14:35:04 Re: Automatic Client Failover
Previous Message Tom Lane 2008-08-06 14:27:11 Re: Status of DISTINCT-by-hashing work