Re: Management of simple_eval_estate for plpgsql DO blocks

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Management of simple_eval_estate for plpgsql DO blocks
Date: 2015-08-16 09:50:22
Message-ID: CANP8+jLU8Ti0WSFTPCznp03A94zvuWrdQMLn+P_C+4UZm52mfg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14 August 2015 at 17:42, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> The simplest fix for this would be to give up on the idea that DO blocks
> use private simple_eval_estates, and make them use the shared one.
> However, that would result in intra-transaction memory bloat for
> transactions executing large numbers of DO blocks; see commit c7b849a89,
> which installed that arrangement to begin with. Since that change was
> based on a user complaint, this answer doesn't seem appetizing.
>

...

> Or we could change things so that DO blocks use private cast_hash
> hashtables along with their private simple_eval_estates. This would
> give up some efficiency (since a DO block would then always need to do
> its own cast lookups) but it would be a simple and reliable fix.
>
> I'm kind of inclined to go with the last choice, but I wonder if anyone
> wants to argue differently, or sees another feasible solution.
>

Not everyone uses large numbers of DO blocks, but casts apply everywhere,
right?

If the choice is efficiency or memory bloat, can't we choose a point where
we switch from one to the other? i.e. use private structures after N uses
of the shared structures.

--
Simon Riggs http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/>
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2015-08-16 13:48:48 Re: Test code is worth the space
Previous Message Noah Misch 2015-08-16 07:31:48 Re: Raising our compiler requirements for 9.6