Sometimes I want to compare the performance of two queries by running them multiple times while an extended events session is capturing the metrics. To avoid too much filtering and/or noise I would like to filter my extended events based on the query hashes.

In order to do that I need the query hash. So far I have had to look them up in the DMOs based on the text. But then I spend as much time finding the query hashes as I do just filtering the extended event session in other ways.

So is there an easier/quicker way to retrieve/get the query hash?

1 Answer 1


If you have the queries you're testing in front of you, you can get either an estimated or actual plan. When the query plan pops up, highlight the select operator and hit F4. You'll probably need to toggle around between plan operators to get properties to show up for the one you want, but when they do you'll see the QueryHash, QueryPlanHash, and SQLHandle of your query.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.