Since you did not specify an ORDER BY clause, SQLite is free to return rows in *any* order. The order may even change if the underlying schema changes and SQLite finds a better way to compute the results.
A "covering index" is one that contains all the fields required from a certain table to fulfill the request. Retrieving fields from the covering index avoids having to access the complete row from the table and is thus very much faster (no second disk access, no unpacking of the retrieved row). -----Ursprüngliche Nachricht----- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Bart Smissaert Gesendet: Donnerstag, 12. Jänner 2017 01:40 An: General Discussion of SQLite Database <sqlite-users@mailinglists.sqlite.org> Betreff: [sqlite] Why this query plan? Say I have a table created like this: create table table1( [id] integer primary key, [dob] integer) with an index (not unique) on dob and I run this SQL: select id, dob from table1 then the query plan I get is: SCAN TABLE TABLE1 USING COVERING INDEX IDX_TABLE1_DOB The result is that the output is descending on DOB. I expected and preferred if the output was ascending on rowid. What is the idea/logic of this query plan? Using SQLite 3.16.2 RBS _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___________________________________________ Gunter Hick Software Engineer Scientific Games International GmbH FN 157284 a, HG Wien Klitschgasse 2-4, A-1130 Vienna, Austria Tel: +43 1 80100 0 E-Mail: h...@scigames.at This communication (including any attachments) is intended for the use of the intended recipient(s) only and may contain information that is confidential, privileged or legally protected. Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender by return e-mail message and delete all copies of the original communication. Thank you for your cooperation. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users