Re: pgsql: Fix plpgsql to release SPI plans when a function or DO block is

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Fix plpgsql to release SPI plans when a function or DO block is
Date: 2011-03-28 07:25:06
Message-ID: 4D9037D2.2020105@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 27.03.2011 19:51, Tom Lane wrote:
> Fix plpgsql to release SPI plans when a function or DO block is freed.
>
> This fixes the gripe I made a few months ago about DO blocks getting
> slower with repeated use. At least, it fixes it for the case where
> the DO block isn't aborted by an error. We could try running
> plpgsql_free_function_memory() even during error exit, but that seems
> a bit scary since it makes a lot of presumptions about the data
> structures being in good shape. It's probably reasonable to assume
> that repeated failures of DO blocks isn't a performance-critical case.

I was quite surprised by the way you did this. Instead of adding all
that code to traverse the PLpgSQL_stmt tree (that we'll have to remember
to keep up-to-date), can't we just have a list of cached plans in
PLpgSQL_function? As attached.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Attachment Content-Type Size
plpgsql-release-cached-plans.patch text/x-diff 4.3 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Jan Urbański 2011-03-28 10:21:25 Re: Re: [COMMITTERS] pgsql: Fix plpgsql to release SPI plans when a function or DO block is
Previous Message Tom Lane 2011-03-28 02:31:41 Re: Re: [COMMITTERS] pgsql: Fix plpgsql to release SPI plans when a function or DO block is

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-03-28 07:35:09 Re: ExecEvalVar does not have appropriate ExprState?
Previous Message Vaibhav Kaushal 2011-03-28 07:02:15 ExecEvalVar does not have appropriate ExprState?