Re: Management of simple_eval_estate for plpgsql DO blocks - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Management of simple_eval_estate for plpgsql DO blocks
Date
Msg-id CANP8+jLU8Ti0WSFTPCznp03A94zvuWrdQMLn+P_C+4UZm52mfg@mail.gmail.com
Whole thread Raw
In response to Management of simple_eval_estate for plpgsql DO blocks  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 14 August 2015 at 17:42, Tom Lane <tgl@sss.pgh.pa.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/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: Raising our compiler requirements for 9.6
Next
From: Greg Stark
Date:
Subject: Re: Test code is worth the space