Re: Make printtup a bit faster

Поиск
Список
Период
Сортировка
От Andy Fan
Тема Re: Make printtup a bit faster
Дата
Msg-id 87cxz78kaf.fsf@163.com
обсуждение
Ответ на Make printtup a bit faster  (Andy Fan <zhihuifan1213@163.com>)
Список pgsql-hackers
Andres Freund <andres@anarazel.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




В списке pgsql-hackers по дате отправления: