79734362

Date: 2025-08-13 13:55:08
Score: 1
Natty:
Report link

Recognizing that this post is nine years old, I still feel compelled to answer since I don't think anyone answered the exact question, how do you compare the execution time of the two queries?

There are a bunch of ways, all free, all built in to SQL Server (2012 or greater for the majority, 2016 or greater for Query Store):

The last two actually include a whole slew of events that can capture query metrics, but these are all the ways to measure actual query performance. In this blog post, I compare all of them to attempt to assess their accuracy. Nightmare is, they're all a little different, but the principal exception is using "Include Client Statistics" It's just wildly inaccurate so I would not ever suggest using it.

For as much accuracy as possible, I will use Extended Events. I'll ensure that capturing the execution plan with runtime metrics (aka Actual Plan) is off (it negatively impacts performance measurement since it adds overhead). I execute each query 50 times (GO 50). I then use the Live Data Window in Extended Events to get an average of the execution times.

For other choices, and when to choose them, look to the blog post.

Reasons:
  • Blacklisted phrase (1): this blog
  • Blacklisted phrase (1): how do you
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • High reputation (-1):
Posted by: Grant Fritchey