Re: DISCARD ALL ; stored procedures - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: DISCARD ALL ; stored procedures
Date
Msg-id 1294775548-sup-1582@alvh.no-ip.org
Whole thread Raw
In response to Re: DISCARD ALL ; stored procedures  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
Excerpts from Stephen Frost's message of vie ene 07 15:29:52 -0300 2011:
> * Stephen Frost (sfrost@snowman.net) wrote:
> > * Robert Haas (robertmhaas@gmail.com) wrote:
> > > > Making it part of DISCARD PLANS; and back-patching it to 8.3 where
> > > > DISCARD was introduced would be awesome for me. :)
> > > 
> > > I'd need to look at this more closely before committing anything, but
> > > at first blush I think that's reasonable.  Have a patch?
> > 
> > To be honest, I was fully expecting a response of "that's hard to do."
> 
> Soo, yeah, I found the "this is hard" part.  Basically, the plan
> cacheing, etc, is all handled by the stored procedures themselves, and
> we havn't got any way to tell a PL "destroy all your plans."  We might
> be able to hack up fmgr to throw away all references to functions, but
> that wouldn't release the memory they use up, making 'discard plans;'
> leak like a sieve.

What this discussion suggests to me is that cached plans need to be
tracked by a resource owner that's linked to the function.  The problem
I see with this idea is figure out what module would keep track of
resowners that need to be reset ...  Other than that I think it should
be straightforward :-)

-- 
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: Allowing multiple concurrent base backups
Next
From: Heikki Linnakangas
Date:
Subject: Re: Allowing multiple concurrent base backups