SQL faster in ssms than in application

允我心安 提交于 2019-12-23 04:51:10

问题


One ERP system execute SQL statements very slowly. I get into activity profiler in SQL Server Management Studio and I saw that one SQL command takes 25 seconds. I run the same SQL command in Management Studio, and it takes only 3-4 seconds to get results (it's a normal select with where clause, without joins and other).

What can this be caused by?


回答1:


Welcome to S.O.

I came across this issue quite recently myself. We found the cause was down to database settings in SSMS, being different to the sending APP. In SSMS right click on the database, select Proprties, and the Options. This gives you a list of the settings that SSMS is using.

In particular we found differences in ANSI NULLS and Arith Abort. Debug your app and check what settings are being sent through to the server, you may well find a difference.

Settings like these can have major effects on how the server executes the query.



来源:https://stackoverflow.com/questions/53526087/sql-faster-in-ssms-than-in-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!