How to look a single SQL Server query takes how much cpu time for completation
How to look a single SQL Server query takes how much cpu time for completion
when i run the query via sql server management studio i want to see how much cpu time did this query consumed
it will be pretty low but i need to see for comparing different query loads
and it would be even greater if it is possible to run query 1000 times and see total consumed time
thank you
ok this is the full answer
set statistics time on
execute your query
set statistics time off
and after this you have to look m开发者_StackOverflow社区essages window not results window
Before you run your query, execute this command in the same SSMS window.
set statistics time on
Note that in a multi-processor environment, the CPU time
reported may actually exceed the elapsed time
if any parallel processing occurs when executing the query.
If you open SqlServer Profiler you can see the resources consumed by a query. If you need to run the query a 1000 times just do it directly in SSMS with a loop:
Set @counter = 1
While @counter < 1000
Begin
--- Your query goes here
Set @counter = @counter + 1
End
精彩评论