dbTalk Databases Forums  

Query Execution Time

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss Query Execution Time in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Cordell Lawrence
 
Posts: n/a

Default Query Execution Time - 08-08-2007 , 08:12 PM






Guys, this may seem like a really silly question but please bear with me.

Context:
We are attempting to run several tests on various SQL Server databases. We are in the process of developing a test plan to determine what we test and how we go about testing it.

We've written some C# code to perform several queries on the database. We took one of the code tests and essentially reproduced it in the form of a SQL script (in an attempt to determine if it was better to write our tests as C# code or TSQL Scripts). Strangely enough the execution time of the C# code is tremendously faster than the TSQL script run from Management Studio. Mind you, all we're doing in the script is executing a SPROC in a loop (same as the code). What would be the cause of this difference? Would it be the fact that results are displayed in the Management Studio results windw in real-time? or should I simply just profile the database and see whats happening in both cases?

Any thoughts/ideas would be appreciated.

Reply With Quote
  #2  
Old   
Tibor Karaszi
 
Posts: n/a

Default Re: Query Execution Time - 08-09-2007 , 02:34 AM






I'd start with comparing execution plans. If they differ, you know at least one place to look
further.

Also, yes, there is overhead with displaying the result in SSMS. I suggest you try the option "no
output" (or something like that, check under Tools, Options in SSMS for the setting).

If both above doesn't give anything, you probably want to use Profiler and see if there is some
significant events produced in one but not the other environment.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi


"Cordell Lawrence" <cordell_lawrence (AT) hotmail (DOT) com> wrote

Guys, this may seem like a really silly question but please bear with me.

Context:
We are attempting to run several tests on various SQL Server databases. We are in the process of
developing a test plan to determine what we test and how we go about testing it.

We've written some C# code to perform several queries on the database. We took one of the code tests
and essentially reproduced it in the form of a SQL script (in an attempt to determine if it was
better to write our tests as C# code or TSQL Scripts). Strangely enough the execution time of the C#
code is tremendously faster than the TSQL script run from Management Studio. Mind you, all we're
doing in the script is executing a SPROC in a loop (same as the code). What would be the cause of
this difference? Would it be the fact that results are displayed in the Management Studio results
windw in real-time? or should I simply just profile the database and see whats happening in both
cases?

Any thoughts/ideas would be appreciated.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.