Re: Interpreting the Estimated Execution Plan

From: Eric Sabine (mopar41_at____ho_y_tmail.ScPoAmM)
Date: 04/21/04


Date: Wed, 21 Apr 2004 08:42:13 -0400

IMO, where the execution plan is most helpful is when you are comparing 2
alternate ways of solving the problem at hand. You pit the two separate
statements against each other and find which costs less. In the execution
plan for each individual statements, I _try_ to strive for equal cost among
the higher cost items, e.g., if 2 elements rank as 50% and 10%, I see what I
can do to improve the 50% item to get as close to 30-30 as possible.
Basically, I try to optimize each separate statement as much as possible and
then compare the overall result. Sometimes you can improve it and sometimes
you can't. If your situation won't be harmed by adding indexes, then you
add the appropriate indexes. Yes, a seek is better than a scan but you
can't always get away from a scan. Even if you have the most perfect index,
SS may _still_ decide to perform a scan. This is based on the amount of
data it believes it will have to retrieve. Basically, its like if you're
looking for a topic in a book and the index page indicates it's so spread
out throughout the book, it might actually cost you less time to scan every
page than to keep looking in the index, find the [bookmark], lookup the
page, go back to the index, etc.

hth
Eric

"Sky Fly" <nobody@blackhole.com> wrote in message
news:c65l2o$8ad6j$1@ID-18325.news.uni-berlin.de...
> Hello,
>
> I'm trying to improve the performance of a query, and one
> of the tools I'm turning to in this regard is the Estimated
> Execution Plan shown in Query Analyzer. I have the following
> questions:
>
> 1. I notice that each of the icons shown in the plan has a
> 'cost' associated with it, which is expressed as a percentage
> and is shown in a label that you can see if you move the mouse
> over the icon. If an icon has a high cost, does it mean that
> I have to improve performance on the table that the icon is
> associated with?
>
> 2. The icon labels have different captions - like 'Index Seek',
> 'Constant Scan' or 'Table Scan'. I guess that a 'Table Scan'
> is potentially bad news, especially if the table that is being
> scanned is very large, so this would tell me that I should
> look at putting an index on the table. Are there other similar
> interpretations I can make from the various other captions
> to improve my performance?
>
> TIA,
>
> --
> Akin
>
> aknak at aksoto dot idps dot co dot uk
>
>



Relevant Pages

  • execution plan question
    ... If you look at the execution plan, and hover over an icon, there is a column referred to as cost. ... The percentages are useful as a ratio, but the actual figure is confusing - it is not CPU cost, but what is it? ...
    (microsoft.public.sqlserver.programming)
  • Interpreting the Estimated Execution Plan
    ... Execution Plan shown in Query Analyzer. ... over the icon. ... aknak at aksoto dot idps dot co dot uk ...
    (microsoft.public.sqlserver.programming)
  • Re: cost of nested loop join
    ... Execution Plan ... My understanding is that the cost should be equal to cost of outer ... Instead it equals 102. ...
    (comp.databases.oracle.server)
  • Re: cost of nested loop join
    ... Execution Plan ... My understanding is that the cost should be equal to cost of outer ... Instead it equals 102. ...
    (comp.databases.oracle.server)
  • Re: Query estimate cost and real run time different
    ... The best way to tune your query is to actually run it and see what it does. ... even the actual execution plan has blind spots. ... > I have a query, before I do any change, the estimate execute plan show me ... the cost is 1400, the real run time is about 1 minute 33 seconds. ...
    (microsoft.public.sqlserver.server)