Here I have a query like below:
SELECT field
FROM table
WHERE value IN ('val1', 'val2', 'val3', ... 'valn')
Let’s say there are 2000 values inside the IN clause, the value doesn’t exist in other table. Do you have any idea to speed up this operation?
The question is open to accept any kind of methods..
Thanks!
This looks like the right way in Java: http://knol.google.com/k/oracle-passing-a-list-as-bind-variable#
It is similar to the C# solution. Your list of value stays in memory (no temporary table) and it will not be persisted to disk and you use a parameterized query so the query executer doesn’t have to reparse every query. I have no tried it with java but I think that it will be fast.