On May 30, 2008, at 6:45 AM, Jens Miltner wrote:

> I'm suspecting that there is nothing that guarantees the order in
> which results are returned unless I explicitely specify an "ORDER BY"
> term,

Correct.

SQLite (and all other SQL database engines) are free to return results  
in whatever order it thinks it can get them most efficiently as long  
as there is no ORDER BY clause.  We frequently revise algorithms in  
order to increase performance.  You should never depend on the output  
order unless you have an explicit ORDER BY clause.

Note that adding an ORDER BY clause does not necessarily force SQLite  
to sort.  Often, an ORDER BY clause will merely constrain the choice  
of algorithms to one that naturally returns the results in the order  
you request.  In most cases, if a query is already returning results  
in the order you want, adding an ORDER BY will not slow it down.  The  
ORDER BY will simply prevent some future version of SQLite from using  
some newer algorithm that returns results in a different order.

D. Richard Hipp
[EMAIL PROTECTED]



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to