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:
Both DB are on different
servers(identical configuration) but since executing theSPonSQL Server Management Studiotake the same time on bothDBsso I ruled out the possibility ofDBserverperformance. Network delay could be a factor But higlly unlikely as bothserversare on same network and infact on same physical location. This is my last option to check.Some other services are using
SQLDependencyONDB1. Which consistently fillDataAdapter(s), could this be the reason for myDataAdapterfillmethod to slow down? (less likely as I'm guessing)
As requested in comments below is code that is filling the DataSet:

PS: The time mentioned above is the execution time of the code line highlighted in the above image.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With