On Thu, Dec 13, 2012 at 10:06 AM, Selen Schabenberger <selen_oz...@yahoo.com
> wrote:

> Hi All,
>
> I am observing some strange behaviour on my database when I execute a
> query with an IN operator having more than "22" expressions. My table
> structure looks basically as follows:
>
> CREATE TABLE "Messages" ("Id" INTEGER PRIMARY KEY NOT NULL, "Tag" INTEGER
> NOT NULL, "Flag" INTEGER )
>
>
> I have a multi-column index on  (Tag, Flag, Id) as well as a single column
> index on the Flag column.
>

My guess is that the single-column index on Flag is misleading the query
optimizer.  You can probably fix this by either (1) running ANALYZE or (2)
adding a "+" in front of the "Flag" column name in the WHERE clause of your
query, like this:   "... +Flag=1 ..."

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to