On 2/11/2013 6:51 AM, Simon Slavin wrote:

On 11 Feb 2013, at 3:45am, Igor Tandetnik <[email protected]> wrote:

On 2/10/2013 10:06 PM, Mohit Sindhwani wrote:

* You decide then to do a sort by ROWID ASC - expecting that ROWID is
maintaining the sequence since when you do a general SELECT * from
mytable; you often get it in insertion sequence (if I'm not wrong).

You are wrong. Normally, with a simple SELECT like this, you get the results 
ordered by ROWID. SQLite table is stored as a b-tree, with ROWID as its key, so 
that's the natural order of traversal.

You're both wrong.  Because someone may have done "PRAGMA reverse_unordered_selects 
= YES"

That's why I said "normally". Yes, there are certain unusual circumstances where the claim is not true.

As I'm sure you know, the SQL standard makes no assurances about any part of 
SELECT row order you don't specify.  Not only that, but even if you do two 
identical SELECT statements in a row, you may get the rows in a different 
order.  I only ever found one setup which did this (one where the database was 
distributed over different computers, and the order returned depended on which 
host was free at the time), but I wanted to flag it up as a possibility.

Again, my statement is about what you would normally expect from SQLite in particular, not what may generally happen in some hypothetical SQL implementation.
--
Igor Tandetnik

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

Reply via email to