Symptoms
In Microsoft SQL Server, when you try to monitor cached query plans by using extended events (xEvents) and dynamic management views (DMVs), such as sys.dm_exec_requests and sys.dm_exec_query_stats, it is very difficult to correlate the cached query plans together.
Cause
This issue occurs because the data types of the Query_hash and Query_plan_hash columns differ between DMVs and xEvents. The Query_hash and Query_plan_hash columns are defined as Varbinary data type in DMVs (sys.dm_exec_requests and sys.dm_exec_query_stats). In xEvents, the columns are defined as UINT64 data type.
Resolution
Service pack information for SQL Server
This update is fixed in the following service packs for SQL Server:
-
Service Pack 4 for SQL Server 2012
Service packs are cumulative. Each new service pack contains all the fixes that are in previous service packs, together with any new fixes. Our recommendation is to apply the latest service pack and the latest cumulative update for that service pack. You do not have to install a previous service pack before you install the latest service pack. Use Table 1 in the following article for finding more information about the latest service pack and latest cumulative update.
How to determine the version, edition and update level of SQL Server and its components
After you install this update, two additional columns defined as INT64 data type are added: Query_hash_signed and Query_plan_hash_signed. These make it easier to join data between the DMVs and xEvents (such as rpc_completed and sql_batch_completed).
Each new update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous update. Check out the latest service packs for SQL Server:
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
References
Learn about the terminology that Microsoft uses to describe software updates.