Tips to Improve LINQ to SQL Performance
LINQ to SQL is a powerful technology that can do as much harm as good if it is mis-used. Here is how to get more out of your LINQ to SQL efforts. Tip 1: Ditch the Extra Baggage with ObjectTrackingEnabled LINQ to SQL, by default, behaves like it's going on a every possibility. It carries every provision it thinks it'll ever need, and your application carries that extra weight. If you know you're only going for a short hike, why not tell it to leave the pack at home? That's where the ObjectTrackingEnabled property of the DataContext comes in. By default this property is true , which causes LINQ to SQL to keep track of every change you make to your data in case you want to save those changes later. If you know you're only reading data and won't be changing it, I suggest setting this property to false. Then all of that change-tracking overhead goes away. The performance boost does come at a small price, however. Deferred loading will no longer work. You'll have