LINQ: The Good, The Bad, and The Poorly Optimized (Part 2)
Sep 20,
2017
Part 2: Controlling Parameter Optimization with Plan Guides For Part 1 of this series, see LINQ: The Good, The Bad, and The Poorly Optimized. T-SQL supports a variety of “hints”. They are hints in the same sense that your mother used to hint that it’s time to wash up and come to dinner. In other […]
LINQ: The Good, The Bad, and The Poorly Optimized (Part 1)
Sep 12,
2017
Part I: LINQ and sp_executesql Numerous questions raised in numerous forums mention that LINQ to SQL wraps queries in a call to the stored procedure sp_executesql. There seems to be agreement that this is done to ensure the caching of the query and query parameterization (if, indeed, parameters are supplied). Some advantages to sp_executesql, like […]
Precompiling LINQ Queries in .NET Framework 4.5
Nov 27,
2011
While it is possible to precompile LINQ queries for Entity Framework either to have your queries run faster (either without parameters or with parameters) or to run your queries on a background thread, in .NET Framework 3.5/4, it’s neither pretty nor fun. The code isn’t particularly ugly but it does require some additional effort for […]
Calling LINQ Queries in the Background
Nov 19,
2011
In my last two posts (here and here), I showed how you can pre-compile a LINQ query to improve your performance. As I noted in those posts, I wouldn’t expect a blinding improvement in response times—your application probably doesn’t have many really complex queries and, as a result, probably doesn’t spend a lot of time converting […]
PreCompiling LINQ Queries with Parameters
Nov 11,
2011
In my last post, I looked at precompiling a LINQ query to speed up (at least a little bit) your application. The LINQ statement I used as my example was very simple: Dim res = From o In en.Orders Select o This post looks at a more realistic example: a LINQ statement that has a Where clause. […]