SQLite Forum

index to help with selection and ordering
The job of the query planner is to choose the appropriate index.

For example, if you have a table of 1 billion rows, a where condition which selects 5 rows, and a choice of whether to use (a) an index for the WHERE clause then sort the result or (b) scan the index in the result order and only output matching rows, then clearly one should choose the former (a) because is is more efficient to quickly locate the 5 rows and then sort them than to scan all 1 billion rows in the right order then only output 5 of them.  

However, if the where clause selected all rows except for 5, then clearly the method chosen should be the latter as it is faster to output the rows in order after scanning them all, than it is to sort them.

However, there is a point at which it makes no difference which method is chosen.

So the question of how to do the unnecessary is of zero utility.