I’m searching for a bunch of int32’s in a SQL (Compact edition) database using LINQ2SQL.
My main problem is that I have a large list (thousands) of int32 and I want all records in the DB where id field in DB matches any of my int32’s. Currently I’m selecting one row at the time, effectively searching the index thousands of times.
How can I optimize this? Temp table?
Insert your ints in a SQL table then do :
Edit 1 & 2: Changed the answer so he joins 2 tables, no collections.