Just released in SQL Server 2016 CTP 2.4 is a new feature that will allow us to compare execution plans. The main purpose of this feature is to provide a side-by-side comparison of two execution plans. This makes it easier to find similarities and changes on each plan. This is a very nice enhancement that aids in troubleshooting issues such as understanding the impact of rewriting queries or observing how a design change, such as an index, may impact the plan. In the tip below, we’ll go over how it works.
For this post, I’m using the AdventureWorks2014 database and I’m going to use the following query:
SELECT FirstName, LastName, CreditCardID FROM Person.Person p INNER JOIN Sales.PersonCreditCard c ON p.BusinessEntityID = c.BusinessEntityID WHERE p.ModifiedDate > '2014-01-01'
pen SQL Server Management Studio (SSMS) 2016 and execute the query with SET STATISTICS IO ON and “Include Actual Execution plan“ enabled.
Click the execution plan tab and you’ll see the plan along with some Missing Index Details.
The execution plan is what we’ll focus on in this tip, but I wanted to look at STATISTICS IO also to see if we can improve the number of logical reads.
To be able to compare plan we’ll need to save the execution plan. Right click anywhere in the plan window and select Save Execution Plan As… Choose a name and location and hit Save.