Re: PoC: Partial sort

Поиск
Список
Период
Сортировка
От Alexander Korotkov
Тема Re: PoC: Partial sort
Дата
Msg-id CAPpHfduz+oA8ioSvh87bmFYbVF=x4==_E3u6wfn-gK1zwx9+_A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PoC: Partial sort  (Andreas Karlsson <andreas@proxel.se>)
Ответы Re: PoC: Partial sort
Список pgsql-hackers
On Sat, Dec 14, 2013 at 11:47 PM, Andreas Karlsson <andreas@proxel.se> wrote:
On 12/14/2013 10:59 AM, Alexander Korotkov wrote:
This patch allows to use index for order-by if order-by clause and index
has non-empty common prefix. So, index gives right ordering for first n
order-by columns. In order to provide right order for rest m columns,
sort node is inserted. This sort node sorts groups of tuples where
values of first n order-by columns are equal.

I recently looked at the same problem. I see that you solved the rescanning problem by simply forcing the sort to be redone on ExecReScanSort if you have done a partial sort.

Naturally, I'm sure I solved it at all :) I just get version of patch working for very limited use-cases.
 
My idea for a solution was to modify tuplesort to allow storing the already sorted keys in either memtuples or the sort result file, but setting a field so it does not sort thee already sorted tuples again. This would allow the rescan to work as it used to, but I am unsure how clean or ugly this code would be. Was this something you considered?

I'm not sure. I believe that best answer depends on particular parameter: how much memory we've for sort, how expensive is underlying node and how it performs rescan, how big are groups in partial sort.

------
With best regards,
Alexander Korotkov.

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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: [PATCH] SQL assertions prototype
Следующее
От: Robert Haas
Дата:
Сообщение: Re: commit fest 2013-11 final report