Re: PoC: Partial sort
От | Alexander Korotkov |
---|---|
Тема | Re: PoC: Partial sort |
Дата | |
Msg-id | CAPpHfds-Ssqcxjt_PHt30zJpmwGK3ozo00p-O-1n=67kX=bdNA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: PoC: Partial sort (Andreas Karlsson <andreas@proxel.se>) |
Ответы |
Re: PoC: Partial sort
Re: PoC: Partial sort Re: PoC: Partial sort |
Список | pgsql-hackers |
On Tue, Dec 31, 2013 at 5:41 AM, Andreas Karlsson <andreas@proxel.se> wrote:
------
With best regards,
Alexander Korotkov.
On 12/29/2013 08:24 AM, David Rowley wrote:It should be possible. I have hacked a quick proof of concept for reusing the tuplesort state. Can you try it and see if the performance regression is fixed by this?If it was possible to devise some way to reuse any
previous tuplesortstate perhaps just inventing a reset method which
clears out tuples, then we could see performance exceed the standard
seqscan -> sort. The code the way it is seems to lookup the sort
functions from the syscache for each group then allocate some sort
space, so quite a bit of time is also spent in palloc0() and pfree()
If it was not possible to do this then maybe adding a cost to the number
of sort groups would be better so that the optimization is skipped if
there are too many sort groups.
One thing which have to be fixed with my patch is that we probably want to close the tuplesort once we have returned the last tuple from ExecSort().
I have attached my patch and the incremental patch on Alexander's patch.
Thanks. It's included into attached version of patch. As wall as estimation improvements, more comments and regression tests fix.
With best regards,
Alexander Korotkov.
Вложения
В списке pgsql-hackers по дате отправления: