On 3/13/2013 8:49 AM, James K. Lowden wrote:
I'm not sure about SQLite, but in principle the query optimizer can
often use the base table's index for a derived value. Consider
A join B on A.a = 1 + B.a
or
A join B on A.a < sqrt(B.a)
An index on B.a is useful to finding the values meeting the criterion.
You seem to expect the optimizer to solve equations - to effectively
rewrite the conditions as "B.a = A.a - 1" and "B.a >= 0 and B.a > (case
when A.a < 0 then 0 else A.a * A.a end)". I'm pretty sure no major DBMS
does that. Definitely SQLite doesn't.
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users