Re: PoC: Partial sort

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PoC: Partial sort
Date: 2013-12-19 01:12:40
Message-ID: 52B24808.6090704@proxel.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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
> considered?
>
>
> 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2013-12-19 01:12:45 Re: pg_rewarm status
Previous Message Bruce Momjian 2013-12-19 00:01:14 Re: New option for pg_basebackup, to specify a different directory for pg_xlog