On Thu, 2008-03-20 at 22:35 +0000, Gregory Stark wrote:
> "Simon Riggs" <[EMAIL PROTECTED]> writes:
> 
> > If we assume we use heap sort, then if we *know* that the data is
> > presorted on (a) then we should be able to emit tuples directly that the
> > value of (a) changes and keep emitting them until the heap is empty,
> > since they will exit the heap in (a,b) order.
> 
> Actually, I would think the way to do this would be to do a quicksort if you
> find you've accumulated all the records in a subgroup in memory. One easy way
> to do it would be to have nodeSort build a new tuplesort for each subgroup if
> it has a level break key parameter set (memories of RPG III are coming
> bubbling to the surface).

Yes, its essentially the same thing as running a series of otherwise
unconnected sorts. However, that seems to introduce its own overheads if
we did that literally.

We needn't fix this to either a heapsort or a quicksort. We can let the
existing code decide which and let the mode change naturally from one to
the other as is needed.

-- 
  Simon Riggs
  2ndQuadrant  http://www.2ndQuadrant.com 

  PostgreSQL UK 2008 Conference: http://www.postgresql.org.uk


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

Reply via email to