简体   繁体   中英

SQL faster in ssms than in application

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?

Welcome to SO

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM