On 13 Dec 2012, at 3:06pm, Selen Schabenberger <selen_oz...@yahoo.com> wrote:
>> explain query plan Select Messages.Id from Messages where (Tag in ( 1146883, >> 1146884, 1146886, 1146888, 1146892, 1146894, 1146896, 1146898, 1146920, >> 1146922, 1147912, 1147914, 1147968, 1147970, 1147976, 1147978, 1148012, >> 1148015, 1148016, 1148018, 1148020, 1148022, 1148040, 1148042, 1148079, >> 1148136, 1148138, 1148191, 1148232, 1148234, 1167643, 1167659, 1167660, >> 1167663, 1167667, 1167671, 1167675 ) and Flag=1) order by Messages.Id limit >> 0, 100 Just out of interest, that form where you go ... WHERE (Tag in (a,b,c) AND Flag=1) ... Can you try a version where it uses instead ... WHERE Tag in (a,b,c) AND Flag=1 ... or ... WHERE (Tag in (a,b,c)) AND (Flag=1) ... I'm trying to predict how the parsing works here but I don't know whether I figured it out. Another thing to try is to reverse the order of your index > I have a multi-column index on (Tag, Flag, Id) as well as a single column > index on the Flag column. Can you add a new one, or change your existing one, to (Flag, Tag, Id) ? > Are there any restrictions with the IN operator? Nothing that you got anywhere close to. It's meant to be able to handle text and lists far longer than that. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users