Return-Path: <oracle-l-bounce@freelists.org>
Delivered-To: 2-oracle-l@orafaq.com
Received: (qmail 8471 invoked from network); 20 Feb 2008 16:49:54 -0600
Received: from freelists-180.iquest.net (HELO turing.freelists.org) (206.53.239.180)
  by static-ip-69-64-49-119.inaddr.intergenia.de with SMTP; 20 Feb 2008 16:49:53 -0600
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id A4FE8808564;
 Wed, 20 Feb 2008 17:49:52 -0500 (EST)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 27639-01; Wed, 20 Feb 2008 17:49:52 -0500 (EST)
Received: from turing (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 1728D806E51;
 Wed, 20 Feb 2008 17:49:52 -0500 (EST)
Received: with ECARTIS (v1.0.0; list oracle-l); Wed, 20 Feb 2008 17:47:46 -0500 (EST)
Received: from localhost (localhost [127.0.0.1])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 01D48808096
 for <oracle-l@freelists.org>; Wed, 20 Feb 2008 17:47:46 -0500 (EST)
Received: from turing.freelists.org ([127.0.0.1])
 by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 27079-03 for <oracle-l@freelists.org>;
 Wed, 20 Feb 2008 17:47:45 -0500 (EST)
Received: from smtp805.mail.ird.yahoo.com (smtp805.mail.ird.yahoo.com [217.146.188.65])
 by turing.freelists.org (Avenir Technologies Mail Multiplex) with SMTP id 71AF58082AF
 for <oracle-l@freelists.org>; Wed, 20 Feb 2008 17:47:45 -0500 (EST)
Received: (qmail 87882 invoked from network); 20 Feb 2008 22:47:44 -0000
Received: from unknown (HELO Primary) (oracle.expert@btinternet.com@86.158.7.156 with login)
  by smtp805.mail.ird.yahoo.com with SMTP; 20 Feb 2008 22:47:44 -0000
X-YMail-OSG: I1JEWEUVM1lv8v46yQbvxt56UG52WYEmIKv0DBL5y.ifJpbQ.u73mbjbZhoMCAb2lZDPwNqK8QTOZmBzzLY6qJg-
X-Yahoo-Newman-Property: ymail-3
Message-ID: <027901c87412$9f308690$0300a8c0@Primary>
From: "Jonathan Lewis" <jonathan@jlcomp.demon.co.uk>
To: <makulev@gmx.net>,
 <oracle-l@freelists.org>
References: <001101c87177$daf62330$6401a8c0@trivadis.com>
Subject: Re: Reading an execution plan  puzzle 
Date: Wed, 20 Feb 2008 22:47:50 -0000
MIME-Version: 1.0
Content-Type: text/plain; format=flowed;	charset="iso-8859-1";	reply-type=original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-archive-position: 5596
X-ecartis-version: Ecartis v1.0.0
Sender: oracle-l-bounce@freelists.org
Errors-to: oracle-l-bounce@freelists.org
X-original-sender: jonathan@jlcomp.demon.co.uk
Precedence: normal
Reply-to: jonathan@jlcomp.demon.co.uk
List-help: <mailto:ecartis@freelists.org?Subject=help>
List-unsubscribe: <oracle-l-request@freelists.org?Subject=unsubscribe>
List-software: Ecartis version 1.0.0
List-Id: oracle-l <oracle-l.freelists.org>
X-List-ID: oracle-l <oracle-l.freelists.org>
List-subscribe: <oracle-l-request@freelists.org?Subject=subscribe>
List-owner: <mailto:steve.adams@ixora.com.au>
List-post: <mailto:oracle-l@freelists.org>
List-archive: <http://www.freelists.org/archives/oracle-l>
X-list: oracle-l
X-Virus-Scanned: Debian amavisd-new at localhost.localdomain


Notes inline

Regards

Jonathan Lewis
http://jonathanlewis.wordpress.com

Author: Cost Based Oracle: Fundamentals
http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html

The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html


----- Original Message ----- 
From: "Milen Kulev" <makulev@gmx.net>
To: <oracle-l@freelists.org>
Sent: Sunday, February 17, 2008 3:14 PM
Subject: Reading an execution plan puzzle


> Hello Listers,
>
> Recently I have got puzzled when I tried to read the following execution plan 
> .
> The SQL was:
>
>
> My questions are :
> 1) Should I always trace (with event 10046 or 10053) the SQL to get the "full" 
> (with all the steps) execution plan?

It's a good idea.  It avoids errors caused by EXPLAIN PLAN
not knowing the type of your bind variables, and it supplies
actual (peeked) values for optimisation rather than using defaults
for selectivity that might otherwise be appropriate.

The presence of the table access to SUPP_SCHED_AGREEMENT_PART_TAB
in the explain plan may be due to bind confusion.

> 2) Is there any systematic "approach" (apart from trial & error) to reveal the 
> hidden (the this case FLTER) steps ?

The change in plan is a little worrying with with the introduction
of the aliasing - it suggests that your previous plan was suffering
from incorrect column capture - i.e. using a column of the same
name from the wrong table - rather than anything else.

The "missing filter" (from my perspective) is above line 4 - but its
absence is revealed by the filter predicate associated with line 4,
and when I see this pattern, I sometimes edit the output from
explain plan to make it easier to read - see below.

> 3) Why is "explain plan for" not able to ident properly parent/child steps ? 
> Perhaps there is a
> Bug related to LEVEL pseudo variable when using CONNECT BY ?

There is a bug with 10g's calculation of the DEPTH column in some cases -
in particular when there are multiple scalar subqueries in the where clause.
So this query might be exhibiting the bug.  It may not be documented, I haven't
checked, and it is partly fixed in 11g.

In your case, I think lines 6, 7, and 8 are all indented one space further
to the right than they should be.

Just run a query to 'select id, parent_id from plan_table' after doing the 
explain plan
to see if there's anything funny in your example.


Lines 3 - 8 would be more readable as follows; the FILTER is my re-insertion
of a filter operation that used to appear in similar 8i plans, but has generally 
been
squashed out of existence in 9i; line 4 (with its direct descendents if it had 
any) then
has to be pushed to the right;  and lines 6,7,8 are pushed to the left to cater 
for the
depth bug.

|*  3 |    TABLE ACCESS BY INDEX ROWID    | SUPPLIER_SCHEDULE_TAB         |
            FILTER
|*  4 |      INDEX FULL SCAN              | SUPPLIER_SCHEDULE_UK          |
|*  5 |      INDEX FAST FULL SCAN         | USER_ALLOWED_SITE_B_IX        |
|   6 |      SORT AGGREGATE               |                               |
|   7 |       FIRST ROW                   |                               |
|*  8 |        INDEX RANGE SCAN (MIN/MAX) | SUPPLIER_SCHEDULE_UK          |


>
> I am awaiting your comments impatiently ;)
>
> Best Regards. Milen
> P.S. There is no difference in the performance of both "versions" of this SQL
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.20.7/1283 - Release Date: 16/02/2008 
> 14:16
>
> 

--
http://www.freelists.org/webpage/oracle-l


