Weird to explain plan structured multi-level XmlType column

Hello

spin an explanation on the follwing on 11.2.0.2 query:

SELECT
T1.EVENT_ID,
ACTION_SUB_ID,
PARAM_KEY,
PARAM_VALUE,
TO_DATE('2013-12-10', 'YYYY-MM-DD')
FROM  T_C_RMP_MNTRNG_XML_FULL_IL ,
  XMLTABLE('/monitoring' PASSING XML_CONTENT COLUMNS
  EVENT_ID VARCHAR2(4000) PATH 'eventId',
  ACTIONS XMLTYPE PATH 'action'
) T1,
  XMLTABLE('/action' PASSING T1.ACTIONS COLUMNS
  ACTION_SUB_ID NUMBER(10,0) PATH 'actionSubId',
  PARAMS xmltype PATH 'param'
) T2,
  XMLTABLE('/param' PASSING T2.params columns
  PARAM_KEY VARCHAR2(4000) PATH 'key',
  PARAM_VALUE VARCHAR2(1000) PATH 'value'
) T3
WHERE MESSAGE_ID = 4972102 ;

Even if MESSAGE_ID is the primary key of the T_C_RMP_MNTRNG_XML_FULL_IL and so there isn't that one record corresponding to the condition, I get a plan to explain with huge costs, 500 MB of data and a duration of 10 hours:

PLAN_TABLE_OUTPUT

--------------------------------------------------------------------------------------------------------

Hash value of plan: 4011854835

--------------------------------------------------------------------------------------------------------

| ID | Operation | Name                  | Lines | Bytes | Cost (% CPU). Time |

--------------------------------------------------------------------------------------------------------

|   0 | SELECT STATEMENT |                       |   223KO |   489 M |  3111K (1) | 10:22:17 |

|   1.  NESTED LOOPS |                       |       |       |            |          |

|   2.   NESTED LOOPS |                       |   223KO |   489 M |  3111K (1) | 10:22:17 |

|   3.    NESTED LOOPS |                       |   140K |    11 M |  1678 (1) | 00:00:21 |

|*  4 |     INDEX RANGE SCAN | X1B                   |     1.    53.     3 (0) | 00:00:01 |

|   5.     TABLE ACCESS BY INDEX ROWID | T_OR_MON_ACTION |   140K |  4542K |  1675 (1) | 00:00:21 |

PLAN_TABLE_OUTPUT

--------------------------------------------------------------------------------------------------------

|*  6 |      INDEX RANGE SCAN | X3                    |   140K |       |     4 (25) | 00:00:01 |

|*  7 |    INDEX RANGE SCAN | X4G                   |  4083.       |    22 (0) | 00:00:01 |

|   8.   TABLE ACCESS BY INDEX ROWID | T_OR_MON_ACTION_PARAM |     2.  4428.    52 (0) | 00:00:01 |

--------------------------------------------------------------------------------------------------------

Information of predicates (identified by the operation identity card):

---------------------------------------------------

4 - access ("MESSAGE_ID" = 4972102)

