Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It is situational in most cases and also depends on the size of the data.<br> Also first and foremost, always check what your teams current coding standards and patterns are. If standards in your company say use SPROCS always, than adhere to those standards.</p> <p><strong>Lots of Records (SPROC)</strong><br> If the expected data in the tables could possibly be a few hundred thousand records each it might be complete overhead to have a million records in total for 8 tables returned only to retrieve a small subset of data with LINQ.</p> <p>LINQ will keep the records it currently iterates through in memory until the expected result set is build. This will most likely end up with all the million records in memory + the records for the result set in memory. </p> <p>Also note that Visual Studio has a limit of 2GB memory (regardless of how much RAM you got) than it falls on it's face (during debug mode on a 32bit system, not sure about 64bit). I did in the past have issues with querying large data sets with LINQ whereby I run into out of memory exceptions.</p> <p>A SPROC maybe faster and safer in that case.</p> <p><strong>Few Records (LINQ)</strong><br> If on the other hand the data in each of the 8 tables will always be rather small not changing much in the future, than using LINQ will make little difference. However, do test if multiple table joins might be slower in LINQ than in a SPROC.</p> <p><strong>Edit (Compare/Analyse Execution Plans)</strong><br> Also note that the SQL produced for joins using LINQ is very efficient in .NET 4.0 in most cases, not sure about .NET 3/3.5 but using SQL profiler you can see the generate SQL and run it in SQL comparing it to a SPROC execution plan.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload