30.06.2013 Views

SQL Server Execution Plans - Red Gate Software

SQL Server Execution Plans - Red Gate Software

SQL Server Execution Plans - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 1: <strong>Execution</strong> Plan Basics<br />

• Showplan Statistics Profile – This event generates the actual execution plan in the<br />

same way as the T-<strong>SQL</strong> command STATISTICS PROFILE. It still has all the shortcomings<br />

of the text output, including only supplying a subset of the data available<br />

to STATISTICS XML in T-<strong>SQL</strong> or the Showplan XML Statistics Profile event in <strong>SQL</strong><br />

<strong>Server</strong> Profiler. The Showplan Statistics Profile event is on the list for deprecation.<br />

• Showplan XML – The event fires with each execution of a query and generates an<br />

estimated execution plan in the same way as SHOWPLAN_XML. This is the event you<br />

want in most cases. The others should be avoided because of the load they place on the<br />

system or because they don't return data that is usable for our purposes.<br />

• Showplan XML for Query Compile – Like Showplan XML above, but it only fires on a<br />

compile of a given query.<br />

• Performance Statistics – Similar to the Showplan XML For Query Compile event,<br />

except this event captures performance metrics for the query as well as the plan. This<br />

only captures XML output for certain event subclasses, defined with the event. It fires<br />

the first time a plan is cached, compiled, recompiled, or removed from cache.<br />

• Showplan XML Statistics Profile – This event will generate the actual execution plan<br />

for each query, as it runs.<br />

Capturing all of the execution plans, using Showplan XML or Showplan XML Statistics<br />

Profile, inherently places a sizeable load on the server. These are not lightweight event<br />

capture scenarios. Even the use of the less frequent Showplan XML for Query Compile<br />

will cause a small performance hit. Use due diligence when running traces of this type<br />

against any production machine.<br />

55

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!