Read and understand execution Plans

Hello
in 10g R2 documentation (Database Performance Tuning Guide)
I read:
 
13.4.2 Reading and Understanding Execution Plans 

The execution order in EXPLAIN PLAN output begins with the line that is the furthest indented to the right. The next step is the parent of that line. If two lines are indented equally, then the top line is normally executed first. 

Example 13-2 EXPLAIN PLAN Output 

----------------------------------------------------------------------------------- 
| Id  | Operation                     |  Name        | Rows  | Bytes | Cost (%CPU)| 
----------------------------------------------------------------------------------- 
|   0 | SELECT STATEMENT              |              |     3 |   189 |    10  (10)| 
|   1 |  NESTED LOOPS                 |              |     3 |   189 |    10  (10)| 
|   2 |   NESTED LOOPS                |              |     3 |   141 |     7  (15)| 
|*  3 |    TABLE ACCESS FULL          | EMPLOYEES    |     3 |    60 |     4  (25)| 
|   4 |    TABLE ACCESS BY INDEX ROWID| JOBS         |    19 |   513 |     2  (50)| 
|*  5 |     INDEX UNIQUE SCAN         | JOB_ID_PK    |     1 |       |            | 
|   6 |   TABLE ACCESS BY INDEX ROWID | DEPARTMENTS  |    27 |   432 |     2  (50)| 
|*  7 |    INDEX UNIQUE SCAN          | DEPT_ID_PK   |     1 |       |            | 
----------------------------------------------------------------------------------- 
You would be kind to tell me:
In the example above:

Is step 5 in the first run because it is the most right?

Step 4 is the parent of step 5?

Step 4 is executed just after step 5 as its parent?

If I'm totally wrong:
What stage is executed first?
The two steps are PARENT/CHILD?

Thank you.

Step 3, the FullTableScan of EMPLOYEES would be the first step must be performed. The results of EMPLOYEES joined JOBS in step 2 by analyzing the OFFERS by JOB_ID_PK.
Therefore, step 5, the Index Scan of JOB_ID_PK would be the second step must be performed.
Step 4, access to the WORK of the Table would be the third step must be performed.
Due to PreFetching implemented in 10 g, step 7 and 6 DEPARTMENTS is also from 'start' to be ready to join in the result set of the join of the EMPLOYEES JOBS.

Hemant K Collette
http://hemantoracledba.blogspot.com

Tags: Database