6 - access("SYS_ALIAS_0".") NESTED_TABLE_ID "=" T_C_RMP_MNTRNG_XML_FULL_IL. " ("' SYS_NC0001200013$ ')

7 - access ("NESTED_TABLE_ID"= "SYS_ALIAS_0"." ("SYS_NC0000500006$")

PLAN_TABLE_OUTPUT

--------------------------------------------------------------------------------------------------------

Note

-----

-dynamic sample used for this survey (level = 2)

When I run the query, the result comes back within 0.3 seconds.

Why is the plan to explain to the wide like that?

It's just the way it is, or is there something wrong here?

How did you finally to create the column 'XML_CONTENT' in the T_C_RMP_MNTRNG_XML_FULL_IL table / create the T_C_RMP_MNTRNG_XML_FULL_IL table?

That said, SQL * more explain the scheme, spends most of the time especially bananas when it comes with XMLTYPE and or objects which has no statistics created for them (dynamic sampling used for this survey (level = 2))

Using DBMS_XPLAN etc to get the 'real' values instead of "estimates".

https://blogs.Oracle.com/optimizer/entry/how_do_i_know_if

Tags: Database

Similar Questions

  • Ask about the structured storage of XMLTYPE column in Oracle Xml db

    Dear all,

    Version of DB: Oracle 11g (11.2.0.3.0)

    I have a table with an XMLTYPE column with a structured storage.

    CREATE TABLE Orders
        (
        Order_id NUMBER NOT NULL,
        Order_etc VARCHAR2(100),
        Order_desc XMLType NOT NULL
        )
        XMLTYPE Order_desc STORE AS OBJECT RELATIONAL XMLSCHEMA  "http://localhost/public/xsd/order_desc_xsd.xsd" ELEMENT "OrderState";
    

    I then recorded the XSD XML Db schema that is required for the structured storage.

    Before the creation of the table, I had created a table XMLTYPE (db_objects) and was able to use the query to verify that all objects, the XMLTYPE table got broken into when I signed his XSD below.

        SELECT column_name,      
               data_type
        FROM   user_tab_cols
        WHERE  table_name = 'DB_OBJECTS';
    

    And used under query to find data stored in the object-relational structure for my table (DB_OBJECTS) created with definition of XMLTYPE.

      SELECT EXTRACTVALUE(xseq.column_value, '/THISROW/OWNER')       AS owner
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_NAME') AS object_name
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_TYPE') AS object_type
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_ID')   AS object_id
        ,      EXTRACTVALUE(xseq.column_value, '/THISROW/CREATED')     AS created
        FROM   db_objects do
         ,      TABLE(XMLSEQUENCE(EXTRACT(VALUE(do), '/ROWSET/THISROW'))) xseq  
        WHERE  ROWNUM <= 10;
    

    Now could someone let me know, How to find how the column of XMLTYPE (Order_desc) was divided between other objects, just as I did for the Table with XMLTYPE (as shown above)?

    Thank you very much.

    First of all, because you are on 11.2, ExtractValue is obsolete and the documentation lists three options to use instead.  Here's an (untested) option

    SELECT owner, object_name, object_type, object_id, created
      FROM db_objects do,
           XMLTable('/ROWSET/THISROW'
                    PASSING do.object_value
                    COLUMNS
                    -- Set data types accordingly
                    owner        VARCHAR2(20) PATH 'owner',
                    object_name  VARCHAR2(20) PATH 'object_name',
                    object_type  VARCHAR2(20) PATH 'object_type',
                    object_id    VARCHAR2(20) PATH 'object_id',
                    created      VARCHAR2(20) PATH 'created');
    

    Secondly, why the column order matter?  You store in a method of object / relational.  As long as the XML is valid per the schema, Oracle will be able to store the data and thus to retrieve later.  How these data are mainly internal Oracle and shouldn't be touched because it can be changed from one version to another.  You can use the schema annotation to control how Oracle cards and stores the XML content, but nothing in there specifies the column order I know.

    It seems several details are missing information which could help others to answer your question as to what you need.

  • Difference explain plan "Select 1' and"Select column-name".

    Hi all
    I use Oracle 10.2.0.4.0. I have two queries that looks like below.

    Select Count (a.id)
    of a, b
    where a.c1 = b.c1
    and a.c1 = 'USD'
    and b.c2 = 234
    and rownum < = 1;

    Select 1
    of a, b
    where a.c1 = b.c1
    and a.c1 = 'USD'
    and b.c2 = 234
    and rownum < = 1;

    Here 'id' corresponds to the primary key column and the index are all used in the join columns. so I expect the execution of the two queries above path should be the same. But I do not get the same result. There is a different set of indexes used in the two plans, and this resulted in a total elapsed time difference of ~ 15 minutes.

    Can you please help me, why this is happening.

    930254 wrote:
    in my plan, I see "unique Index Scan" that is to say access a primary key for the query "Select 1'. But I'm getting slower than 15-minute result set that to use 'Select column_name', what must be the reason?

    Again, I will have another one with different join tables which is just the opposite, I mean, using the ' Select count (1) "19 minutes 55 seconds have passed where using the" 1 Select ' equipped with 22 dry.»

    To answer your question why you see this difference in performance: the 'rapid' plan uses a different index that allows access to a straight line through the index and does not require a visit to the table:

    -----------------------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                      | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Pstart| Pstop |
    -----------------------------------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT               |                                |     1 |    27 |       | 15229   (6)| 00:01:18 |       |       |
    |   1 |  SORT AGGREGATE                |                                |     1 |    27 |       |         |             |       |       |
    |*  2 |   COUNT STOPKEY                |                                |       |       |       |         |             |       |       |
    |*  3 |    HASH JOIN                   |                                |   252K|  6658K|  5920K| 15229   (6)| 00:01:18 |       |       |
    |   4 |     TABLE ACCESS BY INDEX ROWID| POCACHELINEDISB                |   252K|  2959K|       | 12922   (4)| 00:01:07 |       |       |
    |*  5 |      INDEX RANGE SCAN          | IDX_POLINEDISB_UOMCD           |   252K|       |       |   384  (18)| 00:00:02 |       |       |
    |   6 |     PARTITION RANGE ALL        |                                |   368K|  5395K|       |  1519   (8)| 00:00:08 |     1 |    51 |
    |   7 |      PARTITION HASH ALL        |                                |   368K|  5395K|       |  1519   (8)| 00:00:08 |     1 |     8 |
    |*  8 |       INDEX RANGE SCAN         | IDX_PCHD_PAYPK_LASTD_STAT_POPK |   368K|  5395K|       |  1519   (8)| 00:00:08 |     1 |   408 |
    -----------------------------------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    2 - filter(1>=ROWNUM)
    3 - access("POCACHEHEADERDISB"."PO_PK"="POCACHELINEDISB"."PO_PK")
    5 - access("POCACHELINEDISB"."UNITOFMEASURECD"='USD')
    8 - access("POCACHEHEADERDISB"."PAYPK"=8135488395)
    

    The disadvantage of this implementation plan is that the index is composed of 408 subpartitions all are to be visited.

    The 'slow' plan uses a different index that is global, but you can only filter the corresponding lines after the visit of the table, so you could find yourself with a lot of lines that match on the PK, visit the row in the table only to discover that the line is not eligible. In addition to this, it could be that each iteration of this nested loop may have to visit a table row in another block to your table, as a result, many of these visits could really turn into physical i/o.

    ------------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                             | Name                 | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    ------------------------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                      |                      |     1 |    27 |     4   (0)| 00:00:01 |       |       |
    |*  1 |  COUNT STOPKEY                        |                      |       |       |            |       |          |       |
    |   2 |   NESTED LOOPS                        |                      |     2 |    54 |     4   (0)| 00:00:01 |       |       |
    |   3 |    TABLE ACCESS BY INDEX ROWID        | POCACHELINEDISB      |   245K|  2877K|     2   (0)| 00:00:01 |       |       |
    |*  4 |     INDEX RANGE SCAN                  | IDX_POLINEDISB_UOMCD |   252K|       |     2   (0)| 00:00:01 |       |       |
    |   5 |    PARTITION HASH ITERATOR            |                      |     1 |    15 |     1   (0)| 00:00:01 |   KEY |   KEY |
    |*  6 |     TABLE ACCESS BY GLOBAL INDEX ROWID| POCACHEHEADERDISB    |     1 |    15 |     1   (0)| 00:00:01 | ROWID | ROWID |
    |*  7 |      INDEX UNIQUE SCAN                | P_POCACHEHEADERDISB  |     1 |       |     1   (0)| 00:00:01 |   KEY |   KEY |
    ------------------------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
    1 - filter(1>=ROWNUM)
    4 - access("POCACHELINEDISB"."UNITOFMEASURECD"='USD')
    6 - filter("POCACHEHEADERDISB"."PAYPK"=8135488395)
    7 - access("POCACHEHEADERDISB"."PO_PK"="POCACHELINEDISB"."PO_PK")
    

    This may explain the long-run: number of iterations to find a first row involving a lot of single random physical i/o block.

    You could check by using DBMS_XPLAN. DISPLAY_CURSOR with the option "LAST ALLSTATS" and enabling statistical Rowsource, for example as shown here: http://oracle-randolf.blogspot.de/2011/12/extended-displaycursor-with-rowsource.html

    It's probably an effect secondary different pricing when using optimization of the first K rows, as mentioned by Jonathan. It would be interesting to see the cost estimate if you forced the use of the index of the other for the approach of NL.

    If you check the slow plans you see what approach they use - use access primary key because internal table could cause these runtimes very variable, depending on the speed at which the first line given in the table.

    Hope this helps,
    Randolf

  • Explain to me how a multi-level security strategy can be deployed domain LAN-to-WAN and the LAN domain to the domain of the workstation with the use of internal firewalls.

    Explain to me how a multi-level security strategy can be deployed domain LAN-to-WAN and the LAN domain to the domain of the workstation with the use of internal firewalls.

    Hello

    Your Windows XP question is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please ask your question in the following forum.
    http://social.technet.Microsoft.com/forums/en-us/itproxpsp/threads

  • explain plan

    Hi all

    I use under version

    Connected to Oracle Database 11g Express Edition Release 11.2.0.2.0

    SQL > SELECT DEPTNO

    DEPT 2

    3. WHERE DEPTNO! = ALL

    4 (DEPTNO SELECT FROM EMP WHERE DEPTNO IS NOT NULL);

    DEPTNO

    ----------

    40

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 474461924

    ---------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

    ---------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |      |     4.   104.     5 (20) | 00:00:01 |

    |*  1 |  HASH ANTI JOIN |      |     4.   104.     5 (20) | 00:00:01 |

    |   2.   TABLE ACCESS FULL | DEPT |     4.    52.     2 (0) | 00:00:01 |

    |*  3 |   TABLE ACCESS FULL | EMP |    14.   182.     2 (0) | 00:00:01 |

    ---------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    1 - access ("DEPTNO" ="DEPTNO")

    3 - filter ("DEPTNO" IS NOT NULL)

    Note

    -----

    -dynamic sample used for this survey (level = 2)

    ----------------------------------------------------------------------------------------------------

    SQL > SELECT DEPTNO FROM DEPT

    2. IF YOU USE NOT IN DEPTNO (DEPTNO SELECT FROM EMP WHERE DEPTNO IS NOT NULL);

    DEPTNO

    ----------

    40

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 474461924

    ---------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

    ---------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |      |     4.   104.     5 (20) | 00:00:01 |

    |*  1 |  HASH ANTI JOIN |      |     4.   104.     5 (20) | 00:00:01 |

    |   2.   TABLE ACCESS FULL | DEPT |     4.    52.     2 (0) | 00:00:01 |

    |*  3 |   TABLE ACCESS FULL | EMP |    14.   182.     2 (0) | 00:00:01 |

    ---------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    1 - access ("DEPTNO" ="DEPTNO")

    3 - filter ("DEPTNO" IS NOT NULL)

    Note

    -----

    -dynamic sample used for this survey (level = 2)

    --------------------------------------------------------------------------------------------------

    SQL > SELECT DEPTNO

    DEPT 2

    3. WHERE THERE IS NO

    4 (SELECT * FROM EMP WHERE EMP.) DEPTNO = DEPT. DEPTNO);

    DEPTNO

    ----------

    40

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 474461924

    ---------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

    ---------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |      |     4.   104.     5 (20) | 00:00:01 |

    |*  1 |  HASH ANTI JOIN |      |     4.   104.     5 (20) | 00:00:01 |

    |   2.   TABLE ACCESS FULL | DEPT |     4.    52.     2 (0) | 00:00:01 |

    |   3.   TABLE ACCESS FULL | EMP |    14.   182.     2 (0) | 00:00:01 |

    ---------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    1 - access("EMP".") DEPTNO "=" DEPT ". ("' DEPTNO ')

    Note

    -----

    -dynamic sample used for this survey (level = 2)

    My doubt is as all the query 3 generates even explain plan

    Can we consider that all queries to be the same as in the review of the performance.

    Thank you

    NOT IN and EXISTS are not the same. If there is only one NULL value in the sub query used with NOT IN then any condition fails.

    Here is a note of AskTom on this topic

    https://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:442029737684

  • EXPLAIN Explain plan

    Hello
    can someone point me to full details of the Plan, including how to understand the syntax in the statement "3-filter...". "marked in red.
    This cross-history. I expect to see <>(not the equal sign) between these columns, but there is nothing:
    Actual results is also 14 ranks, but I do not see that the figure anywhere in the plan, only "12" will be one any correlation between the numbers of plan and result?
    T1 (col_1 number):
    1
    2
    3
    4
    
    T2 (col_1 number):
    3
    4
    5
    6
    
    
    SQL> explain plan for  select t1.col_1 from t1, t2 where t1.col_1 != t2.col_1;
     
    Explained.
     
    SQL> select * from table(dbms_xplan.display);
     
    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------------------------------
    Plan hash value: 1967407726
     
    ---------------------------------------------------------------------------
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |      |    12 |   312 |     6   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS      |      |    12 |   312 |     6   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| T1   |     4 |    52 |     2   (0)| 00:00:01 |
    |*  3 |   TABLE ACCESS FULL| T2   |     3 |    39 |     1   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
     
    Predicate Information (identified by operation id):
    ---------------------------------------------------
     
       3 - filter("T1"."COL_1""T2"."COL_1")          ---/*XXX
     
    Note
    -----
       - dynamic sampling used for this statement
     

    the cost based optimizer uses internal statistics to determine the number of rows that an operation will be back. For the simple query in your example, these estimates would be quite accurate if statistics have been sufficient - but they are not since we see the dynamic sampling note that indicates the missing statistics: http://blogs.oracle.com/optimizer/entry/dynamic_sampling_and_its_impact_on_the_optimizer

    -- without statistics
    ---------------------------------------------------------------------------
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |      |    12 |   312 |    13   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS      |      |    12 |   312 |    13   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| T1   |     4 |    52 |     4   (0)| 00:00:01 |
    |*  3 |   TABLE ACCESS FULL| T2   |     3 |    39 |     2   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - filter("T1"."ID"<>"T2"."ID")
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    -- gather statistics
    exec dbms_stats.gather_table_stats(user, 'T1')
    exec dbms_stats.gather_table_stats(user, 'T2')
    
    -- with statistics (we see the 4 * 4 = 16 rows we expect)
    ---------------------------------------------------------------------------
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |      |    16 |    96 |    13   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS      |      |    16 |    96 |    13   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| T1   |     4 |    12 |     4   (0)| 00:00:01 |
    |*  3 |   TABLE ACCESS FULL| T2   |     4 |    12 |     2   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - filter("T1"."ID"<>"T2"."ID")
    

    The filter says that operation 3 complete analysis results are filtered by the given condition. If we had clues you might see an access descriptor.

    Concerning

    Martin Preiss

  • Cannot run explain plan with sqldeveloper 1.5.1 against a 9.2 database

    Hello
    When I try to run explain plan in sqldeveloper, I get this message:

    "Invalid column name cannot the plan_table query."

    on my laptop, I have a 10g XE database and it works perfectly

    Is this due to the fact that the plan_table structures are different in 10g and 9i?

    Is there a solution or a workaround to make the explain command plan to work with the 9.2 database?

    Thank you for helping me.

    Concerning
    Jean-Yves

    Versions:

    SqlDeveloper:
    CV Version inside Oracle SQL Developer (client only)
    Java (TM) Platform 1.5.0_06
    Oracle IDE 1.5.1.54.40
    Support versioning 1.5.1.54.40

    database:
    Oracle9i Release 9.2.0.6.0 - Production
    PL/SQL Release 9.2.0.6.0 - Production
    "CORE 9.2.0.6.0 Production."
    AMT for Linux: release 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production

    Hello..

    Why, you can't recreate it... you need not additional privileges to do that, yo just need privilege to create the table.

    It comes to my table plan 9i structure...

    9i> desc PLAN_TABLE ;
     Name                                                  Null?    Type
     ----------------------------------------------------- -------- ------------------------------------
     STATEMENT_ID                                                   VARCHAR2(30)
     TIMESTAMP                                                      DATE
     REMARKS                                                        VARCHAR2(80)
     OPERATION                                                      VARCHAR2(30)
     OPTIONS                                                        VARCHAR2(255)
     OBJECT_NODE                                                    VARCHAR2(128)
     OBJECT_OWNER                                                   VARCHAR2(30)
     OBJECT_NAME                                                    VARCHAR2(30)
     OBJECT_INSTANCE                                                NUMBER(38)
     OBJECT_TYPE                                                    VARCHAR2(30)
     OPTIMIZER                                                      VARCHAR2(255)
     SEARCH_COLUMNS                                                 NUMBER
     ID                                                             NUMBER(38)
     PARENT_ID                                                      NUMBER(38)
     POSITION                                                       NUMBER(38)
     COST                                                           NUMBER(38)
     CARDINALITY                                                    NUMBER(38)
     BYTES                                                          NUMBER(38)
     OTHER_TAG                                                      VARCHAR2(255)
     PARTITION_START                                                VARCHAR2(255)
     PARTITION_STOP                                                 VARCHAR2(255)
     PARTITION_ID                                                   NUMBER(38)
     OTHER                                                          LONG
     DISTRIBUTION                                                   VARCHAR2(30)
     CPU_COST                                                       NUMBER(38)
     IO_COST                                                        NUMBER(38)
     TEMP_SPACE                                                     NUMBER(38)
     ACCESS_PREDICATES                                              VARCHAR2(4000)
     FILTER_PREDICATES                                              VARCHAR2(4000)
    

    There is the script utlxplan.sql to 9i

    create table PLAN_TABLE (
            statement_id    varchar2(30),
            timestamp       date,
            remarks         varchar2(80),
            operation       varchar2(30),
            options         varchar2(255),
            object_node     varchar2(128),
            object_owner    varchar2(30),
            object_name     varchar2(30),
            object_instance numeric,
            object_type     varchar2(30),
            optimizer       varchar2(255),
            search_columns  number,
            id              numeric,
            parent_id       numeric,
            position        numeric,
            cost            numeric,
            cardinality     numeric,
            bytes           numeric,
            other_tag       varchar2(255),
            partition_start varchar2(255),
            partition_stop  varchar2(255),
            partition_id    numeric,
            other           long,
            distribution    varchar2(30),
            cpu_cost        numeric,
            io_cost         numeric,
            temp_space      numeric,
            access_predicates varchar2(4000),
            filter_predicates varchar2(4000));
    
  • Difference of cardinality estimate on explain plan and implementation plan

    I think some of you know the 5% rule, which is explained in the note on metalink # 68992.1.
    In short, this means that (with bind peeking out voltage)
    - c1 > :b1 : 5% of selectivity
    - c1 >= :b1 :5% of selectivity
    - c1 between :b1 and :b2 : 0.25% of selectivity (5% * 5%)
    It is also well explained fundamentals of the CBO by Jonathan Lewis.

    But I found a few odd cases where the 5% rule is broken DURATION estimate.
    The most interesting part is explain plan watch again the 5% rule.
    Why the difference?

    I think that with bind peeking out, explain the plan and the implementation plan should show the same things.
    (Assuming that all values of the environment are identical)
    Am I wrong?

    It's the long story to tell, but simple test cases will show what I mean.
    UKJA@ukja102> @version
    
    BANNER
    ---------------------------------------------------------------------
    ---------------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    
    UKJA@ukja102>
    UKJA@ukja102> set echo on
    UKJA@ukja102>
    UKJA@ukja102> drop table t1 purge;
    
    Table dropped.
    
    Elapsed: 00:00:00.09
    UKJA@ukja102>
    UKJA@ukja102> create table t1(c1 int, c2 int)
      2  ;
    
    Table created.
    
    Elapsed: 00:00:00.01
    UKJA@ukja102>
    UKJA@ukja102> insert into t1
      2  select 1, level
      3  from dual
      4  connect by level <= 10000
      5  union all
      6  select 2, level
      7  from dual
      8  connect by level <= 1000
      9  union all
     10  select 3, level
     11  from dual
     12  connect by level <= 100
     13  union all
     14  select 4, level
     15  from dual
     16  connect by level <= 10
     17  union all
     18  select 5, level
     19  from dual
     20  connect by level <= 1
     21  ;
    
    11111 rows created.
    
    Elapsed: 00:00:00.32
    UKJA@ukja102>
    UKJA@ukja102> exec dbms_stats.gather_table_stats(user, 't1', method_opt=>'for all columns size 1');
    
    PL/SQL procedure successfully completed.
    * Disable bind peeking. *
    UKJA@ukja102>
    UKJA@ukja102> alter session set "_optim_peek_user_binds" = false;
    In the following result, explain the plan following the 5% rule.
    (11111 * 0.05 = 555)
    UKJA@ukja102>
    UKJA@ukja102> explain plan for
      2  select count(*)
      3  from t1
      4  where c1 > :b1
      5  ;
    
    Explained.
    
    Elapsed: 00:00:00.01
    UKJA@ukja102>
    UKJA@ukja102> @plan
    UKJA@ukja102> select * from table(dbms_xplan.display)
      2  /
    
    PLAN_TABLE_OUTPUT                                                              
    --------------------------------------------------------------------------------
    Plan hash value: 3724264953                                                    
                                                                                   
    ---------------------------------------------------------------------------    
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |    
    ---------------------------------------------------------------------------    
    |   0 | SELECT STATEMENT   |      |     1 |     3 |     6   (0)| 00:00:01 |    
    |   1 |  SORT AGGREGATE    |      |     1 |     3 |            |          |    
    |*  2 |   TABLE ACCESS FULL| T1   |   556 |  1668 |     6   (0)| 00:00:01 |    
    ---------------------------------------------------------------------------    
                                                                                   
    Predicate Information (identified by operation id):                            
    ---------------------------------------------------                            
                                                                                   
       2 - filter("C1">TO_NUMBER(:B1))                                             
    
    14 rows selected.
    
    Elapsed: 00:00:00.01
    But the term plan does'nt follow the 5% rule. It uses its own density
    (11111 * density (c1) = 11111 * 0.2 = 2222)
    UKJA@ukja102> select /*+ gather_plan_statistics */
      2    count(*)
      3  from t1
      4  where c1 > :b1
      5  ;
    
      COUNT(*)                                                                     
    ----------                                                                     
          1111                                                                     
    
    Elapsed: 00:00:00.00
    UKJA@ukja102>
    UKJA@ukja102> @stat
    UKJA@ukja102> select * from table
      2  (dbms_xplan.display_cursor(null,null,'allstats cost last'));
    
    PLAN_TABLE_OUTPUT                                                              
    --------------------------------------------------------------------------------
    SQL_ID  0nmqsysmr3ap9, child number 0                                          
    -------------------------------------                                          
    select /*+ gather_plan_statistics */   count(*) from t1 where c1 > :b1         
                                                                                   
    Plan hash value: 3724264953                                                    
                                                                                   
    --------------------------------------------------------------------------------
    ------------------                                                             
                                                                                   
    | Id  | Operation          | Name | Starts | E-Rows | Cost (%CPU)| A-Rows |   A-
    Time   | Buffers |                                                             
                                                                                   
    --------------------------------------------------------------------------------
    ------------------                                                             
                                                                                   
    |   1 |  SORT AGGREGATE    |      |      1 |      1 |            |      1 |00:00
    :00.01 |      23 |                                                             
                                                                                   
    |*  2 |   TABLE ACCESS FULL| T1   |      1 |   2223 |     6   (0)|   1111 |00:00
    :00.01 |      23 |                                                             
                                                                                   
    --------------------------------------------------------------------------------
    ------------------                                                             
                                                                                   
                                                                                   
    Predicate Information (identified by operation id):                            
    ---------------------------------------------------                            
                                                                                   
       2 - filter("C1">:B1)                                                        
                                                                                   
    
    18 rows selected.
    the 5% rule seems to be
    -applied to explain the plan always
    -applied at the level of enforcement only when density 5 < %. When the density > 5%, he uses the density not 5%

    I'm not sure it's a designed feature or a bug.
    But estimates of different cardinality explain a plan and DURATION (with bind peeking out voltage) is not that desirable thing.


    One's opinion on this?

    Dion Cho

    Sorry to take some time to get back on this one.

    I can reproduce your results in 10.2.0.1, but the anomaly is not present in 9.2.0.8 and 10.2.0.3 and 11.1.0.6.
    As Charles, the calculation has a boundary condition when a num_diistinct falls below 20
    (i.e. when a value is more than 5% of the total data set - average).

    However, the fact that explain the plan and the run time you give estimates of different cardinality is a bug.
    Everything they say, they should say the same thing at least that the introduction of the variable binding
    introduced a possible type conversion or the NLS conversion feature that has changed the
    calculation of the expected cardinality. In this case there is no reason why the use of links should be
    cause confusion - so we can reasonably assume that it is a bug.

    Concerning
    Jonathan Lewis
    http://jonathanlewis.WordPress.com
    http://www.jlcomp.demon.co.UK

    "The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge." (Stephen Hawking)

  • How to preserve the multi-level iPhoto in Photos folder directory

    If you upgrade OS to Yosemite or El Capitan, how to preserve my folder customized Photos iPhoto multi-level directory? My iPhoto library is 105 GB and contains 41 000 photos, all carefully arranged in a directory of custom and subsidiary subjects.

    iPhoto (the beloved and only) has a great power in its ability to custom folders full of full of albums etc. subfolders directories several levels deep, with photos that can be duplicated in different albums, folder & file size info, etc. Unless this can all be kept in the Photos, there is no point me upgrading until Apple gets serious on the needs of demanding photographers, who want the custom control and want as their stuff protected in their hard drive and not on the cloud. Automatically generated 'events' and 'albums' are things of grandmother-and-the-children, useless for people like me. I need a custom control over making inventories of multiple folder levels based on my own custom categories, categories or undated events Apple thinks we should have. Home, school, family, travel, etc. just does not cut it!

    Someone really aware with this situation can help me get clarity? Promo stuff on pictures Apple responds to virtually none of my questions.

    I would like to begin by asking in the forum of Photos, but until you do, you need to specify your terminology. iPhoto offers events, Albums, and smart Albums for the organization. Thus, by "directories" I can only imagine say you you have files of records nested within other folders? If so, you can do with Photos. There is no need to use the features of cloud Photos. They are not mandatory in any mode.

    Regarding your comment, if you're a serious photographer why you use iPhoto? Make sure you used Apple app for photographers, it was called Aperture. Now for photographers you use applications 3rd party - Lightroom, Capture One etc.

  • Explain the explain plan

    decide to move to optimization soon. Book says join faster that the subquery in this example because the analyses involved. The "cost" to the subquery appears lower than the cost for the join. So it is confusing to me - aka How should I be interpreting this.

    Plan of subquery:

    image2.png.jpg

    join plan

    image2.png.jpg

    as you can see that the plan for the subquery has less than a cost. Could someone explain these outputs as to which application is more effective. I need to start somewhere.

    Thank you!

    The BEST way to get help when you ask questions is:

    1 ask questions on SPECIFIC things

    2. tell us EXACTLY what term, value, etc. ask abaout

    Book says join faster that the subquery in this example because the analyses involved. The "cost" to the subquery appears lower than the cost for the join. So it is confusing to me - aka How should I be interpreting this.

    OK - what BOOK are you talking about? There is not much interest to mention a book if you're not going to tell us which book it and provide a link to it and even a page number. This gives us the SCOPE of your question.

    This "cost for the subquery" are you talking about? Be specifc. It is in one of the plans that you posted? What plan? Whose cost is it? For example, you could say:

    I have a question for the foreground below. Why is the cost to the xx line lower than the cost of the second plan on line AA?

    This question refers CLEARLY to the info we're talking. The way in which you stating the question, we try to guess what plan and the lines you want to say.

    subquery plan:
    
    
    join plan
    
    
    as you can see the subquery plan has less of a cost. Could someone explain from these outputs as to which query is more efficient. I need to start from somewhere.
    

    Are you talking about line #1 in each of these plans?

    Please edit your post and tell us EXACTLY what you ask in the topic and refer to values and SPECIFIC lines. Also post a link to the book and a reference to a page number you got the information from.

    The optimizer generally chooses the REAL implementation with the lowest cost plan. It is not clear whether the plans that you have posted are ACTUAL spending plans that Oracle really determined and used or just explain plans.for what Oracle thought it might use.

    If the statistics are not up-to-date these plans do not yet reflect the reality of the data.

    And if the amount of data is a small number of blocks or other of these plans can run better than the other in reality.

    You can find this Oracle white paper "Explain the Plan explaining" useful

    http://www.Oracle.com/technetwork/database/bi-Datawarehousing/TWP-explain-the-explain-plan-052011-393674.PDF

  • Need to explain Plan output in HTML format

    Hello

    I have details slider sqlid and child. And I'm able to generate explain plan SQL running as below

    SELECT * FROM table (DBMS_XPLAN. DISPLAY_CURSOR('xxxxxxxxxxxxxx',0,'ALLSTATS'));

    I need send the output of this customer. and the problem is the customer wants in HTML format. Advice to reel in HTML format

    concerning

    Pravin

    You can always query the PLAN_TABLE directly, and use SQL * more to empty in HTML.

    Another option is to do this with SQL Developer. Paste the SQL statement into the worksheet, and then press the explain Plan. When you see the plan, right-click on it and choose export as HTML.

    See you soon,.
    Brian

  • Need help with understanding explain plan

    Hi all

    I'm trying to understand the subject of the explain Plan, and while I was reading a document and from there I found one of the query that is below:

    Query

    SELECT A.customer_name,

    Count (distinct b.invoice_id) 'open invoices. "

    Count (c.invoice_id) "open invoice".

    Clients has,

    b invoices,

    c invoices_items

    WHERE b.invoice_status = 'OPEN'

    AND A.customer_id = b.customer_id

    AND c.invoice_id (+) = b.invoice_id

    A.customer_name GROUP

    Explain Plan

    See attached file...

    explain_plan.JPG

    I appreciate if someone explain this attached plan really explain in detail for my purpose of learning. Thanks in advance

    Concerning

    Muzz

    I'm trying to understand the subject of the explain Plan

    Excellent!

    I suggest you just started reading the book of Maria Colgan white "Explain the explain Plan".

    http://www.Oracle.com/technetwork/database/bi-Datawarehousing/TWP-explain-the-explain-plan-052011-393674.PDF

    This white paper examines the different lines, you will see in a plan and what they mean.

  • Explain plan for select distinct

    I got 1 of the online test and there the question has been asked. I have already answered but curious to cross-check my response with your advice...

    Question

    Explain what information plan if the show room in SQL indicates that a separate select statement is made in the SQL.


    The choices are:

    Sort by a join

    b sort by

    c single fate

    d sort aggregate

    group e - sort by

    My answer

    I gave aggregates of SORT but it seems that his unique kind, because when I run explain plan then I see (unique) hash. Please guide


    SEPARATE will identify unique rows. So in the given choice it would be KIND of UNIQUE. But oracle could go other plans as UNIQUE HASH or same INDEX FULL SCAN.

    Look at the oracle does not SORT.

    SQL> select distinct ename from emp;
    ENAME
    ------
    SMITH
    BLAKE
    CLARK
    KING
    ADAMS
    TURNER
    ALLEN
    SCOTT
    JONES
    MARTIN
    WARD
    11 rows selected.
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    ---------------------------------------------------------------------------------
    SQL_ID  6b32yqumjmp9b, child number 0
    -------------------------------------
    select distinct ename from emp
    Plan hash value: 984151148
    ---------------------------------------------------------------------------
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |      |       |       |     3 (100)|          |
    |   1 |  HASH UNIQUE       |      |    11 |    66 |     3  (34)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| EMP  |    11 |    66 |     2   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    
    14 rows selected.
    

    Let me make an explicit ORDER BY for her to performa SORT.

    SQL> select distinct ename from emp order by 1;
    ENAME
    ------
    ADAMS
    ALLEN
    BLAKE
    CLARK
    JONES
    KING
    MARTIN
    SCOTT
    SMITH
    TURNER
    WARD
    11 rows selected.
    SQL> select * from table(dbms_xplan.display_cursor);
    PLAN_TABLE_OUTPUT
    -------------------------------------------------------------------------------
    SQL_ID  f72vjx5rmm0z4, child number 0
    -------------------------------------
    select distinct ename from emp order by 1
    Plan hash value: 725351111
    ---------------------------------------------------------------------------
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |      |       |       |     4 (100)|          |
    |   1 |  SORT UNIQUE       |      |    11 |    66 |     3  (34)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| EMP  |    11 |    66 |     2   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    
    14 rows selected.
    SQL>
    

    Version - 10.2.0.5.0

  • Understanding explain plan

    Hi gurus

    I try to explain the plan and referring to the link that http://docs.oracle.com/database/121/TGSQL/tgsql_interp.htm#TGSQL277understand/learn, see below for more details:

    1st step

    EXPLAIN PLAN

    SET statement_id = "ex_plan1" FOR

    SELECT phone_number

    Employees

    WHERE phone_number AS 650% ';

    step 2

    SELECT PLAN_TABLE_OUTPUT

    TABLE (DBMS_XPLAN. DISPLAY (NULL, 'ex_plan1', 'BASIC'));

    Output

    PLAN_TABLE_OUTPUT

    Hash value of plan: 1445457117

    ---------------------------------------

    | ID | Operation | Name |

    ---------------------------------------

    |   0 | SELECT STATEMENT |           |

    |   1.  TABLE ACCESS FULL | EMPLOYEES |

    ---------------------------------------

    If you have watched the plan explained above then in operation, he leads shows TABLE ACCESS FULL.

    Let's see now another for we explain with other data, see below

    Step 3

    EXPLAIN PLAN

    SET statement_id = "ex_plan2" FOR

    SELECT last_name

    Employees

    WHERE name LIKE '% Pe;

    Step 4

    SELECT PLAN_TABLE_OUTPUT

    TABLE (DBMS_XPLAN. DISPLAY (NULL, 'ex_plan2', 'BASIC'));

    Output

    PLAN_TABLE_OUTPUT

    Hash value of plan: 3085132068

    ----------------------------------------

    | ID | Operation | Name |

    ----------------------------------------

    |   0 | SELECT STATEMENT |             |

    |   1.  INDEX RANGE SCAN | EMP_NAME_IX |

    ----------------------------------------

    First Question:
    When I run the sql below:

    SELECT phone_number

    Employees

    WHERE phone_number AS 650% ';

    so why does it display FULL TABLE ACCESS

    on the other hand, when I have executed under SQL:

    SELECT last_name

    Employees

    WHERE name LIKE '% Pe;

    so why it shows INDEX RANGE SCAN even the two queries by using like operator.

    2nd question

    In step 4 in the section operation, what is the meaning of the INDEX RANGE SCAN?

    3rd issue

    In step 4, under the name of topic, what is the meaning of EMP_NAME_IX?

    Thanks in advance

    Concerning

    Shu


    All this would be in the documentation.

    The second query uses a different plan because there was a clue on last_name.

    Index range scan is exactly what it sounds like - it scans the index to find the appropriate values

    emp_name_ix is the name of the index that it scans.

  • SQL not using indexes at runtime, but by using the index in "explain plan".

    Hi all

    I am facing a problem here that I don't get to think.

    I have a SQL that makes a FULL ACCESS of TABLE into two tables and its costs are very high, but it occurs only when I run it in my program (I saw it in the session trace). If I do a "explain plan" sqlplus (SQL Navigator or PLSQL Developer) it shows that he use indexes and have a low cost. I already checked the statistics from both tables, and they are up to date.

    Did someone never facing a similar problem or knows something I can do to find my problem?

    Thank you all very much.

    Hello

    As far as I KNOW, optimizer Oracle never guarantees that an Index scan in query explain plan will be necessarily used during query execution.

    ORACLE-BASE - DBMS_XPLAN: Oracle display execution Plans

    Could you please read the above, run the query, as described and check the execution using DBMS_XPLAN plan. The cursor cache DISPLAY_CURSOR and not PLAN_TABLEs.

Maybe you are looking for

  • I get several copies of e-mails on the e-mail messages that have an attachment

    Several times, I received 10 or more replicate emails. Both these emails contained had an attachment that are pdf files. Currently no other emails are coming through except a recurring email which continues to be downloaded.

  • iMac beachballing _ log messages

    Hello Our hard drive has been replaced. Everything was fine for a while. Lately is beachballing spells, including some long, most during the scrolling of FB. All advice appreciated. Thank you, John Examples of messages is here tonight: 10/06/16 8:46:

  • Issue of PIN entry

    I'm having a strange problem when you enter a PIN code for unlocking. It is an intermittent problem as well. When I type in my 4-digit PIN, sometimes he jumps on a number, I have input. It's always the same # 4. I know I'm hitting well because I get

  • After 3 attempts of my presario c700 gives me this no.85374984 with system disable

    Compaq Presario c700. Problems led me to problems even more. Started with 'DPS' won't start do not. Unsuccessful attempts, generalized to have to re install. But the PC doesn't let me do many things. Dependencies DPS, .eg; can not save, fire wall, no

  • HDMI problems

    I have a laptop HP DV5, that I had connected to the TV in the past using the HDMI cable I got screen and audio that all fine now it has stopped working. When I plug in the laptop screen flashes about 3 times then TV has no signal. How can I get the H