On 9/17/18 2:19 AM, John Found wrote: > On Mon, 17 Sep 2018 06:02:37 +0000 > Hick Gunter <h...@scigames.at> wrote: > >> SQLite handles GROUP BY and ORDER BY in basically the same way. If there is >> an apropirate index, then it will use this index and the rows will be >> returned in visitation order of this index. If, for exmaple by adding a new >> index or even an upgrade of the Query Planner, a different execution plan is >> constructed, then the order of the returned rows will "change". > Yes, of course, but you forgot about INDEXED BY clause. It will force using > particular index. So, the query planner will always use exactly this index, > regardless of how optimal it is and > as long as GROUP BY and ORDER BY are working the same way, this gives some > guarantee for the ordering without ORDER BY clause. Or my logic is wrong?
I think the issue is that INDEXED BY forces the use of that index, but does NOT imply a final result order, that still requires the use of an ORDER BY clause. Please note the SQLite documentation for the INDEX BY clause description of the purpose of the INDEX BY clause, to detect unintended changes in Schema, not performance tuning, and is expected to be added at the very end of development (and by implication, will have no noticeable impact on the results). -- Richard Damon _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users