ck3g
ck3g

Reputation: 5929

How can I measure linq queries execution time?

I've got newsletter site developed using ASP.NET MVC 2 and I use LINQ to access data from database. Unfortunately site perfomance is in a terrible state. Loading time of the pages is too slow. And now I want to determine weak areas of the Web-Application. First of all I want to measure execution time of my LINQ queries and optize it.

Are there any tools or techniques to do that? Or what steps should I take to detect problem queries and compare execution time before and after optimisation?

Upd: ASP.NET MVC 2 and .NET 3.5

Upvotes: 1

Views: 2141

Answers (2)

J.W.
J.W.

Reputation: 18181

The first thing I would try is to start sql profiler and watch the sql statement sent to the SQL server. LINQ sometimes generate inefficient SQL.

Upvotes: 0

BrokenGlass
BrokenGlass

Reputation: 160882

You could start with Stackoverflow's own MVC Mini Profiler. It supports database profiling as well with Linq to SQL and Linq to Entities.

Once you get down to problems in the generated SQL queries there is always SQL Server Profiler or paid products like Entity Framework Profiler.

Upvotes: 5

Related Questions