Accepted answer

"linq" includes linq to objects, linq to sql, etc. you can certainly query in memory, but maybe you should wait until you've done a performance analysis before optimizing. you may optimize the wrong thing.


ad hoc, loading up to 250 megabytes of data into client memory seems not to be such an good idea. if you have it memory, you can use linq to object and save the database roundtrips.

the problem is that your data is hierarchical and you have to fetch one row, examin it, and retrieve the releated rows and this causes so many roundtrips.

you could use lazy loading to retrieve more and more rows into client memory during the runtime of your program and perform more and more queries in memory when the working set stabilizes. but this will only help if rows are accessed multiple times and not only once or twice.

another solution might be to create recursive views or stored procedure using common table expression that retrieve releate rows up to some distance from a given row.

Related Query