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.
| Author |
Topic |
|
coolerbob
Aged Yak Warrior
841 Posts |
Posted - 2005-03-31 : 07:32:31
|
| I want to compare the performance of different queries.Is there a way I can use SQL to get the time a query took to process?How would you do this if you wanted to return how long a SP took in a OUTPUT parameter? |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2005-03-31 : 07:34:24
|
| Run your query in query analyzerprint getdate()exec yourqueryprint getdate()You can loop that lots of times to get average, etc.-------Moo. :) |
 |
|
|
coolerbob
Aged Yak Warrior
841 Posts |
Posted - 2005-03-31 : 08:00:45
|
| So simple!Genious! |
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2005-03-31 : 13:35:45
|
| SET STATISTICS TIME ONrockmoose |
 |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2005-03-31 : 15:40:32
|
| Be aware that simply running two queries which acess the same data can yield misleading results:print getdate()exec query1print getdate()exec query2print getdate()The first query will tend to load the necessary data into cache which makes the second query run quicker (since the data is already in cache).You may want to look at flushing the data and/or procedure cache as a prelude to each query run.HTH=================================================================In order to improve the mind, we ought less to learn than to contemplate.-Rene Descartes, philosopher and mathematician (1596-1650) |
 |
|
|
|
|
|