Re: DISCARD ALL ; stored procedures

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DISCARD ALL ; stored procedures
Date: 2011-01-11 19:55:28
Message-ID: 1294775548-sup-1582@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Stephen Frost's message of vie ene 07 15:29:52 -0300 2011:
> * Stephen Frost (sfrost(at)snowman(dot)net) wrote:
> > * Robert Haas (robertmhaas(at)gmail(dot)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(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-01-11 20:02:07 Re: Allowing multiple concurrent base backups
Previous Message Dimitri Fontaine 2011-01-11 19:50:40 Re: Allowing multiple concurrent base backups