Re: Replacement Selection - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Replacement Selection
Date
Msg-id 24867.1196101861@sss.pgh.pa.us
Whole thread Raw
In response to Re: Replacement Selection  (<mac_man2005@hotmail.it>)
Responses Re: Replacement Selection  (<mac_man2005@hotmail.it>)
Re: Replacement Selection  (<mac_man2005@hotmail.it>)
Re: Replacement Selection  (<mac_man2005@hotmail.it>)
Re: Replacement Selection  (<mac_man2005@hotmail.it>)
List pgsql-hackers
<mac_man2005@hotmail.it> writes:
> 3) Start run generation. As for this phase, I see PostgreSQL code (as Knuth 
> algorithm) marks elements belonging to runs in otder to know which run they 
> belong to and to know when the current heap has finished building the 
> current run. I don't memorize this kind of info. I just output from heap to 
> run all of the elements going into the current run. The elements supposed to 
> go into the next run (I call them "dead records") are still stored into main 
> memory, but as leaves of the heap. This implies reducing the heap size and 
> so heapifying a smaller number of elements each time I get a dead record 
> (it's not necessary to sort dead records). When the heap size is zero a new 
> run is created heapifying all the dead records currently present into main 
> memory.

Why would this be an improvement over Knuth?  AFAICS you can't generate
longer runs this way, and it's not saving any time --- in fact it's
costing time, because re-heapifying adds a lot of new comparisons.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Chris Browne
Date:
Subject: Re: proposal, plpgsql, 8.4, for record in cursor
Next
From:
Date:
Subject: Re: Replacement Selection