I would like to benchmark a SQL query within SQL Server. What is the best approach to accomplish this in the most accurate way?
My idea was as follows -->
- record start-time
- execute query
- record end-time
- perform a date diff between start-time and the end-time and output to milliseconds or microseconds.
dbcc dropcleanbuffersbefore you run your query