Re: Memory usage during sorting - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Memory usage during sorting
Date
Msg-id 26643.1332259957@sss.pgh.pa.us
Whole thread Raw
In response to Re: Memory usage during sorting  (Greg Stark <stark@mit.edu>)
Responses Re: Memory usage during sorting  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Greg Stark <stark@mit.edu> writes:
> http://en.wikipedia.org/wiki/Binary_heap#Building_a_heap

Interesting.  I'm pretty sure that idea appears nowhere in Knuth
(which might mean it's new enough to have a live patent on it ...
anybody know who invented this?).  But it seems like that should buy
back enough comparisons to justify leaving the next-run tuples out of
the heap (unordered) until the heap becomes empty.  You still want to
insert new tuples into the heap if they can go to the current run, of
course.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Regarding column reordering project for GSoc 2012
Next
From: Robert Haas
Date:
Subject: Re: Memory usage during sorting