Hilmar Berger <hilmar.ber...@integromics.com> wrote: > I used EXPLAIN QUERY PLAN on the query and it looks like it does not use > any index on b at all, only if I use hardcoded conditions like b > 0. > > It appears that the real problem is that SQlite does not use indices for > both tables
For your problem, there's no way to use indices on both tables. An index is only helpful if it allows one to look at only some, but not all, rows in the table. In your query, one has to look at all records in A and find suitable matching records in B, or else look at all records in B and find matching records in A. You have to look at all records in at least one table, there's no way around that. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users