On Wed, 13 Mar 2013 14:19:05 -0400 Igor Tandetnik <i...@tandetnik.org> 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. Thanks for clarifying that. As for major DBMSs, I dealt with Microsoft's for years, from Sybase days. Joins based on date functions and integer arithmetic observably uses indexes. Floating point I'm not sure of; I can't recall a table indexed on a floating point column. --jkl _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users