| From: | Andy Fan <zhihuifan1213(at)163(dot)com> |
|---|---|
| To: | Andres Freund <andres(at)anarazel(dot)de> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Rowley <dgrowleyml(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Make printtup a bit faster |
| Date: | 2026-05-07 12:40:40 |
| Message-ID: | 87cxz78kaf.fsf@163.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Andres Freund <andres(at)anarazel(dot)de> writes:
> Hi,
>
>> From Andres:
>>
>> > FWIW, I've experimented fixing this overhead before, and what I did was to
>> > pass an optional context via the fcinfo, and output / send functions could use
>> > memory allocated via that optional context object, rather than doing it
>> > allocating in CurrentMemoryContext. For the send functions that looks
>> > reasonably clean, given that it already deals with a stringinfo. For out
>> > functions it's a bit uglier, but still somewhat acceptable.
>>
>> Puting optional context via the fcinfo looks novel to me (I have zero
>> experience to use fcinfo utility.).
>
> We do that in a bunch of places, e.g. for the context of window functions
> (c.f. PG_WINDOW_OBJECT() WindowObjectIsValid()).
>
>
>> Then I'm not sure how to use the optional context, Will it be a
>> MemoryContext or a StringInfo? If MemoryContext, then how to avoid the
>> memory copy in the printtup sistuation or this method has different target.
>
> I think it'd have to be something that includes the stringinfo.
>
>
> Here's a very rough prototype for how it could look like. This clearly needs
> more helpers that I introduced, but I thought this should be enough to show
> the idea.
Yes, so optional context is really elegant. Thanks for sharing!
> A closely related precedent is the introduction of "soft error
> reporting" for input functions. See d9f7f5d32 and follow-ons.
Thanks for this example as well!
--
Best Regards
Andy Fan
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Henson Choi | 2026-05-07 12:41:46 | Re: Row pattern recognition |
| Previous Message | David G. Johnston | 2026-05-07 12:40:39 | Re: Postgresql 18 Linux (all flavors) - with installation, create new instance/main database |