I will say that it is much better to allow SQL to execute a complex filter and the rest of the processing, but why you may ask.
The main reason is that SQL Server has the specified index information and uses this index for quick access to data . If you upload them to Linq, you do not have this index information for quick access to the data, and you lose time for their access. You also lose time compiling linq every time.
You can do a simple test to see it differently. Which test? Create a simple table with a hundred random row and index this field with a row. Then search the string field using linq, and one of them sets sql.
Update
My first thought was that SQL stores the index and makes very quick access to the search database in your SQL.
Then I think that linq can also translate this filter to sql and then get the data, then you perform your action, etc.
Now I think that the actual reason depends on what actions you do. Running SQL is faster , but the reason for this depends on how you actually install your linq.
If you try to load everything in memory and then use linq, you lose speed from the SQL index and lose memory and lose a lot of actions to move your data from sql to memory.
If you get data using linq, and then another search is not required, you lose all this data in memory when moving and lose memory.
source share