I am learning Extended Events basics from Jonathan Kehayias's course. I have problem with some query. In Microsoft SQL Server Management Studio I created (Extended Events) session. I downloaded database AdventureWorks2012 and script generating workload on this database. Script is available here https://www.sqlskills.com/blogs/jonathan/the-adventureworks2008r2-books-online-random-workload-generator/. I used template Count Query Locks available in Extended Events templates. In course the following query is used:
SELECT * FROM sys.dm_exec_query_stats
WHERE CAST(query_hash AS BIGINT) = 13579191135410749623.
This last number is taken from histogram from column value: I click on histogram and choose View Target Data). Here is screen from SQL Server Management Studio:
In my case this query returned 0 rows. I do not understand why. What could be the problem?
Asked
Active
Viewed 229 times
1

Marcin
- 35
- 1
- 7
-
From what "histogram" did you take the number? You can find the query stats of the query you are interested in filtering by query text, and then take the query hash from the result to compare with wht you are passing in – sepupic Jun 24 '17 at 13:49
-
I updated my question by adding picture of histogram. Thank you for your advice. I added query text to collected results. When I compared hashes they are different. It only happens when I use this power shell script. When I tried to execute one query that I chose then I was able to see expected row. I am confused. – Marcin Jun 25 '17 at 16:02