Re: DO with a large amount of statements get stuck with high memory consumption - Mailing list pgsql-hackers

From Tom Lane
Subject Re: DO with a large amount of statements get stuck with high memory consumption
Date
Msg-id 22342.1468852097@sss.pgh.pa.us
Whole thread Raw
In response to Re: DO with a large amount of statements get stuck with high memory consumption  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-hackers
Merlin Moncure <mmoncure@gmail.com> writes:
> Hm, maybe, instead of trying to figure out if in a loop, set a
> 'called' flag  with each statement and only cache when touched the
> second time.  (If that's easier, dunno).

Well, then you just guarantee to lose once.  I think Jan's sketch of
marking potentially-cacheable expressions at compile time sounds
promising.  I'm envisioning a counter that starts at 1 normally or 0 in a
DO block, increment at beginning of parsing a loop construct, decrement at
end; then mark expressions/statements as cacheable if counter>0.

Of course the next question is what exactly to do differently for a
noncacheable expression.  My recollection is that that's all tied
pretty tightly to the plancache these days, so it might take a little
work.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: DO with a large amount of statements get stuck with high memory consumption
Next
From: Tom Lane
Date:
Subject: Re: rethinking dense_alloc (HashJoin) as a memory context