LINQ to SQL execution time is 50x longer than SSMS SQL
问题 I have an asp.net app that uses Linq to SQL. One query from the app was timing out (over 30 seconds to execute). I increased the CommandTimeout of the DataContext, and it did complete in 45 seconds. I copied the Linq to SQL generated SQL from SQL Profiler to SSMS and executed it using the same user credentials as I am using in my app, and I got a sub-second execution time. I am using a new DataContext to execute the query, so the query is running in its own transaction. My connection string