in reply to SQLite and large number of parameters
If at all possible, why not use a subquery, like:
where something and something_else represent the query you used to get at that list.SELECT * FROM my_table WHERE col_1 IN (select id from something) AND col_2 IN (select id from something_else)
If it's not that simple, at worst you can first create temporary table with the values you're looking for in one column.
p.s. It's possible that using an inner join, even on a subselect, is faster. Just test it.
SELECT * FROM my_table INNER JOIN (select col_1 from something) A USING (col_1) INNER JOIN (select col_2 from something_else) B USING (col_2)
(n.b. "USING(col1,col2)" is like "ON A.col_1=B.col_1 AND A.col_2 = B.col_2" except the "*" will pick up the column name(s) only once.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: SQLite and large number of parameters
by menth0l (Monk) on Dec 10, 2012 at 13:07 UTC | |
by Jim (Curate) on Dec 10, 2012 at 19:26 UTC | |
by Anonymous Monk on Dec 10, 2012 at 16:40 UTC |