Re: Tuplestore should remember the memory context it's created in - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Tuplestore should remember the memory context it's created in
Date
Msg-id 407d949e0912220416q78857a17n6eb990b2f175e6c2@mail.gmail.com
Whole thread Raw
In response to Tuplestore should remember the memory context it's created in  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Tuplestore should remember the memory context it's created in  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, Dec 22, 2009 at 11:45 AM, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
...
> AFAICS it is always a bug to be in a different memory context
> in tuplestore_put* than in tuplestore_begin_heap(), so it would be more
> robust to not put the burden on the callers.
> ...
> Patch against CVS HEAD to do that and fix the reported bug attached. Now
> that the tuplestore_put* switches to the right memory context, we could
> remove that from all the callers, but this patch only does it for pl_exec.c.
>
> Thoughts?

I thought there were comments specifically explaining why it was done
that way but I don't recall what they said. Perhaps it was a
performance concern since it's going to happen for every tuple put in
the tuplestore and usually you'll just be in the same memory context
anyways. It would certainly be a lot less confusing the way you
describe though.

-- 
greg


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Streaming replication and non-blocking I/O
Next
From: Greg Stark
Date:
Subject: Re: Tuplestore should remember the memory context it's created in