Re: [PATCH] Use optimized single-datum tuplesort in ExecSort

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: [PATCH] Use optimized single-datum tuplesort in ExecSort
Дата
Msg-id CAApHDvoERpbbL=jPqYSpG5r3py5jm8aFYiJhnyQNCbgzz-gS5A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Use optimized single-datum tuplesort in ExecSort  (Ronan Dunklau <ronan.dunklau@aiven.io>)
Список pgsql-hackers
On Fri, 16 Jul 2021 at 02:53, Ronan Dunklau <ronan.dunklau@aiven.io> wrote:
>
> Le jeudi 15 juillet 2021, 16:19:23 CEST David Rowley a écrit :>
> > Ronan's latest results plus John's make me think there's no need to
> > separate out the node function as I did in v8.  However, I do think v6
> > could learn a little from v8. I think I'd rather see the sort method
> > determined in ExecInitSort() rather than ExecSort(). I think
> > minimising those few extra instructions in ExecSort() might help the
> > L1 instruction cache.
> >
>
> I'm not sure I understand what you expect from moving that to ExecInitSort ?

The motivation was to reduce the extra code that's being added to
ExecSort. I checked the assembly of ExecSort on v6 and v9 and v6 was
544 lines of assembly and v9 is 534 lines.

> Maybe we should also implement the tuplesort_state initialization in
> ExecInitSort ? (not the actual feeding and sorting of course).

I don't think that would be a good idea.  Setting the datumSort does
not require any new memory to be allocated. That's not the case for
the tuplesort_begin routines.  The difference here is that we can
delay the memory allocation until we pull the first tuple and if we
don't pull any tuples from the outer node then there are no needless
allocations.

> Please find attached a v9 just moving the flag setting to ExecInitSort, and my
> apologies if I misunderstood your point.

That's exactly what I meant. Thanks

David



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

Предыдущее
От: Justin Pryzby
Дата:
Сообщение: Re: [PATCH] psql: \dn+ to show size of each schema (and \dA+ for AMs)
Следующее
От: Peter Smith
Дата:
Сообщение: Re: row filtering for logical replication