简体   繁体   中英

why is DataAdapter.Fill() slower with SQL-Server-2014 than with SQL-Server-2000

I am in the process of replacing a legacy web application written in ASP.NET 1.0. My plan is to rebuild a new GUI using MVC5 on top of the existing database schema. As part of the process, I migrated the entire database from SQL-Server 2000 to SQL-Server 2014 and pointed the same web instance at the new DB server.

Although queries on the new server run much faster, the DB upgrade has caused our website to slow way down. I traced the slowness to a "DataAdapter.Fill()" call. When connecting to SQL-Server 2014, the call from the web app takes about 10 seconds instead of 3 seconds with the old DB Server (~3 times slower). The underlying sproc is very fast so that's not the bottleneck.

The new DB server is located on the same network, so latency should not an issue. The Web server can ping both the old and the DB Servers in less than 10 ms.

Any idea why the DB upgrade would cause such a dramatic slowdown?

Ok, problem solved. The slowness was not in loading the DataAdapter, but in the mundane call to the DB. When calling the DB from ADO.NET it has ARITHABORT turned off by default even though SSMS has it turned ON by default. It was tough to catch because even when I tried disabling the default ARITHABORT setting in SSMS by calling “SET ARITHABORT OFF“, it had no effect (not sure why).

I solved the issue by adding “SET ARITHABORT ON“ to the beginning of the sproc that was running slowly when called by my app. It's possible to turn this feature on for the entire DB, but there are some risks associated with doing that .

Also I found this very helpful.

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