开发者

Performance discrepancy in SQL Server Profiler between web query and the same query ran in SSMS

I have a query that takes ~20x as long for SQL server to execute when it comes from a web request, as it does from when the exact same query is ran via SQL Server Management Studio

The following screenshot is from the SQL Server Profiler. The first two records relate to the receipt and execution of query that's come in via the web request, whilst the third record is the exact same query run from SSMS. Why would there be a such a huge difference between the two?

A point: The query is开发者_C百科 generated from LINQ. I took a copy of the generated SQL and ran it in SSMS to get these results.

Performance discrepancy in SQL Server Profiler between web query and the same query ran in SSMS


ARITHABORT is ON by default in SSMS and OFF by default for a SqlClient connection.

See if this solves your issue:

new SqlCommand("SET ARITHABORT ON", connection).ExecuteNonQuery();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