<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'Query Plans', 'showplan', 'SQL Sentry', 'Plan Explorer', and 'graphical plans'</title><link>http://sqlblog.com/search/SearchResults.aspx?o=DateDescending&amp;tag=Query+Plans,showplan,SQL+Sentry,Plan+Explorer,graphical+plans&amp;orTags=0</link><description>Search results matching tags 'Query Plans', 'showplan', 'SQL Sentry', 'Plan Explorer', and 'graphical plans'</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Comparing multiple plans in SQL Sentry Plan Explorer</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2012/01/06/comparing-multiple-plans-in-sql-sentry-plan-explorer.aspx</link><pubDate>Fri, 06 Jan 2012 15:54:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:40864</guid><dc:creator>AaronBertrand</dc:creator><description>&lt;p&gt;I’ve seen the question a few times now: “How do I compare two plans side-by-side in Plan Explorer?” Management Studio allows you to view multiple graphical plans that are visible simultaneously, either by generating plans for every statement in a batch, or by generating plans in separate query windows and then splitting the panes. However, at least in my estimation, a lot of the other metrics and properties are more valuable when performing comparisons. In SSMS this is tough, because you can only have one tooltip visible at a time (regardless of how many plans are visible). Same for the Properties panel – only a single plan or operator can populate this panel at one time. So even though you can compare high-level graphical details quickly, you will likely end up with multiple instances of SSMS to perform true side-by-side comparisons of the lower-level details. &lt;br&gt;&lt;/p&gt;
&lt;p&gt;In Plan Explorer (&lt;a href="http://sqlsentry.net/plan-explorer/sql-server-query-view.asp" title="http://sqlsentry.net/plan-explorer/sql-server-query-view.asp" target="_blank"&gt;free download&lt;/a&gt;) it is very easy to compare a lot of the metrics side-by-side for two (or more) plans. Since Plan Explorer can generate estimated or actual plans for you, it’s as simple as entering multiple queries in the Command Text pane, and then generating an estimated or actual plan:&lt;/p&gt;

&lt;p&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2012/01/pe_m_actual_a.png" alt="" style="border:1px solid black;" hspace="40"&gt;&lt;/p&gt;
&lt;p&gt;I recommend trying the Vertical Layout, so that the various plan-related tabs and the Statements Tree are a lot closer together (reducing mouse and eye movement):&lt;/p&gt;
&lt;p&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2012/01/pe_m_vertical_layout.png" alt="" style="border:1px solid black;" hspace="40"&gt;&lt;/p&gt;
&lt;p&gt;Here is a quick comparison of the two default options (vertical on the left, horizontal on the right – click to enlarge):&lt;/p&gt;
&lt;p&gt;&lt;a href="http://bertrandaaron.files.wordpress.com/2012/01/pe_m_compareoptions.png" target="_blank"&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2012/01/pe_m_compareoptions.png" alt="" style="border:1px solid black;" hspace="40" border="0" width="549"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;(There is also a Custom Layout option if you wish to change from the default options.)&lt;/p&gt;
&lt;p&gt;And you can still compare a lot of the other details about two different statements by looking at the other columns in the Statements Tree tab. For example, comparing costs, row counts and operation counts between estimated or actual plans can give you a much more accurate picture of the performance impact of different statements:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2012/01/pe_m_firstrow.png" alt="" style="border:1px solid black;" hspace="40"&gt;&lt;/p&gt;
&lt;p&gt;And you can switch between graphical plans quickly by using arrow keys or mouse clicks to switch between statements:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2012/01/pe_m_secondrow.png" alt="" style="border:1px solid black;" hspace="40"&gt;&lt;/p&gt;

&lt;p&gt;Since the other tabs are context sensitive, you can do this for any tab: simply highlight a tab (e.g. Top Operations) and, as you switch through the rows in the Statements Tree, the tab below will update accordingly.&lt;/p&gt;
&lt;p&gt;For more complex plans, and depending on how much screen real estate you have, you may prefer to open two instances of Plan Explorer so that you can interact with the plans a little more independently. In this case you won’t be able to see percentages or other relative comparisons directly against one another, but for most eyeballing, it’s still better than what you get in Management Studio IMHO.&lt;/p&gt;
&lt;p&gt;That all said, comparing two graphical plans side by side is definitely on the list for a future update; in the meantime, I hope the above is helpful.&lt;br&gt;&amp;nbsp;&lt;br&gt;&lt;/p&gt;</description></item><item><title>Getting graphical ShowPlans back in SQL Server 2008 R2</title><link>http://sqlblog.com/blogs/aaron_bertrand/archive/2011/10/28/getting-graphical-showplan-back-in-sql-server-2008-r2.aspx</link><pubDate>Fri, 28 Oct 2011 17:42:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:39444</guid><dc:creator>AaronBertrand</dc:creator><description>
&lt;p&gt;For those of you using the SQL Server 2008 R2 version of Management Studio, and have applied Service Pack 1, you have probably noticed that clicking on a ShowPlan in grid results no longer shows the graphical plan, but rather opens a new window with the raw XML.&lt;/p&gt;

