{"id":512,"date":"2015-11-23T09:02:59","date_gmt":"2015-11-23T15:02:59","guid":{"rendered":"http:\/\/www.sqlfreelancer.com\/blog\/?p=512"},"modified":"2015-11-23T09:04:26","modified_gmt":"2015-11-23T15:04:26","slug":"sql-server-2016-compare-showplan-option","status":"publish","type":"post","link":"https:\/\/www.sqlfreelancer.com\/blog\/sql-server-2016-compare-showplan-option\/","title":{"rendered":"SQL Server 2016 Compare Showplan Option"},"content":{"rendered":"<p>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\u2019ll go over how it works.<\/p>\n<p>For this post, I\u2019m using the AdventureWorks2014 database and I\u2019m going to use the following query:<\/p>\n<pre>SELECT FirstName, LastName, CreditCardID \r\nFROM Person.Person p \r\nINNER JOIN Sales.PersonCreditCard c ON p.BusinessEntityID = c.BusinessEntityID\r\nWHERE p.ModifiedDate &gt; '2014-01-01'<\/pre>\n<p>pen SQL Server Management Studio (SSMS) 2016 and execute the query with SET STATISTICS IO ON and \u201cInclude Actual Execution plan\u201c enabled.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2015\/11\/1-Compare-Showplan.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-514\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2015\/11\/1-Compare-Showplan.png\" alt=\"1-Compare Showplan SQL Freelancer\" width=\"584\" height=\"241\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2015\/11\/1-Compare-Showplan.png 584w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2015\/11\/1-Compare-Showplan-300x124.png 300w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/a>Click the Messages tab and you\u2019ll notice that we\u2019re doing 3819 logical reads on the Person table. This is a sign that this query can be tuned. We\u2019d like to get this number to the lowest possible.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2015\/11\/2-Compare-Showplan.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-515\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2015\/11\/2-Compare-Showplan.png\" alt=\"2-Compare Showplan SQL Freelancer\" width=\"624\" height=\"127\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2015\/11\/2-Compare-Showplan.png 624w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2015\/11\/2-Compare-Showplan-300x61.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/a><\/p>\n<p>Click the execution plan tab and you\u2019ll see the plan along with some Missing Index Details.<\/p>\n<p><a href=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2015\/11\/3-Compare-Showplan.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-516\" src=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2015\/11\/3-Compare-Showplan.png\" alt=\"3-Compare Showplan SQL Freelancer\" width=\"624\" height=\"257\" srcset=\"https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2015\/11\/3-Compare-Showplan.png 624w, https:\/\/www.sqlfreelancer.com\/blog\/wp-content\/uploads\/2015\/11\/3-Compare-Showplan-300x124.png 300w\" sizes=\"auto, (max-width: 624px) 100vw, 624px\" \/><\/a><\/p>\n<p>The execution plan is what we\u2019ll 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.<\/p>\n<p>To be able to compare plan we\u2019ll need to save the execution plan. Right click anywhere in the plan window and select Save Execution Plan As\u2026 Choose a name and location and hit Save.<\/p>\n<p><a href=\"https:\/\/www.mssqltips.com\/sqlservertip\/4095\/sql-server-2016-compare-showplan-option\" target=\"_blank\">Click here to view the rest of this post.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[97,113],"class_list":["post-512","post","type-post","status-publish","format-standard","hentry","category-performance-tuning","tag-performance-tuning","tag-sql-server-2016"],"_links":{"self":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/comments?post=512"}],"version-history":[{"count":2,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/512\/revisions"}],"predecessor-version":[{"id":517,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/512\/revisions\/517"}],"wp:attachment":[{"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/media?parent=512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/categories?post=512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlfreelancer.com\/blog\/wp-json\/wp\/v2\/tags?post=512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}