Login or Sign Up to become a member!

EXPERTS, INFORMATION, IDEAS & KNOWLEDGE

Social bookmarker Add this

Your profile

Search

November 2008
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

XML Feeds

Tags: linq

The Data Management Journal

LINQ to SQL queries involving strings cause SQL Server procedure cache bloat

by SQLDenis


Permalink 28 Aug 2008 10:12 , Categories: Data Modelling & Design Tags: bug, linq, performance

Adam Machanic created an item on connect explaining how LINQ to SQL queries involving strings cause SQL Server procedure cache bloat

If an application is using LINQ to SQL and the queries involve the use of strings that can be highly variable in length, the SQL Server procedure cache will become bloated with one version of the query for every possible string length. For example, consider the following very simple queries created against the Person.AddressTypes table in the AdventureWorks2008 database:

  1. var p =
  2.                 from n in x.AddressTypes
  3.                 where n.Name == "Billing"
  4.                 select n;
  5.  
  6.             var p =
  7.                 from n in x.AddressTypes
  8.                 where n.Name == "Main Office"
  9.                 select n;

If both of these queries are run, we will see two entries in the SQL Server procedure cache: One bound with an NVARCHAR(7), and the other with an NVARCHAR(11). Now imagine if there were hundreds or thousands of different input strings, all with different lengths. The procedure cache would become unnecessarily filled with all sorts of different plans for the exact same query. Even worse, imagine if a query used two or three different string parameters. The procedure cache could end up with hundreds of thousands or even millions of entries, the only differences being the variable lengths

Wow that is bad indeed, please go to the connect site and vote for this so that Microsoft ‘fixes’ this. Here is the URL: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=363290

4 comments »Send a trackback » 1160 views

.NET Framework 3.5 SP1: LINQ perf improvements (LINQ to Objects and LINQ to SQL)

by SQLDenis


Permalink 12 Aug 2008 06:56 , Categories: Data Modelling & Design Tags: linq, performance

Dinesh wrote a blogpost about .NET Framework 3.5 SP1: LINQ perf improvements (LINQ to Objects and LINQ to SQL). There are three perf improvements in the just released SP1

Specialized enumerable: The new implementation recognizes queries that apply Where and/or Select to arrays or List<T>s and fold pipelines of multiple enumerable objects into single specialized enumerables. This produces substantial improvement in base overhead of common LINQ to Objects queries (at times 30+%).

Make sure to check it out!

Leave a comment »Send a trackback » 528 views

SQL Server 2008 geography data type screencasts on Channel 9

by SQLDenis


Permalink 19 Jul 2008 14:38 , Categories: Data Modelling & Design Tags: linq, screencast, sql server 2008, wcf

Channel 9 has two screencast that deal with the new geography data type in SQL Server 2008.

Saving Virtual Earth Polygons to SQL Server 2008

Marc Schweigert shows you how to draw a polygon on a Virtual Earth map and save it using ASP.NET AJAX, Windows Communication Foundation (WCF), LINQ to SQL, and the new geography data type in SQL Server 2008.

Rendering Polygons from SQL Server 2008 on Virtual Earth

Marc Schweigert builds off of the concepts shown in his previous screencast and shows you how to render a polygon on a Virtual Earth map using REST, Windows Communication Foundation (WCF), LINQ to SQL, and the new geography data type in SQL Server 2008.

Enjoy the shows, and to learn more about the GeoRSS utility library, visit:
http://blogs.msdn.com/eugeniop/archive/2008/07/01/simple-georss-utility-library-released.aspx

Leave a comment »Send a trackback » 616 views