Re: Tuplestore should remember the memory context it's created in

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tuplestore should remember the memory context it's created in
Date: 2009-12-22 16:31:03
Message-ID: 18808.1261499463@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
> Tom Lane wrote:
>> I think it was just a performance optimization. It's probably not
>> measurable though; even in the in-memory case there's at least a palloc
>> inside the put() function, no?

> Yes. And many of the callers do the memory context switching dance anyway.

Yeah, I was just noticing that. We should go around and clean those up
if we apply this change.

Looking at the CVS history, I think the reason tuplestore doesn't do its
own memory context switch is that it was cloned from tuplesort, which
didn't either at the time. But several years ago we changed tuplesort
to be safer about this (it actually keeps its own memory context now),
so it's just inconsistent that tuplestore still exposes the risk.

The ownership business is another story though. tuplesort doesn't
make any attempt to defend itself against resource-owner changes. If we
need this for tuplestore I bet we need it for tuplesort too; but do we?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2009-12-22 16:40:24 Re: alpha3 release schedule?
Previous Message Simon Riggs 2009-12-22 16:25:37 Re: alpha3 release schedule?