On 22 Dec 2011, at 4:35am, Virparia, Chetan J (GE Energy) wrote:

> Query : Select * from mytable where <columnName> in ( around 0.2 million
> comma separated values)

Anything that requires handling .2 million things is going to be tricky.  
Optimizing this query would be done differently depending on what governs these 
values: whether they're the same each time, or completely different each time, 
or you have a few different sets of values.

Under some circumstances you could define a table, put the values into it, and 
use a JOIN as part of your SELECT.  You could even then define a VIEW and index 
the view. This would make the query extremely fast.

Under other circumstances you would just define a very long string that had all 
those values in it (possibly separated by commas), then search this string 
using LIKE.

It really depends on what you're trying to do.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to