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

From Tom Lane
Subject Re: Is tuplesort_heap_siftup() a misnomer?
Date
Msg-id 747.1473284546@sss.pgh.pa.us
Whole thread Raw
In response to Re: Is tuplesort_heap_siftup() a misnomer?  (Peter Geoghegan <pg@heroku.com>)
Responses Re: Is tuplesort_heap_siftup() a misnomer?  (Peter Geoghegan <pg@heroku.com>)
List pgsql-hackers
Peter Geoghegan <pg@heroku.com> writes:
> On Fri, Aug 12, 2016 at 4:30 PM, Peter Geoghegan <pg@heroku.com> wrote:
>> Doesn't tuplesort_heap_siftup() actually shift-down?

The reason it's called siftup is that that's what Knuth calls it.
See Algorithm 5.2.3H (Heapsort), pp 146-147 in the first edition of
Volume 3; tuplesort_heap_siftup corresponds directly to steps H3-H8.

> 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.

I think this patch is misguided, as it unnecessarily moves the code
away from standard nomenclature.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Gavin Flower
Date:
Subject: Re: Long options for pg_ctl waiting
Next
From: Jim Nasby
Date:
Subject: Re: (Comment)Bug in CteScanNext