> SQLite Version 3.2.2. > Is this a bug, or is my SQL that bad? > Query 1: > SELECT * FROM table1, table2 > WHERE (table1.value LIKE "%value%" AND table1.table2_id = table2.id); > This query works perfectly, can't fault it. > But when I do this, SQLite locks out (Command line interface, and PHP5) > Query 2: > SELECT * FROM table1, table2 > WHERE ((table1.value LIKE "%value%" AND table1.table2_id = table2.id); > OR (table1.value LIKE "%different_value%" AND table1.table2_id = > table2.id)); > This query (and even more complex versions of it) works in MySQL (Haven't > tried another DB yet) and I'm trying to migrate to SQLite, this is really > holding me back.
The like clause is going to force it to do a full table scan (it will have to read the whole database every time). If you can find a way around that it will help a lot. Is there an index on the id column(s)? That might help some too.