On 13/11/2011 3:45 a.m., Igor Tandetnik wrote:
Josh Gibbs<jgi...@imailds.com>  wrote:
To reiterate from my original question, if we don't add the order by then
the results come back at a very acceptable speed.  But of course we'd
then have to iterate through the results ourselves to siphon off the
top item set that we're after.  I'd really like the DB to do that for me.
Doing that in your application code is likely your best bet. It is possible to 
select top M out of N elements (when M is much smaller than N) much faster than 
sorting all N elements and then taking first M in order. But SQLite doesn't 
implement any such algorithm - it only knows how to sort the whole set.

Any chance of TOP being added to sqlite? If I could get the results I'm after unsorted then I can deal with the sorting later. Bringing the whole list out of the session to scan through is an overhead that's going to be even slower with the language I'm using to access this data (a CGI interface from web).


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to