Sqlite does not support the use of indexes in queries based around a NOT IN clause.
Is it possible to logically rewrite a query like the following in such a way that it will only use the operators listed at the link above?
The query:
Select *
From table
Where table-column not in (
Select table-column
From table2);
The operators listed as being able to use an index:
Use a LEFT JOIN as described in section 6.
SQLFiddle with sample data here. Expand View Execution Plan to confirm that the original query does a table scan, while the LEFT JOIN query uses the index.
Select A.*
From table a
left join table2 b
on a.table-column = b.table-column
WHERE b.table-column is null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With