SQL Server / Different SQL Versions different query hashes

Recently I did upgrade from SQL Server 2012 towards version 2016, and I had some PRTG maps in place for two really important queries. After upgrade monitoring failed. Query hash has been changed for the exact same query. Honestly, I did not pay much attention to that previously since the majority of those PRTG maps checking same versions of SQL Server. Also, I was under impression that query optimizer computes the query hash during query compilation on base on query logic.  In that case, if query hash is changed that also means query has been changed.


I am calculating query speed on the base of total query working time and execution count


If you want numeric values you can use CAST.


And I get results similar to


Old query hash: 0x8C14D07E56CFA72F

New query hash: 0x6FF0F9C022127E58 – SQL Server 2016 query hash

I am fetching those results and creating a graph using PRTG tool.


Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *