Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

QueryHash between Instances (2008 and 2014)

$
0
0
Hi,I was wondering if anyone has a reasonably definitive answer as to whether the QueryHash generated on one instance will be the same as the QueryHash generated on a different instance for the same query? I thought that the QueryHash is generated purely on the SQL text, so I would have thought that they would be the same, but I don’t think that they are.My scenario is this:We have a farm of servers for a given task and we are about to deploy another server to this farm. The aim is to migrate to 2014, so the plan is to deploy the new server as 2014 (all the others are 2008).During the test phase of the deployment, the new server will hold the same data and run queries in parallel to the existing servers. The gives us the opportunity to review the differences between 2008 and 20014 for the same queries being run.One part of the review was to gather execution plans from the plan cache on both servers and compare the plans for the same query run on both servers – I planned to use the QueryHash as a quick way to identify the same queries from both servers for the comparison.I managed to do a quick test before the server is deployed:I have a test database installed on two instances (one 2008 and one 2014). The database on the 2014 instance is a restore of the one on 2008.I ran a simple query on both instances and captured the plan (ie “SELECT * FROM TABLE_A”).I grabbed the QueryHash from both plans (ie one from each instance).I thought the QueryHash was based purely on the SQL text, so I would have thought that the two QueryHash values would be the same, but they aren’t.Does anyone know if the QueryHash values for the same query would be the same between 2008 and 2014, or if there are other factors that could affect the QueryHash that I haven’t taken into account (ie environmental options that are not explicit to the SQL text). Or is it simply that the way of generating the QueryHash has changed between versions of SQLServer.Incidentally, I have other ways of achieving the comparisons, so I’m only really interested in understanding the way the QueryHash value is generated and why it would be different.Thanks for any information that can shed some light on this.

Viewing all articles
Browse latest Browse all 3145

Trending Articles