Re: Is tuplesort_heap_siftup() a misnomer?

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: Is tuplesort_heap_siftup() a misnomer?
Date: 2016-09-07 21:27:23
Message-ID: CAM3SWZSeRSDu4=8mhq8E5zMTDAUfAmW+tc6xsYO5p5cD7DwWnA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 12, 2016 at 4:30 PM, Peter Geoghegan <pg(at)heroku(dot)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 Content-Type Size
0001-Rename-tuplesort_heap_siftup-function.patch text/x-patch 4.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2016-09-07 21:31:39 Re: GiST penalty functions [PoC]
Previous Message Corey Huinker 2016-09-07 21:17:37 Re: \timing interval