Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Query execution time in Milisecond

Author  Topic 

rahulpatel112
Starting Member

4 Posts

Posted - 2013-08-01 : 02:52:44
Hi

I have one problem statement to create sq. query. For the solution i have created three different queries, one using CTE expression and two using sub queries. When i execute all three queries in SSMS on local database, takes zero seconds to execute.

I want to check performance of each query and want to find exact execution time in milliseconds. How can i check it?Is there any other way to find best query among all?
<Edited>
One way is to assign getdate() in datetime varibale before start of query execution and after the query execution complete and find the difference between both of them.
</Edited>

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2013-08-01 : 03:08:27
SET STATISTICS TIME, IO ON

And look for the output in Results tab

SET STATISTICS TIME, IO OFF




Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-08-01 : 03:10:46
Another way is to use profiler traces. Use Statement Completed counter to get timings for each statements within the batch

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -