Re: Is a clearer memory lifespan for outerTuple and innerTuple useful?

From: Andy Fan <zhihuifan1213(at)163(dot)com>
To: Nikita Malakhov <hukutoc(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Is a clearer memory lifespan for outerTuple and innerTuple useful?
Date: 2023-12-17 23:22:31
Message-ID: 8734w0xuyc.fsf@163.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Nikita Malakhov <hukutoc(at)gmail(dot)com> writes:

> Hi!
>
> Maybe, the alternative way is using a separate kind of context, say name it
> 'ToastContext' for all custom data related to Toasted values? What do
> you think?

That should be a candidate. The latest research makes me think the
'detoast_values' should have the same life cycles as tts_values, so the
memory should be managed by TupleTuleSlot (rather than ExprContext) and
be handled in ExecCopySlot / ExecClearSlot stuff.

In TupleTableSlot we already have a tts_mctx MemoryContext, reusing it
needs using 'pfree' to free the detoast values and but a dedicated
memory context pays more costs on the setup, but a more efficient
MemoryContextReset.

>
> On Sun, Dec 17, 2023 at 4:52 PM Andy Fan <zhihuifan1213(at)163(dot)com> wrote:
>
> Andy Fan <zhihuifan1213(at)163(dot)com> writes:
>
> > Andy Fan <zhihuifan1213(at)163(dot)com> writes:
> >
> >> ..., I attached the 2 MemoryContext in
> >> JoinState rather than MergeJoinState, which is for the "shared detoast
> >> value"[0] more or less.
> >>
>
> In order to delimit the scope of this discussion, I attached the 2
> MemoryContext to MergeJoinState. Since the code was writen by Tom at
> 2005, so add Tom to the cc-list.
>

However this patch can be discussed seperately.

--
Best Regards
Andy Fan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2023-12-17 23:30:10 Re: JSON Path and GIN Questions
Previous Message Tom Lane 2023-12-17 22:33:45 Re: planner chooses incremental but not the best one