Re: Is tuplesort_heap_siftup() a misnomer? - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Is tuplesort_heap_siftup() a misnomer?
Date
Msg-id CAM3SWZSeRSDu4=8mhq8E5zMTDAUfAmW+tc6xsYO5p5cD7DwWnA@mail.gmail.com
Whole thread Raw
In response to Is tuplesort_heap_siftup() a misnomer?  (Peter Geoghegan <pg@heroku.com>)
Responses Re: Is tuplesort_heap_siftup() a misnomer?
List pgsql-hackers
On Fri, Aug 12, 2016 at 4:30 PM, Peter Geoghegan <pg@heroku.com> wrote:
> Doesn't tuplesort_heap_siftup() actually shift-down?
>
> The Wikipedia article on heaps [1] lists "shift-down" (never "sift
> down", FWIW) as a common operation on a heap:
>
> "shift-down: move a node down in the tree, similar to shift-up; used
> to restore heap condition after deletion or replacement."
>
> This seems to be what tuplesort_heap_siftup() actually does (among
> other things; its job is to compact the heap following caller
> returning the root, where caller leaves a "hole" at the root position
> 0).

Heikki (CC'd) and I discussed this privately today, and we were in
agreement that this needs to be fixed, so I wrote a patch, which I
attach here.


--
Peter Geoghegan

Attachment

pgsql-hackers by date:

Previous
From: Corey Huinker
Date:
Subject: Re: \timing interval
Next
From: Heikki Linnakangas
Date:
Subject: Re: GiST penalty functions [PoC]