StackOrder
StackOrder

Reputation: 270

Speeding up LINQ to SQL queries

What are the common things that we can keep in mind while writing the LINQ to SQL query for optimizing or speeding up the LINQ to SQL?.

For example, ordinarily, LINQ to SQL must translate LINQ queries to SQL every time a query executes; this involves recursing the expression tree that makes up the query in several stages. What we do is like precompiling the query using the CompiledQuery class.

Upvotes: 5

Views: 5493

Answers (2)

p.chang
p.chang

Reputation: 23

usually the native LINQ2SQL compiler lets you forget about the whole optimizing queries trouble, however there are some caveats regarding mostly with compiled queries abuse. Here are some resources you should check about it. :)

http://visualstudiomagazine.com/articles/2010/06/24/five-tips-linq-to-sql.aspx http://weblogs.asp.net/dixin/archive/2011/01/31/understanding-linq-to-sql-11-performance.aspx

Upvotes: 1

Mare Infinitus
Mare Infinitus

Reputation: 8162

There is one helpful thing about LINQ that every developer should know. It is about performance of Join vs Where.

The full discussion can be seen here why is join so much faster than where

Upvotes: 5

Related Questions