Thanks for the reply Richard. I don’t suppose it matters to me that it may 
change from one day to the next or one connection to another as long as I can 
determine the order it will be returned in milliseconds before the first 
sqlite3_step.





________________________________
From: sqlite-users <[email protected]> on behalf of 
Richard Hipp <[email protected]>
Sent: Saturday, March 24, 2018 5:38:53 PM
To: SQLite mailing list
Subject: Re: [sqlite] Determine sort order of query

On 3/24/18, x <[email protected]> wrote:
> Suppose you’re given an sql select statement that doesn’t contain an order
> by clause. Is there any way of accurately determining the order it will be
> sorted in.

No.  The database engine is free to return the rows in whatever order
it thinks will be most efficient.  This can change from one run to the
next, such that you can run the same query twice and get the rows in a
different order each time.  SQLite will normally return rows in the
same order unless there is an intervening ANALYZE command, but on
other SQL database engines a row order shift can happen at any time.
You can expect to sometimes see rows  in different orders if you run
the same query on two different versions of SQLite.

--
D. Richard Hipp
[email protected]
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to