October 22, 2018 at 9:41 am
I've been doing some timings on running stored procedures using VS and MS Server Mgmnt Studio.
I run my sp through SSMS first from my PC to the SQL Server will run in about 7 seconds, no problems.
When I then run the same sp through VS using a windows form, a dataset and a sqlclient cmd and attach to a datagridivew the results takes 25 second to come back?
Is this normal? i.e. nearly 4 times as long ?
Kind regards
October 22, 2018 at 12:20 pm
Nope. Not normal. So...
How are the measures being done? I'd suggest doing the measures on the server using extended events (or, if this is really 2008, trace events). This way you get a consistent measure, regardless of where the call is coming from. Start there. If you still see that the same procedure called from SSMS or from your app has a four times difference in execution time, as measured on the server, then, we need to capture the execution plans. This will tell us how the query is being resolved by the optimizer. It's possible that due to things like differences in ANSI settings on the connection, recompiles, or something else, that you're getting different plans from the app and SSMS. If, on the other hand, the performance measured on the server is the same, the issue is much more likely to be in the code in Visual Studio and not the code in SQL Server.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply