Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataAdapter.Fill performance anomaly

I have two DataBases (DB1 & DB2 : both DBs are same, DB2 is created from the backup of DB1). When I run a stored procedure SP1 on both DBs it takes approximately 2 seconds to give me an output (select statements) on both DBs.

Now the problem is when I point these DBs from a service and try to use DataAdapter.Fill method, it gives me different time(54 - 63 seconds on DB1 and 42 - 44 seconds on DB2) on both DBs consistently. Noted that I'm using same service to point DBs so it couldn't be service behave/performance. Now my question is:

What could be the reason for this? Any suggestions are welcome that What should I look into?

Helping Info:

  1. Both DB are on different servers(identical configuration) but since executing the SP on SQL Server Management Studio take the same time on both DBs so I ruled out the possibility of DB server performance. Network delay could be a factor But higlly unlikely as both servers are on same network and infact on same physical location. This is my last option to check.

  2. Some other services are using SQLDependency ON DB1. Which consistently fill DataAdapter(s), could this be the reason for my DataAdapter fill method to slow down? (less likely as I'm guessing)

As requested in comments below is code that is filling the DataSet:

DataSet Fill

PS: The time mentioned above is the execution time of the code line highlighted in the above image.

like image 300
Kylo Ren Avatar asked May 16 '16 06:05

Kylo Ren


1 Answers

That sounds very much like a query plan issue.

Erland Sommerskog has written an excellent article about this kind of problems, Slow in the Application, Fast in SSMS?.

My first guess would be "The Default Settings", but it might be one of the other issues, too.

like image 129
TToni Avatar answered Oct 22 '22 12:10

TToni