SQLite Forum

'no query solution' error
Login
This is documented.  You will have to look in the documentation to find that documentation but it is documented, and it is also straightforward pure English.

You are being told that the query as you have phrased DOES NOT have a solution where the index you have requested to be used is used.  (Note that this is an entirely different thing from saying that "no solution can be generated using your artificial constraint:).

Take for example the first query:

`select a from t indexed by ndx;`

The query is **select a from t;**.  When all the myriad of possible ways to solve this query is computed there is *no solution* in which **ndx** is used.  Hence you get the error message to that effect.  Now then if the query were **select a from t order by b;**  then there would indeed be a solution that used **ndx** to avoid a sort and your query would use that solution **even if it were not the optimal solution**.  Similarly **select a from t not indexed order by b** would force the choice of the table scan and sort rather than the use of the index.  However, in order to *prefer a particular solution* that solution must be one of the available solutions to the question stated.

To be more clear:  **indexed by** does *NOT* mean to go out and generate a solution to the query using the specified index, it means that where there is a choice between solutions to a query, one or more of which use the requested index, then prefer those solutions over solution that do no use that index.