dbTalk Databases Forums  

Better way to display execution plan?

microsoft.public.sqlserver.tools microsoft.public.sqlserver.tools


Discuss Better way to display execution plan? in the microsoft.public.sqlserver.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
laredotornado@zipmail.com
 
Posts: n/a

Default Better way to display execution plan? - 08-04-2010 , 12:00 PM






Hi,

I'm fairly new to SQL Server, but using version 2005 and I have SQL
Server Management Studio. When I run a query, I can right click to
display an execution plan. However, for certain queries, this graphic
becomes unruly (really, really big). Is there a way I can have a more
text-based summary of what is happening -- indexes used, table scans
performed, and the like?

Thanks, - Dave

Reply With Quote
  #2  
Old   
Tom Cooper
 
Posts: n/a

Default Re: Better way to display execution plan? - 08-04-2010 , 01:37 PM






Yes, there are several - depending on how much detail you want and what
format you want it in. There are three different options you can turn on.
ShowPlan_Text (which gives you a short version of the plan), ShowPlan_All
(which gives you a much more detailed version of the plan), and ShowPlan_XML
(which gives you the most information - it's in the form of a XML document).

One thing to remember about all of these options is when any one of them is
turned on for a connection and you run a query, SQL doesn't actually run the
query and return results, instead it creates an exeecution plan and returns
that plan.

You can turn any of these options on or off by using a SET statement. Try,
for example, the following code to see the different types of information
you can recieve.

You can also turn on or off ShowPlan_Text in SSMS by choosing Query from the
menu, the Query Options... That will bring up a dialog, in the box on the
left, choose Execution Advanced. Then check or uncheck SET SHOWPLAN_TEXT.

Sample code showing the results of each of the options.

Select COUNT(*) From sys.objects;
go
Set ShowPlan_Text On;
go
Select COUNT(*) From sys.objects;
go
Set ShowPlan_Text Off;
go
Set ShowPlan_All On;
go
Select COUNT(*) From sys.objects;
go
Set ShowPlan_All Off;
go
Set ShowPlan_XML On;
go
Select COUNT(*) From sys.objects;
go
Set ShowPlan_XML Off;
go

Tom

"laredotornado (AT) zipmail (DOT) com" <laredotornado (AT) gmail (DOT) com> wrote

Quote:
Hi,

I'm fairly new to SQL Server, but using version 2005 and I have SQL
Server Management Studio. When I run a query, I can right click to
display an execution plan. However, for certain queries, this graphic
becomes unruly (really, really big). Is there a way I can have a more
text-based summary of what is happening -- indexes used, table scans
performed, and the like?

Thanks, - Dave

Reply With Quote
  #3  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Better way to display execution plan? - 08-04-2010 , 02:14 PM



laredotornado (AT) zipmail (DOT) com (laredotornado (AT) gmail (DOT) com) writes:
Quote:
I'm fairly new to SQL Server, but using version 2005 and I have SQL
Server Management Studio. When I run a query, I can right click to
display an execution plan. However, for certain queries, this graphic
becomes unruly (really, really big). Is there a way I can have a more
text-based summary of what is happening -- indexes used, table scans
performed, and the like?
Well, complex plans are that: complex. I don't think there is an
"quick summary of a plan". Which may be just as well, because it's
not always trivial to find what is the bottleneck in a plan. (Although
in a grpahical plan it's a good idea to look for thick arrows.)

On my web site there is a tool that provids an alternate representation
of a plan, submitted by Ivan Arjentinski:
http://www.sommarskog.se/sqlutil/query_plan_tree.html.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
  #4  
Old   
laredotornado
 
Posts: n/a

Default Re: Better way to display execution plan? - 08-06-2010 , 03:30 PM



On Aug 4, 1:37*pm, "Tom Cooper" <tomcoo... (AT) comcast (DOT) net> wrote:
Quote:
Yes, there are several - depending on how much detail you want and what
format you want it in. *There are three different options you can turn on.
ShowPlan_Text (which gives you a short version of the plan), ShowPlan_All
(which gives you a much more detailed version of the plan), and ShowPlan_XML
(which gives you the most information - it's in the form of a XML document).

One thing to remember about all of these options is when any one of them is
turned on for a connection and you run a query, SQL doesn't actually run the
query and return results, instead it creates an exeecution plan and returns
that plan.

You can turn any of these options on or off by using a SET statement. *Try,
for example, the following code to see the different types of information
you can recieve.

You can also turn on or off ShowPlan_Text in SSMS by choosing Query from the
menu, the Query Options... *That will bring up a dialog, in the box on the
left, choose Execution Advanced. *Then check or uncheck SET SHOWPLAN_TEXT.

Sample code showing the results of each of the options.

Select COUNT(*) From sys.objects;
go
Set ShowPlan_Text On;
go
Select COUNT(*) From sys.objects;
go
Set ShowPlan_Text Off;
go
Set ShowPlan_All On;
go
Select COUNT(*) From sys.objects;
go
Set ShowPlan_All Off;
go
Set ShowPlan_XML On;
go
Select COUNT(*) From sys.objects;
go
Set ShowPlan_XML Off;
go

Tom

"laredotorn... (AT) zipmail (DOT) com" <laredotorn... (AT) gmail (DOT) com> wrote in message

news:7f19d347-516a-447d-a674-f001ed7933b3 (AT) s24g2000pri (DOT) googlegroups.com...

Hi,

I'm fairly new to SQL Server, but using version 2005 and I have SQL
Server Management Studio. *When I run a query, I can right click to
display an execution plan. *However, for certain queries, this graphic
becomes unruly (really, really big). *Is there a way I can have a more
text-based summary of what is happening -- indexes used, table scans
performed, and the like?

Thanks, - Dave
Hi,

The suggestion of "set showtext on" worked well. A follow up I had
from this is where do I find cumulative statistics about the query?
This is what I'm seeing right now in my tool -- http://screencast.com/t/NGZjY2Q4Yjc
..

Thanks - Dave

Reply With Quote
  #5  
Old   
Tom Cooper
 
Posts: n/a

Default Re: Better way to display execution plan? - 08-06-2010 , 11:17 PM



ShowPlan_Text gives you only a only a brief overview of the plan. If you
want the statistics, use ShowPlan_All or ShowPlan_XML. I think for what you
want, ShowPlan_All would be best. If you run ShowPlan_All in SSMS, set the
option to return the results in grid format. Otherwise, all the interesting
statistical stuff is very far off to the right and you need to scroll the
result window to the right to see it.

Tom

"laredotornado" <laredotornado (AT) zipmail (DOT) com> wrote

On Aug 4, 1:37 pm, "Tom Cooper" <tomcoo... (AT) comcast (DOT) net> wrote:
Quote:
Yes, there are several - depending on how much detail you want and what
format you want it in. There are three different options you can turn on.
ShowPlan_Text (which gives you a short version of the plan), ShowPlan_All
(which gives you a much more detailed version of the plan), and
ShowPlan_XML
(which gives you the most information - it's in the form of a XML
document).

One thing to remember about all of these options is when any one of them
is
turned on for a connection and you run a query, SQL doesn't actually run
the
query and return results, instead it creates an exeecution plan and
returns
that plan.

You can turn any of these options on or off by using a SET statement. Try,
for example, the following code to see the different types of information
you can recieve.

You can also turn on or off ShowPlan_Text in SSMS by choosing Query from
the
menu, the Query Options... That will bring up a dialog, in the box on the
left, choose Execution Advanced. Then check or uncheck SET SHOWPLAN_TEXT.

Sample code showing the results of each of the options.

Select COUNT(*) From sys.objects;
go
Set ShowPlan_Text On;
go
Select COUNT(*) From sys.objects;
go
Set ShowPlan_Text Off;
go
Set ShowPlan_All On;
go
Select COUNT(*) From sys.objects;
go
Set ShowPlan_All Off;
go
Set ShowPlan_XML On;
go
Select COUNT(*) From sys.objects;
go
Set ShowPlan_XML Off;
go

Tom

"laredotorn... (AT) zipmail (DOT) com" <laredotorn... (AT) gmail (DOT) com> wrote in message

news:7f19d347-516a-447d-a674-f001ed7933b3 (AT) s24g2000pri (DOT) googlegroups.com...

Hi,

I'm fairly new to SQL Server, but using version 2005 and I have SQL
Server Management Studio. When I run a query, I can right click to
display an execution plan. However, for certain queries, this graphic
becomes unruly (really, really big). Is there a way I can have a more
text-based summary of what is happening -- indexes used, table scans
performed, and the like?

Thanks, - Dave
Hi,

The suggestion of "set showtext on" worked well. A follow up I had
from this is where do I find cumulative statistics about the query?
This is what I'm seeing right now in my tool --
http://screencast.com/t/NGZjY2Q4Yjc
..

Thanks - Dave

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.