Similar Questions

  • Help me explain Plan of reading and understanding

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
    SELECT SRC2.PGM_MSTR_NBR,
                                                  SRC2.PGM_TRK_NBR,
                                                  SRC2.CNTL_LOCN,
                                                  SRC2.PGM_NAME,
                                                  SRC2.PGM_STS,
                                                  SRC2.SIS_PGM_START_DATE,
                                                  SRC2.SIS_PGM_END_DATE,
                                                  SRC2.AWARD_TRGT,
                                                  SRC2.AWARD_MAX,
                                                  SRC2.COMPLNC_TYPE,
                                                  SRC2.CMPNY_VNDR_LOCN,
                                                  SRC2.CMPNY_VNDR_NBR,
                                                  LKP3.ADDR_NAME,
                                                  SRC2.INV_IND,
                                                  SRC2.LAST_INV_THRU_DATE,
                                                  SRC2.INV_RPT_DAY,
                                                  SRC2.INV_RPT_CYCLE,
                                                  SRC2.BEG_COLL_DATE,
                                                  SRC2.END_COLL_DATE,
                                                  SRC2.SLS_CONT_DIST,
                                                  SRC2.SLS_CONT_NBR,
                                                  SRC2.ORD_INV_START_DATE,
                                                  SRC2.ORD_INV_END_DATE,
                                                  SRC2.CMPLNC_RPT_IND,
                                                  SRC2.PROD_ENTRY_LVL,
                                                  SRC2.DIST_ENTRY_LVL,
                                                  SRC2.CUST_ENTRY_LVL,
                                                  SRC2.VNDR_ENTRY_LVL,
                                                  SRC2.VNDR_CONT,
                                                  SRC2.SIS_CMPNY_VNDR_NBR
                                                  FROM CASADM.SBA_REB_PGM SRC2 
                                                  INNER JOIN(SELECT PGM_MSTR_NBR,PGM_TRK_NBR,CNTL_LOCN  FROM CASADM.ACCR_SIS_PURCH_DTL
                                                             UNION SELECT PGM_MSTR_NBR,PGM_TRK_NBR,CNTL_LOCN  FROM CASADM.ACCR_SIS_EXCL_DTL)ACCR2
                                                        ON  (SRC2.PGM_MSTR_NBR=ACCR2.PGM_MSTR_NBR AND SRC2.PGM_TRK_NBR=ACCR2.PGM_TRK_NBR AND SRC2.CNTL_LOCN=ACCR2.CNTL_LOCN)
                                                  LEFT OUTER JOIN
                                                            CASADM.MT_CMPNY_VNDR LKP3
                                                        ON (LKP3.CMPNY_VNDR_NBR=SRC2.CMPNY_VNDR_NBR);
    
    Record Count in each table:
    -----------------------------
    select count(*) from casadm.accr_sis_purch_dtl --375,968
    select count(*) from casadm.accr_sis_excl_dtl --1,988,867
    select count(*) from casadm.sba_reb_pgm --526,133
    select count(*) from casadm.mt_cmpny_vndr --20743
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1465316812
    
    --------------------------------------------------------------------------------
    
    ------------------------------
    
    | Id  | Operation                    | Name                  | Rows  | Bytes |TempSpc| Cost (%CPU)| Time|
    
    --------------------------------------------------------------------------------
    
    
    
    |   0 | SELECT STATEMENT             |                       |     9 |  1908 | | 26988   (2)| 00:06:18 |
    
    |   1 |  NESTED LOOPS OUTER          |                       |     9 |  1908 | | 26988   (2)| 00:06:18 |
    
    |*  2 |   HASH JOIN                  |                       |     9 |  1656 |83M| 26979   (2)| 00:06:18|
    
    |   3 |    TABLE ACCESS FULL         | SBA_REB_PGM           |   536K|    77M| |  2624   (2)| 00:00:37 |
    
    |   4 |    VIEW                      |                       |  2364K|    74M| | 16424   (2)| 00:03:50 |
    
    |   5 |     SORT UNIQUE              |                       |  2364K|    49M|72M| 16424  (86)| 00:03:50|
    
    |   6 |      UNION-ALL               |                       |       |       ||            |          |
    
    |   7 |       INDEX FAST FULL SCAN   | ACCR_SIS_PURCH_DTL_PK |   375K|  8077K||   871   (1)| 00:00:13 |
    |   8 |       TABLE ACCESS FULL      | ACCR_SIS_EXCL_DTL     |  1988K|    41M||  5634   (1)| 00:01:19 |
    
    |   9 |   TABLE ACCESS BY INDEX ROWID| MT_CMPNY_VNDR         |     1 |    28 | |     1   (0)| 00:00:01 |
    
    |* 10 |    INDEX UNIQUE SCAN         | MT_CMPNY_VNDR_PK      |     1 |       | |     0   (0)| 00:00:01 |
    
    --------------------------------------------------------------------------------------------------------
    
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("SRC2"."PGM_MSTR_NBR"="ACCR2"."PGM_MSTR_NBR" AND
                  "SRC2"."PGM_TRK_NBR"="ACCR2"."PGM_TRK_NBR" AND "SRC2"."CNTL_LOCN"=
    
    "ACCR2"."CNTL_LOCN")
    
      10 - access("LKP3"."CMPNY_VNDR_NBR"(+)="SRC2"."CMPNY_VNDR_NBR")
    
    
    Statistics
    ----------------------------------------------------------
            102  recursive calls
              0  db block gets
          34558  consistent gets
          23241  physical reads
             88  redo size
         531258  bytes sent via SQL*Net to client
           2760  bytes received via SQL*Net from client
            361  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
           5392  rows processed

    With respect to the HASH JOIN, there two operands a TABLE ACCESS FULL and VIEW. Oracle joins these results together based on the following predicate:

     2 - access("SRC2"."PGM_MSTR_NBR"="ACCR2"."PGM_MSTR_NBR" AND
                  "SRC2"."PGM_TRK_NBR"="ACCR2"."PGM_TRK_NBR" AND "SRC2"."CNTL_LOCN"="ACCR2"."CNTL_LOCN")
    

    The VIEW is the result of the union between the CASADM. ACCR_SIS_PURCH_DTL and CASADM. ACCR_SIS_EXCL_DTL o place access to the CASADM table. ACCR_SIS_PURCH_DTL Oracle was able to buy all the data of the index ACCR_SIS_PURCH_DTL_PK.

    The FULL ACCESS TABLE is exactly what said access to a table full of SBA_REB_PGM.

    The OUTSIDE of LOOPS IMBRIQUEES has two operands as the HASH JOIN. The way it works is for each result returned by the hash JOIN operation, it accesses the MT_CMPNY_VNDR_PK index, then the table that mt_cmpny_vndr based on the following predicate:

    10 - access("LKP3"."CMPNY_VNDR_NBR"(+)="SRC2"."CMPNY_VNDR_NBR")
    

    It would probably be useful for you to review the document following by Christian Antognini Interpreter of execution Plans as well.

  • How to read and understand the information in the event logs

    Hey Microsoft, I performed a task of Information on performance. I have several criticisms and doubtful window logs in Event Viewer that is as much affect performance. I don't understand all the information on how to deal with them as I have not very in computer science. Can you please tell me how I deal/delete and those to save using total evidence silly English. There is also an application firewall re being not recognized even if I have AVG and Works installed.

    Thanks for your help.

    OT: EVENT LOGS

    Hello LadyWilliamson,

    Click on this article which describes the event logs in Windows XP. Most of the information is still topical for Windows Vista and Windows 7.
    308427 KB - how to view and manage the event logs in Event Viewer in Windows XP

     
    Vijay B information should answer your other questions.

    Thank you

    Marilyn

  • Please read and understand the following question: When can I find pictures of screen shots of Vista ([i.e. the file where are stored the images])

    I need to see the image of screenshot of Vista.  Don't want to take them or save them or print them.  I don't have Vista.

    http://www.bing.com/
    http://www.Google.com/

    Go ahead!

  • Time of the value of a prepared statement and the differences in execution plan

    Hi guys... I have a doubt here that I was not able to specify the search on the internet.

    Is on prepared statements...

    When I do: con.prepareStatement (query);

    then the query is compiled and an execution plan is for this query on the database, I know. But what happens when I do con.close. Is the accessible yet statement caching other executions? to make this example:

    Suppose we are joining 20 tables and we have about 10 parameters for this query

    public ArrayList getData(String id1, String id2, String id 10) {       ArrayList response=new ArrayList();       Connection con=manager.getConnection();       String query="select name, phone, debtvalue, currency, etc from table1, table2, table3, table4, table20 where                           table1.id=table2.t1id and table2.id=table3.id and table2.fid=? and table1.fid=? and etc etc";//a big query       PreparedStatement pst=con.prepareStatement("select");       pst.setString (1, id1);       pst.setString (2, id2);       pst.setString (3, id3);       .       .       pst.setString (10, id10);       ResultSet rs=pst.executeQuery();       while (rs.next()) {               //do whatever and build the response ArrayList       }       rs.close();       pst.close();       return response; }

    Will be the compilation of the prepared statement and this execution plan is available for every performance of the getData method. Or a new plan of compilation and execution is calculated whenever I execute the method? Assuming that the running query takes a long time to maturity it its complexity and runs about 100 times a day in a production environment. It is advisable to use the prepared statement?

    Is the precompiled stuff avaible if I use a "" "NEW" "" said PreparedStatement with the same query?

    Thank you very much in advance for your answers...

    Published by: user4789473 on 25-mar-2013 17:14

    If you lose / close the statement prepared, Yes, you lose the ID. If you prepare again the same
    SQL, the DBMS must analyze the SQL code again, if to see if there is a query plan
    still/already existing for the DBMS session. According to the DBMS, it may or may not
    find/have/use plan, he created for the previous statement.

  • Interpretation of the predicate information and filter explain plan

    If anyone can help understand how the effects of operation predicate and filter execution plan.or how can I complete the transaction descriptor or filter chosen by the optimizer is not optimized.

    User445775,

    Paraphrasing I provided in my previous post was on page 74 of "fundamental Oracle cost-based.

    How the word explanation...

    Suppose you have a database table that contains all phone numbers and addresses of individuals in a State. A query is run to find user445775 in the city named 'Redmond '. Assume that the query looks like this:

    SELECT
      PHONE
    FROM
      PHONE_NUMBERS
    WHERE
      CITY = 'Redmond'
      AND FULL_NAME = 'user445775';
    

    Suppose that there is no index on the table. The DBMS_XPLAN would show two predicates applied during a comprehensive analysis of the filter - this probably indicates an ineffective path, especially if there are a very small percentage of people that match the WHERE clause on the table restrictions.

    Now, suppose that an index is created on the CITY column. The DBMS_XPLAN would show an access descriptor applied to the index on the CITY column and a predicate to filter on the table access by index for the FULL_NAME. We have eliminated a large number of possible lines by applying the predicate of access to directly access the rows with the city of interest and then filtered those names that were not "user445775". It is not terribly effective, especially if there are a large number of people to 'Redmond' which should be filtered.

    Now, suppose that we drop the index on the CITY column and create an index on the FULL_NAME column. The DBMS_XPLAN would show an access descriptor applied to the index on the FULL_NAME column and a predicate to filter on the table access by index for the CITY column. This could be a quite effective plan if there is only a few lines in the table with 'user445775' FULL_NAME, as a few lines will be ignored after access to the index to find those with CITY = 'Redmond '.

    Now, suppose that we drop the index on the FULL_NAME column and create a composite index over the CITY, FULL_NAME. The DBMS_XPLAN would show a predicate of access applied to the index on the columns of the CITY and FULL_NAME and it would not be a predicate to filter on the table access by index - in this case, it will reject all the lines once retrieved by index access.

    Page 211 "Troubleshooting Oracle performance" also shows a clear explanation of the predicates access and filter.

    Think of access predicates (on the index at least) as throwing the lines until they are retrieved from the disk (or memory) and filter predicates such as throwing the lines after they are retrieved from the disk (or memory).

    Charles Hooper
    IT Manager/Oracle DBA
    K & M-making Machine, Inc.

  • the two execution Plan

    Hello
    can you be kind to such me which is better and why (based on the columns of the execution Plan):
    Execution Plan A
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=17)
       1    0   SORT (AGGREGATE)
       2    1     INDEX (RANGE SCAN) OF 'TEST_IDX' (NON-UNIQUE) (Cost=2 Card=1 Bytes=17)
       3    2       SORT (AGGREGATE)
       4    3         FIRST ROW (Cost=2 Card=6 Bytes=60)
       5    4           INDEX (RANGE SCAN (MIN/MAX)) OF 'TEST_IDX' (NON-UNIQUE) (Cost=2 Card=1060)
    
    tkprof gek1_ora_16520.trc gek1_ora_16520.out explain=scott/tiger sort=exeela sys=no
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          2          0           0
    Fetch        2      0.00       0.00          0          2          0           1
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        4      0.00       0.00          0          4          0           1 
    AND:
    Execution Plan B
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=13)
       1    0   COUNT (STOPKEY)
       2    1     VIEW (Cost=2 Card=6 Bytes=78)
       3    2       INDEX (RANGE SCAN DESCENDING) OF 'TEST_IDX' (NON-UNIQUE) (Cost=2 Card=6 Bytes=102) 
    
    tkprof gek1_ora_16521.trc gek1_ora_16521.out explain=scott/tiger sort=exeela sys=no
    
    call     count       cpu    elapsed       disk      query    current        rows
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    Parse        1      0.03       0.06          2         41          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        2      0.00       0.00          0          2          0           1
    ------- ------  -------- ---------- ---------- ---------- ----------  ----------
    total        4      0.03       0.06          2         43          0           1 
    Thank you.

    What is the version of db? Why you have not posted the actual queries as well? In a very generic view, the first is more beautiful, but is purely based on the elapsed time. What you are actually looking for?

    HTH
    Aman...

  • How to understand the implementation of the plan in oracle I mean if I see two implementation plans for a single sql_id plans 2 How to determine the best execution plan? Links and answers are much appreciated. Thank you

    How to understand the implementation of the plan in oracle I mean if I see two implementation plans for a single sql_id plans 2 How to determine the best execution plan? Links and answers are much appreciated. Thank you

    How to understand the implementation of the plan in oracle I mean if I see two implementation plans for a single sql_id plans 2 How to determine the best execution plan? Links and answers are much appreciated. Thank you

    After two execution plans that have the same sql_id, so we can see what you're talking about.

    See "Oracle Explain Explain Plan optimizer" by Maria Colgan of the Oracle optimizer group

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

    Examine the various aspects of a selectivity to parallel execution plan

    performance and understand what information you should be brilliant

    the plan can be overwhelming even for the most experienced DBA. This document

    offers a detailed explanation on each of the aspects of the execution plan and a

    Overview of what caused the CBO to make the decision, he did.

  • I use Adobe Reader and Adobe Acrabat (If Yes, there is difference) and I have been a Sony tablet. I use a PDF file as a lesson plan, normally to just open the document and it moves automatically to 'recent' in 'my documents '.

    I use Adobe Reader and Adobe Acrabat (if there is no difference) and I have been a Sony tablet. I use a PDF file as a lesson plan, normally to just open the document and it moves automatically to 'recent' in 'my documents '. But when I close this document in particular I need to find it in my downloads and open again in Adobe, but the changes I made are not here obviously? How can I move an item in the recent myself? Help, please!

    Hello

    What is the operating system on your Sony Tablet?  Windows or Android?  What is the version of the operating system?

    Your documents are stored on your device or on the cloud (Cloud Document Adobe, Adobe Creative Cloud) storage.

    Please note that the recent section displays the local and cloud the documents you have open/read recently.  Player does not physically move/transfer local or documents to the recent Division of clouds.

  • difference between the execution plan and explain the plan?

    What is the difference between the execution plan & explain the plan?

    an execution plan is the actual steps that oracle will pass by when it executes a query.

    explain plan is a tool that is used to generate the steps of an execution plan for a query.

  • Unable to understand the Plan to explain

    Hi gurus

    I'm trying to understand some basics of explain plan and get a hard time, I was reading the book tuning performance and incapable of understanding explain plan for the following query:

    Example query

    EXPLAIN PLAN FOR

    SELECT *.

    WCP

    WHERE THERE IS NOT (SELECT 0

    OF THE Department

    WHERE dept.dname = 'SALES' AND dept.deptno = emp.deptno)

    AND NOT EXISTS (SELECT 0

    Bonus OF

    WHERE bonus.ename = emp.ename);

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

    Select * from table (dbms_xplan.display);

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

    Output

    Hash value of plan: 734347697

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

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

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

    |   0 | SELECT STATEMENT |       |     5.   290.     7 (15) | 00:00:01 |

    |*  1 |  HASH ANTI JOIN |       |     5.   290.     7 (15) | 00:00:01 |

    |*  2 |   HASH ANTI JOIN |       |     5.   255.     5 (20) | 00:00:01 |

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

    |*  4 |    TABLE ACCESS FULL | DEPT |     1.    13.     2 (0) | 00:00:01 |

    |   5.   TABLE ACCESS FULL | BONUS |     1.     7.     2 (0) | 00:00:01 |

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

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

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

    1 - access("BONUS".") ENAME "=" EMP ". ("' ENAME ')

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

    4 - filter("DEPT".") DNAME "= 'SALES')

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

    Grateful if someone help out me. Thank you

    In addition, I really appreciate if someone proposes a simple tutorial to explain plan. Thanks again

    Concerning

    Shu

    Hi Shuumail,

    Here is the tutorial http://allthingsoracle.com/execution-plans-part-1-finding-plans/

  • Why I have an execution plan

    Hello

    I do not understand why this sql has a bad execution plan?

    SELECT DISTINCT LETTER0_. LE_IDENT AS col_0_0_

    THE LETTER LETTER0_

    LEFT OUTER JOIN CONTEXT1_ CONTEXT

    ON LETTER0_. LE_PTRCTXID = CONTEXT1_. CTX_IDENT

    LEFT OUTER JOIN F_DOC f_doc2_

    ON LETTER0_. LE_PTRDOCID = f_doc2_. DOC_IDENT

    WHERE LETTER0_. LE_IDENT IN

    (SELECT LETTER3_. LE_IDENT

    THE LETTER LETTER3_, CONTEXT CONTEXT4_

    WHERE LETTER3_. LE_PTRCTXID = CONTEXT4_. CTX_IDENT

    AND CONTEXT4_. CTX_PTRPOLID = 400728434)

    OR LETTER0_. LE_IDENT IN (2525432);

    Execution plan

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

    0 SELECT optimizer Mode STATEMENT = ALL_ROWS (cost = card 175 = 14 K bytes = 83 K)

    1 FILTER 0

    2 1 INDEX FULL SCAN PROSHIVA1. PK_LE_CLE (cost = card 175 = 284 K bytes = 1 M)

    3 1 LOOPS IMBRIQUEES (cost = 4 cards = 1 bytes = 22)

    TABLE 3 ACCESS BY INDEX ROWID PROSHIVA1 4. F_LETTRES (cost = 2 card = 1 bytes = 13)

    5 4 INDEX UNIQUE PROSHIVA1 SCAN. PK_LE_CLE (cost = 1 card = 1)

    6 TABLE ACCESS BY INDEX ROWID PROSHIVA1 3. F_CONTEXT (cost = 2 card = 1 bytes = 9)

    7 6 INDEX RANGE SCAN PROSHIVA1. IND_CTX_PTRPOLID (cost = 1 card = 1)

    Statistics

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

    5 user calls

    0 physical total bytes read

    physical write 0 total bytes

    0 3 spare statistics

    0 commit failures of drain plug: can not pin

    Extension of TBS 0: extended bytes

    0 total number of times SMON post

    SMON 0 posted for undo segment recovery

    SMON 0 posted to drop the temp segment

    prealloc segment 0 tasks

    1 rows processed

    9f9cf8b7-e5bc-4AAF-B369-b189dadb9d77 wrote:

    Thanks for the reply

    due to the second line of the execution plan. INDEX FULL SCAN PROSHIVA1. PK_LE_CLE (cost = card 175 = 284 K bytes = 1 M).

    This sql takes 2 seconds. and if I remove any OF the sql condition. There are only 200 ms.

    This is a typical problem optimizer - IN / associate EXISTS OR does work well in many cases. Most likely, if you simply specify the IN clause, the optimizer will unnest subquery, which could be much faster in this case.

    Furthermore, the optimizer has already done a good job in eliminating unnecessary outer joins, there is no mention of CONTEXT or F_DOC in the source line of the FILTER operator. He even eliminated the SEPARATE, most likely because he knows that LETTER. LE_IDENT is unique.

    Think of what the database has to do with your request - need to find matches which have the mentioned ID or who have a match in the specified list as subquery. So without more clever query processing, it must pass the primary key index set and check, for each line, if it is a match in the IN subquery - that's exactly what makes the FILTER operator, it executes the LOOP IMBRIQUEE join that represents the IN clause for each row returned by the full index scan.

    Ideally, this should be transformed by using a transformation of CONCATENATION, where this query is actually split in two: part of the research for the mentioned ID and the other party responsible for looking for matches with subqueries and this making, ensuring that the two branches do not result in duplicate (since a line could satisfy both conditions).

    You can try an explicit indication of USE_CONCAT for the query, but I doubt that the optimizer will do it automatically.

    So if it does not, you could do the same thing as a manual rewrite:

    SELECT LETTER0_. LE_IDENT AS col_0_0_

    THE LETTER LETTER0_

    WHERE LETTER0_. LE_IDENT = 2525432

    UNION ALL

    SELECT LETTER0_. LE_IDENT AS col_0_0_

    THE LETTER LETTER0_

    WHERE LETTER0_. LE_IDENT IN

    (SELECT LETTER3_. LE_IDENT

    THE LETTER LETTER3_, CONTEXT CONTEXT4_

    WHERE LETTER3_. LE_PTRCTXID = CONTEXT4_. CTX_IDENT

    AND CONTEXT4_. CTX_PTRPOLID = 400728434)

    AND LNNVL (LETTER0_. LE_IDENT = 2525432);

    The LNNVL is the bit that filter potential duplicates and which would be automatically generated by the transformation of the CONCATENATION.

    Randolf

  • 12 c parallel execution Plans

    Hello world

    I have a little a problem of performance on 12 c that gives me a little trouble at the head. I moved from 11 to 12 databases and no amendment of the application have been made. Our requests are generated somewhat dynamically, so that they are the same thing every time.

    Let's start with the execution plan I get:

    SQL > select * from table (dbms_xplan.display ());


    PLAN_TABLE_OUTPUT

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

    Hash value of plan: 3567104424

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

    | ID | Operation                                            | Name                  | Lines | Bytes | Cost (% CPU). Time |    TQ | IN-OUT | PQ Distrib.

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

    |   0 | SELECT STATEMENT |                       |    55.  7095 |  3764 (1) | 00:00:01 |        |      |            |

    |   1.  COORDINATOR OF PX |                       |       |       |            |          |        |      |            |

    |   2.   PX SEND QC (ORDER). : TQ10006 |    55.  7095 |  3764 (1) | 00:00:01 |  Q1, 06 | P > S | QC (ORDER).

    |   3.    SORT ORDER BY |                       |    55.  7095 |  3764 (1) | 00:00:01 |  Q1, 06 | SVCP |            |

    |   4.     PX RECEIVE                                       |                       |    55.  7095 |  3763 (1) | 00:00:01 |  Q1, 06 | SVCP |            |

    |   5.      RANGE OF SEND PX | : TQ10005 |    55.  7095 |  3763 (1) | 00:00:01 |  Q1, 05 | P > P | RANGE |

    |   6.       UNIQUE FATE |                       |    55.  7095 |  3763 (1) | 00:00:01 |  Q1, 05 | SVCP |            |

    |*  7 |        HASH JOIN                                     |                       |    55.  7095 |  3762 (1) | 00:00:01 |  Q1, 05 | SVCP |            |

    |   8.         PX RECEIVE                                   |                       |   801 | 50463 |  3696 (1) | 00:00:01 |  Q1, 05 | SVCP |            |

    |   9.          PX SEND HASH | : TQ10003 |   801 | 50463 |  3696 (1) | 00:00:01 |  Q1, 03 | P > P | HASH |

    | * 10 |           HASH JOIN                                  |                       |   801 | 50463 |  3696 (1) | 00:00:01 |  Q1, 03 | SVCP |            |

    |  11.            RECEIVE PX |                       |   801 | 40851 |  2333 (1) | 00:00:01 |  Q1, 03 | SVCP |            |

    |  12.             PX SEND BROADCAST | : TQ10002 |   801 | 40851 |  2333 (1) | 00:00:01 |  Q1, 02 | P > P | BROADCAST |

    |  13.              NESTED LOOPS |                       |   801 | 40851 |  2333 (1) | 00:00:01 |  Q1, 02 | SVCP |            |

    |  14.               KIND OF BUFFER.                       |       |       |            |          |  Q1, 02 | ISSUE |            |

    |  15.                RECEIVE PX |                       |       |       |            |          |  Q1, 02 | SVCP |            |

    |  16.                 PX SEND HASH | : TQ10000 |       |       |            |          |        | S > P | HASH |

    |  17.                  NESTED LOOPS |                       |   823. 31274 |  1509 (1) | 00:00:01 |        |      |            |

    | * 18.                   TABLE ACCESS BY ROWID INDEX BATCH | PAGED_LOOKUP_PKS |   500 |  9500 |     3 (0) | 00:00:01 |        |      |            |

    | * 19.                    INDEX RANGE SCAN | PAGED_LOOKUP_PKS_IDX2 |     1.       |     2 (0) | 00:00:01 |        |      |            |

    |  20.                   TABLE ACCESS BY ROWID INDEX BATCH | BILL_ITEM |     2.    38.     4 (0) | 00:00:01 |        |      |            |

    | * 21.                    INDEX RANGE SCAN | BILL_ITEM_FK2 |     4.       |     2 (0) | 00:00:01 |        |      |            |

    | * 22.               INDEX UNIQUE SCAN | PK_INSERTION |     1.    13.     1 (0) | 00:00:01 |  Q1, 02 | SVCP |            |

    |  23.            ITERATOR BLOCK PX |                       |  1548K |    17 M |  1353 (2) | 00:00:01 |  Q1, 03 | ISSUE |            |

    |  24.             FULL RESTRICTED INDEX SCAN FAST | BOOKING_ACCOUNT_1 |  1548K |    17 M |  1353 (2) | 00:00:01 |  Q1, 03 | SVCP |            |

    |  25.         PX RECEIVE                                   |                       | 22037 |  1420K |    65 (2) | 00:00:01 |  Q1, 05 | SVCP |            |

    |  26.          PX SEND HASH | : TQ10004 | 22037 |  1420K |    65 (2) | 00:00:01 |  Q1, 04 | S > P | HASH |

    |  27.           SELECTOR PX |                       |       |       |            |          |  Q1, 04 | SCWC |            |

    |  28.            TABLE ACCESS FULL | CONTACT | 22037 |  1420K |    65 (2) | 00:00:01 |  Q1, 04 | SCWP |            |

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

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

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

    7 - access ("ACCOUNT_ID" ="ACCOUNT_ID")

    10 - access ("BOOKING" ="BOOKING")

    18 - filter("T1".") SEQUENCE_NO' < 501 AND "T1". ("' SEQUENCE_NO" > = 1).

    19 - access("T1".") SESSION_ID '= 123456 AND 'T1'.' SEARCH_ID "= 25)

    21 - access("T1".") N1 "=" BILL_ID")

    22 - access ("BOOKING" = "BOOKING" AND "INSERTION_SET" = "INSERTION_SET" AND "INSERT"="INSERT")

    Note

    -----

    -the dynamic statistics used: dynamic sampling (level = 2)

    -This is an adaptation plan

    -2 directives Plan Sql used for this statement

    51 selected lines.

    Elapsed time: 00:00:00.15

    SQL > spool off

    OK, now let's go through the problem:

    1. It's a development running on a virtual server, and which hosts a few other databases, so the parallel execution is not a good thing. parallel_degree_policy is set to MANUAL, parallel_max_servers and all other parallel_ limits are set to 1 and tables have been changed with the settings of NOPARALLEL. So why is the execution plan always generated with all stages of parallel execution? I don't seem to get rid of in 12 c
    2. Next mystery is that the said plan of the explain command is an adaptation plan, and yet I put the true optimizer_adaptive_reproting_only
    3. Now to the problem of effective enforcement, so I'm playing around with all these settings. The query runs for 3-4 seconds, returning around about 500 cases. However, in some cases this same query with the same input variable races for hours and if I can believe the AWR and ASH reports, read a good 180 GB of data. The main wait event is direct path read temp temp and writing.


    This is not isolated to that one query. I have a few queries now that all display the same behavior, one of them running overnight. I don't seem to get to a standard nested loop execution plans.


    The entire base is a database plug-in and I don't know I just missed something in the new features Guide.

    Would appreciate some ideas.

    Thank you

    If you want to disable parallel execution, you must set parallel_max_servers to zero.  Maybe the optimizer thinks he can use a parallel plan because parallel_max_servers is non-zero (even though the number of slaves available means that it will be serialized to a parallel plan).

    Note that you have a ticket saying dynamic stats have been used.  Maybe you have a 11 for optimizer_dynamic_sampling setting, and allowing Oracle to be very inventive with collection of samples and parallelism.

    You have also 2 SQL instructions in game. These are the things that get associated with objects rather than the instructions, then perhaps someone has been playing with parallelism and managed to associate the parallelism with one of the tables in your query (I am not sure 100% that it is possible, just throw a suggestion).  Take a look at the SQL used for education guidelines.

    To give us a little more information, you can:

    Shoot memory execution plan dbms_xplan.display_cursor ({sql_id}, {number of children}, 'ALL'));

    We show all the parallel settings (see setting the parallel)

    Pull on the parameters of the optimizer for query memory (select name, value of V$ sql_optimizer_env where sql_id = {your sql identifier} and child_number = {your child number})

    Concerning

    Jonathan Lewis

  • Cost of the execution plan is different in the two databases

    Hi gurus,

    I have two databases, which are 12 C.

    The execution plan cost is different in the two databases for the same query.

    is it possible to copy the execution to another plan.

    Thank you in advance

    Kind regards

    REDA

    Jr.Raj wrote:

    There are a few differences.

    The machine that has a high cost, has setup up, linux, 2-node RAC, more CPU.

    and

    other machine windows server less Setup and less cpus.

    Please explain, cost really makes a difference.

    Thank you & best regards

    REDA

    You simply can't compare costs like that. It does not work like that. Especially through two different systems.  Here is a very good read: column the COST of the PLAN to EXPLAIN. Oracle FAQ

  • "Execution plan is not available" in OEM.

    Greetings. Try to watch my first Exec Plan here and make the message displayed above in OEM 11 g even executing simple statements like below. I googled this and see only one question without an answer identical to this.

    Thank you!

    explain plan for

    Select * from SCOTT. DEPT;

    Don't know why you're looking for a plan in OEM.

    * Connect to the base of data with the help of sqlplus and wwho and extract the map below;

    SQL > explain plan for select * from SCOTT. DEPT;

    SQL > SELECT * FROM TABLE (dbms_xplan.display);

    * Very easy, set autotrace on and run the query, you will get the plan and statistics;

    SQL > set autotrace

    Syntax: SET AUTOT [RACE] {OFF |} WE | TRACE [ONLY]} [EXP [LAIN]] [[C] STAT]

    SQL > set autotrace on

    SQL > select * from double;

    D

    -

    X

    Execution plan

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

    Hash value of plan: 272002086

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

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

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

    |   0 | SELECT STATEMENT |      |     1.     2.     2 (0) | 00:00:01 |

    |   1.  TABLE ACCESS FULL | DOUBLE |     1.     2.     2 (0) | 00:00:01 |

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

    Statistics

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

    1 recursive calls

    0 db block Gets

    Gets 2 compatible

    0 physical reads

    0 redo size

    522 bytes sent via SQL * Net to client

    523 bytes received via SQL * Net from client

    2 SQL * Net back and forth to and from the client

    0 sorts (memory)

    0 sorts (disk)

    1 rows processed

    HTH,

    Pradeep

Maybe you are looking for