Re: To sort or not to sort

* Graham Moore
> 
> In cases where a server builds a fragments feed from several queries to an underlying system or to several underlying systems it is not always possible to execute a query that does the ordering for you. So, in the case of the 60,000 fragments the server will need to get these all in memory then sort them, or put them into temporary storage and then use that storage to pull things back in order.

Well, not necessarily. It's possible to execute each query in a separate connection and then do a merge sort, always stepping along the cursor that currently holds the most recent change.

It's not really a very pretty approach, and I'm guessing it will be prone to connections failing in some cases. But it would work, and it would not require prohibitive amounts of memory or CPU.

-- 
Lars Marius Garshol  |  Consultant
Bouvet ASA Sandakerveien 24C D11 Postboks 4430 Nydalen NO-0403 Oslo
Phone: +47 23 40 60 00 | Fax: +47 23 40 60 01 | Mobile: +47 98 21 55 50
http://www.bouvet.no

Received on Monday, 15 October 2012 12:54:09 UTC