Wednesday, March 28, 2012

Saving query plan

I would like to save a query plan (estimated or actual)
created in Query Analyzer -- paste it into a document,
or simply print. It doesn't seem to be possible to
select and copy the Execution Plan window, and printing
it creates microscopic gibberish which is a waste of
paper. Is it possible to do this?

Set showplan_text is of limited help for the SP I'm
looking at -- while analyzing the SP, it reads ahead
and complains that a temp table created inside the SP
doesn't exist (yet) and exits. Using Ctrl-K to capture
the query plan allows the SP to complete, but saving the
plan is the problem.

Thanks,
Jim Geissman(jim_geissman@.countrywide.com) writes:
> I would like to save a query plan (estimated or actual)
> created in Query Analyzer -- paste it into a document,
> or simply print. It doesn't seem to be possible to
> select and copy the Execution Plan window, and printing
> it creates microscopic gibberish which is a waste of
> paper. Is it possible to do this?
> Set showplan_text is of limited help for the SP I'm
> looking at -- while analyzing the SP, it reads ahead
> and complains that a temp table created inside the SP
> doesn't exist (yet) and exits. Using Ctrl-K to capture
> the query plan allows the SP to complete, but saving the
> plan is the problem.

SET STATISTICS PROFILE ON is what you are looking for.

You can also use Profiler, and filter for the event
Performance:Execution Plan.

In SQL 2005 you can actually save the graphical plan (in XML format)
from Managment Studio, the replacement for Query Analyzer and Enterprise
Manager.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Thanks, Erland.

Jim

No comments:

Post a Comment