Linq Performance about large table
Posted on 2008-10-24
Suppose i have a table MYTABLE with millions of records.
Suppose i use this code :
var result = from e in DC.MYTABLE
foreach( MYTABLE record in result )
In SQL server management studio, if i run the equivalent query, i will get a long long very long result set.
In LINQ, what am i supposed to understand when the foreach is executed ?
1/ All millions of records from MYTABLE are sent ONCE to my application and stored in memory ?
2/ OR at each FOREACH statement, only one record is sent at a time by SQL server to my application ?
What is the correct answer ?
(Because i cannot use the Take() linq statement, i must browse the recordset)