jeudi 29 janvier 2015

Execution Plans Differ for the Same Sql Statement


As a background to this question the details can be found at this link In a nutshell. I have 2 sql statements that are almost identical except for the RIGHT table. The LEFT JOIN is the same and the returned columns vary because the tables are different. The databases were moved to a SQL Server 2012 instance from 08. On the 2012 instance 1 query executes in under 3 seconds and the other takes almost 2 hours to execute. The Execution plans differ and are posted at the link. However I can take both queries and execute them on the SQL Server 2008 server and they both complete in under 3 seconds. Both execution plans on the 08 server are identical to the 'Good' execution plan on the 2012 server. I have a new statement that will work but the application that it's used in is a C# windows application using inline sql and I would like to not break that pattern for this 1 statement. Can anyone shed any light in this problem?


Thanks





Aucun commentaire:

Enregistrer un commentaire