&lt;p&gt;For example, running the following query: &lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;SELECT TOP &lt;/font&gt;&lt;font color="gray"&gt;(&lt;font color="black"&gt;5&lt;/font&gt;&lt;/font&gt;&lt;font color="black"&gt;&lt;/font&gt;&lt;font color="gray"&gt;) &lt;/font&gt;&lt;font color="black"&gt;qp.query_plan&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;FROM &lt;/font&gt;&lt;font color="green"&gt;sys.dm_exec_query_stats &lt;/font&gt;&lt;font color="blue"&gt;AS &lt;/font&gt;&lt;font color="black"&gt;qs&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="gray"&gt;CROSS APPLY&lt;/font&gt;&lt;font color="black"&gt; &lt;/font&gt;&lt;font color="green"&gt;sys.dm_exec_query_plan&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;q&lt;/font&gt;&lt;font color="black"&gt;s.plan_handl&lt;/font&gt;&lt;font color="black"&gt;e&lt;/font&gt;&lt;font color="gray"&gt;)&lt;/font&gt;&lt;font color="green"&gt; &lt;/font&gt;&lt;font color="blue"&gt;AS &lt;/font&gt;&lt;font color="black"&gt;qp&lt;/font&gt;&lt;font color="gray"&gt;;&lt;/font&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;


&lt;p&gt;...yields the following results:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/10/showplan_grid.png" border="1" height="128" width="479"&gt;&lt;br&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Clicking on any of those hyperlinks, prior to applying Service Pack 1 (or in earlier versions of SSMS), would launch a graphical plan -- which you could examine inline, save to the file system, or open in &lt;a href="http://sqlsentry.net/plan-explorer/sql-server-query-view.asp" title="http://sqlsentry.net/plan-explorer/sql-server-query-view.asp" target="_blank"&gt;SQL Sentry Plan Explorer&lt;/a&gt;. After applying Service Pack 1, however, this launches a new XML editor window:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;img src="http://bertrandaaron.files.wordpress.com/2011/10/showplan_results.png" border="1" height="207" width="273"&gt;&amp;nbsp;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;...which isn't very useful, unless you're really good at speed-reading XML. This was reported by &lt;a href="http://twitter.com/AdamMachanic" title="http://twitter.com/AdamMachanic" target="_blank"&gt;@AdamMachanic&lt;/a&gt; in &lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/652855/valid-showplan-xml-fails-to-automatically-produce-graphical-showplan" title="http://connect.microsoft.com/SQLServer/feedback/details/652855/valid-showplan-xml-fails-to-automatically-produce-graphical-showplan" target="_blank"&gt;Connect #652855&lt;/a&gt; (for some reason, closed as "by design") and has been observed by countless others. The problem is caused because, due to slight changes in SP1, SSMS has difficulty determining that the resulting XML is, in fact, a ShowPlan document. &lt;br&gt;&lt;/p&gt;

&lt;p&gt;One workaround is to save the XML as a .sqlplan file, and then 
launch it by double-clicking or using File &amp;gt; Open in either SSMS or 
Plan Explorer. And as &lt;a href="http://twitter.com/Kendra_Little" title="http://twitter.com/Kendra_Little" target="_blank"&gt;@Kendra_Little&lt;/a&gt; pointed out on twitter, you can also just right-click the result, Copy, and then paste into Plan Explorer.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Another workaround, if you have a &lt;strike&gt;Denali&lt;/strike&gt; SQL Server 2012 installation handy, is to copy the newer showplanxml.xsd file from SQL Server 2012 and use it with SQL Server 2008 R2. To do this, close down all instances of Management Studio, open Windows Explorer on the machine running SQL Server 2012, and go to the following folder:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\schemas\sqlserver\2004\07\showplan\&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;Copy the showplanxml.xsd file. On the machine that is running the 2008 R2 client tools, go to the following folder:&lt;/p&gt;

&lt;blockquote&gt;
&lt;table bgcolor="#eeeeee" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;pre style="padding:10px 20px;font-size:12px;font-family:consolas,lucida console,courier new,courier;-moz-background-inline-policy:continuous;"&gt;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\schemas\sqlserver\2004\07\showplan\&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;Rename the file showplanxml.xsd to showplanxml.xsd.old, and then paste the newer version of the XSD file in its place. (Note that your Program Files folder may be in a slightly different location, and on 32-bit systems, the (x86) won't be there.) &lt;br&gt;&lt;/p&gt;

&lt;p&gt;After you have the newer version of the XSD file in the showplan folder, when you open Management Studio and repeat the above steps, you should see the graphical plan as before. This works because it corrects the issue with the invalid XSD file and, even though there have been substantial changes to the XSD schema for SQL Server 2012, the plans you're retrieving from older versions are not going to produce anything that interferes or conflicts with the older XSD, so the new stuff is just fluff.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Now, I haven't done exhaustive research on this (I've tested a few dozen plans with no issues), and it's certainly not supported, but if you want to get the old behavior back without waiting for some future cumulative update, you now have a workaround that doesn't require multiple extra steps for every plan you open. Still, I'd like to hear if you encounter any issues with this workaround.&lt;/p&gt;

&lt;p&gt;If you want an official, supported fix from Microsoft, they will be happy to provide you with an updated 2008 R2 version of the XSD file. Before it is released through a cumulative update, however, you'll have to go through &lt;a href="https://support.microsoft.com/oas/default.aspx?Gprid=14917&amp;amp;st=1&amp;amp;wfxredirect=1&amp;amp;sd=gn" title="https://support.microsoft.com/oas/default.aspx?Gprid=14917&amp;amp;st=1&amp;amp;wfxredirect=1&amp;amp;sd=gn" target="_blank"&gt;official CSS channels&lt;/a&gt; to get it. Make sure to reference &lt;a href="http://connect.microsoft.com/SQLServer/feedback/details/652855/valid-showplan-xml-fails-to-automatically-produce-graphical-showplan" title="http://connect.microsoft.com/SQLServer/feedback/details/652855/valid-showplan-xml-fails-to-automatically-produce-graphical-showplan" target="_blank"&gt;Connect #652855&lt;/a&gt;.&lt;br&gt;&amp;nbsp; &lt;br&gt;&lt;/p&gt;</description></item></channel></rss>