c# - Improving EF Query Performance - checking if rows exist in a prefetched List<string> -
i have following (generalized) query:
var listofpossiblecars= new list<string>(); var listofcars = db.cars.where(s => listofpossiblecars.contains(s.carname)).tolist();
but listofpossiblecars
large contains hundreds of thousands of records. query causing delay , i'm wondering how can improved.
instead of doing in-memory collection insert data of listofpossiblecars
database temporary table defined indexes , partitions , have happen in database. defined tables database perform hash-join.
after data in database query like:
//instead data database car in db.cars join possiblecar in db.possiblecars on car.carname equals possiblecar.carname select car;
Comments
Post a Comment