On 12/18/2013 01:02 PM, Alexander Korotkov wrote:
    My idea for a solution was to modify tuplesort to allow storing the
    already sorted keys in either memtuples or the sort result file, but
    setting a field so it does not sort thee already sorted tuples
    again. This would allow the rescan to work as it used to, but I am
    unsure how clean or ugly this code would be. Was this something you

I'm not sure. I believe that best answer depends on particular
parameter: how much memory we've for sort, how expensive is underlying
node and how it performs rescan, how big are groups in partial sort.

Yes, if one does not need a rescan your solution will use less memory and about the same amount of CPU (if the tuplesort does not spill to disk). While if we keep all the already sorted tuples in the tuplesort rescans will be cheap but more memory will be used with an increased chance of spilling to disk.

Andreas Karlsson

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to