Click here to Skip to main content
15,907,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to Test performance of Query in Sql server 2008
Posted
Comments
[no name] 18-Jul-12 8:28am    
By profiling it.
shriti 3 18-Jul-12 8:47am    
Thanx
shriti 3 18-Jul-12 8:48am    
Thanx

If you want to view the time consumed by the query you can view it using the properties window after each query is executed.

You can also use SQL Profiler for the same.

Enabling the "Include Actual Execution Plan" will give you the reason for the time taken to execute the query and if the solution is known to the SSMS then it will also tell you what can be done to improve the performance of the query
 
Share this answer
 
You can use Profiler to se how many reads, how much cpu etc.
MSDN: How To use SQL Profiler[^]

If you just want to measure speed you can use this technique:

SQL
DECLARE @start DateTime
DECLARE @end DateTime
SET @start = getDate()

-- Do your stuff

SET @end = getDate()
SELECT DATEDIFF(ms, @start, @end) -- Will show how many milliseconds your query used.


Another good tip is to turn on the execution plan:
SQL
SET SHOWPLAN_ALL ON
GO

That will give you a lot of interesting data about performance

Remember to turn it off after you are done:
SQL
SET SHOWPLAN_ALL OFF
GO

You can read more about what all those columns and numbers mean at MSDN: http://msdn.microsoft.com/en-us/library/aa259203(v=sql.80).aspx[^]
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900