On 8/5/16, Detlef Golze <detlef.go...@point.de> wrote: > As documented, the query planner only uses the index if the SELECT contains > that exact same condition. > > According to .eqp with 3.12.1 the following statement indeed uses the index: > > SELECT Value1 FROM MyTable WHERE Value1<>0 AND Value1=7; > --EQP-- 0,0,0,SEARCH TABLE MyTable USING COVERING INDEX MyIndex1 (Value1=?) > > Can I safely assume that this 'workaround' works with all future versions?
Yes. In a future release of SQLite, the theorem prover inside the query planner that determines when it is acceptable to use a partial index might grow smarter, and realize that value1=7 implies value1<>0. At that point the extra value1<>0 term in the WHERE clause will become superfluous. But it will not cause problems. The partial index will continue to be used. -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users