Re: Minor performance improvement in transition to external sort
Вложения
В списке pgsql-hackers по дате отправления:
| От | Jeremy Harris |
|---|---|
| Тема | Re: Minor performance improvement in transition to external sort |
| Дата | |
| Msg-id | 52F35462.3030306@wizmail.org обсуждение исходный текст |
| Ответ на | Re: Minor performance improvement in transition to external sort (Robert Haas <robertmhaas@gmail.com>) |
| Ответы |
Re: Minor performance improvement in transition to external sort
|
| Список | pgsql-hackers |
On 05/02/14 21:56, Robert Haas wrote: > On Tue, Feb 4, 2014 at 5:22 PM, Jeremy Harris <jgh@wizmail.org> wrote: >> The attached patch replaces the existing siftup method for heapify with >> a siftdown method. Tested with random integers it does 18% fewer >> compares and takes 10% less time for the heapify, over the work_mem >> range 1024 to 1048576. >> >> Both algorithms appear to be O(n) (contradicting Wikipedia's claim >> that a siftup heapify is O(n log n)). > > I think Wikipedia is right. Inserting an a tuple into a heap is O(lg > n); doing that n times is therefore O(n lg n). Your patch likewise > implements an outer loop which runs O(n) times and an inner loop which > runs at most O(lg n) times, so a naive analysis of that algorithm also > comes out to O(n lg n). The patch implements a siftdown. Measurements attached. -- Cheers, Jeremy
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера