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

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -