Workloads that generate the 0x0000000000000000 query hash value?

In the last SQLskills Insider demo video I went through a scenario where you can use the query_hash column from sys.dm_exec_query_stats to aggregate statistics for queries that only differ by literal values.

I received an interesting question from someone who watched the video, ran the demo query in production and saw a 0x0000000000000000 value as the highest consumer of worker time (and also had the highest execution count).

I asked this person to show me the query text where [query_hash] = 0x0000000000000000 and it ended up being a series of FETCH NEXT and FETCH API_CURSOR calls, for example:

FETCH API_CURSOR000000000729B7B2
FETCH API_CURSOR000000000729030C
FETCH API_CURSOR000000000729030C

There may be other circumstances where 0x0000000000000000 may manifest – but I haven’t witnessed them or heard of them.  If you have non-cursor scenarios where 0x0000000000000000 occurs, please share in the comments.


Other articles

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.