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

Tags: Database

Similar Questions

  • 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.

  • info of parallel execution in the plan of the explain command

    In terms of explaining it, he learns you if a query is running in parallel? If so, what parts give you information about parallel execution?

    a parallel plan contains a large number of obvious differences if compared to a corresponding series plan: you should see a few operations beginning with the prefix of PX. In addition, it is more difficult to interpret a plane parallel (at least for me). Randolf Geist explains the basics (and more) in his informative article: parallel understanding - execution part 1.

  • Two parallel executions, calling a DLL function

    Hello

    Since this test takes about 6 hours to test my USE, I plan to use the parallel model to test 2 UUT at the same time in parallel.

    I implement the test code as a DLL of CVI.

    However, to my surprise, it seems that the steps that call a DLL function actually traveled in one series, not in parallel:

    Test 2 power outlets if one enters and executes a DLL works, the other waits for the first to complete its operation and return. While the other runs on the same copy of the DLL, so that the DLL global variables are actually shared between executions.

    So if a DLL will take 5 minutes to complete, two executions in the running at the same time take 10 minutes. This isn't a running in parallel in every way.

    What I want and expect also TestStand, was to completely isolate the copies of these two executions DLL such as test two casings could run at the same time the same DLL function by arbitrary executiong their copy of the function, completely isolated from one another.

    So they separated globals, discussions, etc., and two parallel jacks take 5 minutes to run a step, instead of 10.

    Such a scenario is possible?

    If not, how can I use my test in parallel (in truly parallel) when the use of 2-socket test?

    (1) Yes, he'll call the multiple executions in TestStand calling into the same dll in memory the same copy of this DLL. Thus dll called in this way must be thread-safe (that is written in a way that is safe for multiple threads running the code at the same time). This means usually avoiding the use of global variables among other things. Instead, you can store the thread shows in local variables within your sequence and pass it in the dll as a parameter as needed. Keep in mind all the DLLs your dll calls must also be thread-safe or you need to synchronize calls in other DLLs with locks or other synchronization primitives.

    1 (b) even if your dll are not thread-safe, you might still be able to get some benefits from parallel execution using the type of automatic planning step and split your sequence in independent sections, which can be performed in an order any. What it will do is allow you to run Test a socket A and B Test to another socket in parallel, and then once they are then perhaps test B will take place on one and test one run on the other. In this way, as long as each test is independent of the other you can safely run them in parallel at the same time even if it is not possible to run the same test in parallel at the same time (that is, if you can not run test on two Sockets at the same time, you might still be able to get an advantage of parallelism by running the Test B in one take during the tests in the other. See the online help for the type of step in autoscheduling for more details).

    (2) taken executions (and all executions of TestStand really) are threads separated within the same process. Since they are in the same process, the global variables in the dll are essentially shared between them. TestStand Station globals are also shared between them. TestStand Globals file, however, are not shared between runs (each run gets its own copy) unless you enable the setting in the movie file properties dialog box.

    (3) course, using index as a way to distinguish data access are perfectly valid. Just be careful that what each thread does not affect data that other threads have access. For example, if you have a global network with 2 elements, one for each grip test, you can use safely the decision-making of index in the table and in this way are not sharing data between threads even if you use a global variable, but the table should be made from the outset before start running threads , or it must be synchronized in some way, otherwise it is possible to have a thread tries to access the data, while the other thread is created. Basically, you need to make sure that if you use global data which the creation/deletion, modification and access in a thread does not affect the global data that the other thread use anyway in or we must protect these creation/deletion, modification and access to global data with locks, mutex or critical sections.

    Hope this helps,

    -Doug

  • There is a configuration option that allows the parallel execution of sub vi?

    I'm trying to run a vi in teststand has two parallel execution paths. A path under vi implements the trigger and wait for data from a module scope, while in the other lane, I'm starting a power supply. The power waits until the scope is armed and runs.

    It works as a standalone vi. When I try to run this vi in teststand he works the first vi scope and then runs the power supply. Of course vi opportunities get to expiration and outputs and data are not met.

    I tried a number of methods of synchronization, and although they seem to work standalone, as soon as I try them in Testsatnd I have this problem.

    I am new to teststand and I was wondering if there is some configuration config I missed which allows a vi like this to run as he's independent.

    I have a number of simple screws that run as planned, but this one left me speechless.

    I had to split these screws but would really prefer to have them in the same vi.

    (The latest versions of teststand and Labview running)

    Henry

    hkroker,

    It is a known problem. Please refer to the following KB to help solve your problem.

    - Parallel blocks run sequentially why does my LabVIEW VI when it is called from TestStand?

    Concerning

    Anand jegou

    National Instruments

  • The execution plan changes for the same query.

    Hi all

    This issue was raised before also, but still not able to find the real cause of this.

    Thread1:
    Re: Research of fragmentation of the table in Oracle 8.1.6.3.0

    Thread2:
    CBC latch and buffer busy await you on the same table.

    It comes, sometimes hammers server 100% CPU utilization with free latch and buffer busy wait events.

    We found a single query consumes high CPU usage that is run by different sessions.

    This query have two types of execution plans, where one is accurate and is not (its primary key hit index index no appropriate means present on the table)

    Because its primary key index hit repeatedly at various sessions, some sessions are powerful db file sequential read and a few sessions waiting buffer busy waits for event. Also during this time a few sessions waiting for latch free event.

    My doubt is how to sql even with different literal values execution plan changes and causes a prob.
    select count(*),event from v$session_wait group by event;
      COUNT(*) EVENT
    ---------- ----------------------------------------------------------------
           165 SQL*Net message from client
             1 SQL*Net message to client
             3 buffer busy waits
             2 db file parallel read
            18 db file sequential read
            10 latch free
             5 log file sync
             1 pmon timer
             6 rdbms ipc message
             1 smon timer
    
    SQL> select sid from v$session_wait where event='db file sequential read';
           SID
    ----------
            26
            58
            82
           107
           116
           223
           212
           203
           192
           173
           161
           157
           150
           147
           254
           238
           229
           112
           101
            81
            68
    
    SQL> select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=&SID;
    Enter value for sid: 161
    old   1: select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=&SID
    new   1: select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=161
    
    SPID             SID    SERIAL# PROGRAM
    --------- ---------- ---------- ------------------------------------------------
    4231             161      49569 oracle@tfrdb3 (TNS V1-V3)
    
    
    SQL> select sql_text
    from v$process a,
         v$session b,  2    3
         v$sql c
    where a.addr = b.paddr and
         b.sql_hash_value = c.hash_value and
        a.spid = &PID;  4    5    6    7
    Enter value for pid: 4231
    old   7:     a.spid = &PID
    new   7:     a.spid = 4231
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    SELECT ERROR,TIME_STAMP,O_RESOURCE,QUEUE,NEW_QUEUE FROM LOG WHERE ID = '09292AMR
    10B41FE' AND TYPE IN (11, 28, 25, 18, 60, 13) AND (LOG_SEQ>'234225222' OR TYPE =
     18 AND LOG_SEQ='234225222') ORDER BY TIME_STAMP ASC
    
    SQL> set autotrace traceonly exp
    SQL> SELECT ERROR,TIME_STAMP,O_RESOURCE,QUEUE,NEW_QUEUE FROM amrwf1.LOG WHERE ID = '09292AMR10B41FE' AND TYPE IN (11, 28, 25, 18, 60, 13) AND (LOG_SEQ>'234225222' OR TYPE =18 AND LOG_SEQ='234225222') ORDER BY TIME_STAMP ASC;
    
    Execution Plan
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=11 Card=2 Bytes=126)
       1    0   SORT (ORDER BY) (Cost=11 Card=2 Bytes=126)
       2    1     CONCATENATION
       3    2       TABLE ACCESS (BY INDEX ROWID) OF 'LOG' (Cost=4 Card=1
              Bytes=63)
    
       4    3         INDEX (UNIQUE SCAN) OF 'PK_LOG_LOG_SEQ' (UNIQUE) (Co
              st=3 Card=1)
    
       5    2       TABLE ACCESS (BY INDEX ROWID) OF 'LOG' (Cost=4 Card=1
              Bytes=63)
    
       6    5         INDEX (RANGE SCAN) OF 'PK_LOG_LOG_SEQ' (UNIQUE) (Cos
              t=3 Card=1)
    
    
    SQL> select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=&SID;
    Enter value for sid: 147
    old   1: select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=&SID
    new   1: select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=147
    
    SPID             SID    SERIAL# PROGRAM
    --------- ---------- ---------- ------------------------------------------------
    6255             147      38306 oracle@tfrdb3 (TNS V1-V3)
    
    SQL> select sql_text
    from v$process a,
         v$session b,
         v$sql c  2    3
    where a.addr = b.paddr and
         b.sql_hash_value = c.hash_value and
        a.spid = &PID;  4    5    6    7
    Enter value for pid: 6255
    old   7:     a.spid = &PID
    new   7:     a.spid = 6255
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    SELECT ERROR,TIME_STAMP,O_RESOURCE,QUEUE,NEW_QUEUE FROM LOG WHERE ID = '09273AMR
    62B4894' AND TYPE IN (11, 28, 25, 18, 60, 13) AND (LOG_SEQ>'223324996' OR TYPE =
     18 AND LOG_SEQ='223324996') ORDER BY TIME_STAMP ASC
    
    
    SQL> set autotrace traceonly exp
    SQL> SELECT ERROR,TIME_STAMP,O_RESOURCE,QUEUE,NEW_QUEUE FROM amrwf1.LOG WHERE ID = '09273AMR62B4894' AND TYPE IN (11, 28, 25, 18, 60, 13) AND (LOG_SEQ>'223324996' OR TYPE =18 AND LOG_SEQ='223324996') ORDER BY TIME_STAMP ASC;
    
    Execution Plan
    ----------------------------------------------------------
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=1538 Card=736 Bytes=
              46368)
    
       1    0   SORT (ORDER BY) (Cost=1538 Card=736 Bytes=46368)
       2    1     TABLE ACCESS (BY INDEX ROWID) OF 'LOG' (Cost=1527 Card=7
              36 Bytes=46368)
    
       3    2       INDEX (RANGE SCAN) OF 'LOG_ID' (NON-UNIQUE) (Cost=32 C
              ard=736)
    
    
    
    SQL> select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=&SID;
    Enter value for sid: 82
    old   1: select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=&SID
    new   1: select spid, sid, s.serial#, p.program from v$session s, v$process p where paddr=addr and sid=82
    
    SPID             SID    SERIAL# PROGRAM
    --------- ---------- ---------- ------------------------------------------------
    6172              82      45378 oracle@tfrdb3 (TNS V1-V3)
    
    
    SQL> select sql_text
    from v$process a,
         v$session b,
         v$sql c
    where a.addr = b.paddr and
         b.sql_hash_value = c.hash_value and  2
      3      a.spid = &PID;  4    5    6    7
    Enter value for pid: 6172
    old   7:     a.spid = &PID
    new   7:     a.spid = 6172
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F
    LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V
    002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010)
    
    INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F
    LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V
    002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010)
    
    INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F
    LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V
    002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010)
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    
    INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F
    LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V
    002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010)
    
    INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F
    LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V
    002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010)
    
    INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F
    LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V
    
    SQL_TEXT
    --------------------------------------------------------------------------------
    002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010)
    
    INSERT INTO LOG (ID,TIME_STAMP,TYPE,ERROR,INSTANCE,RULE_NUM,RULE_TYPE,PRIORITY,F
    LAGS,NAME,BATCH,O_RESOURCE,QUEUE,NEW_QUEUE,SERVER,FORM,WORKSET) VALUES (:V001,:V
    002,11,0,0,3,1,0,1,:V003,:V004,:V005,:V006,:V007,:V008,:V009,:V010)
    How to avoid this... why its different execution plan using (I mean bad index PK)

    Is it possible to avoid this?

    If any details please check out some of my previous post on this specific URL (above)

    -Yasser

    My doubt is how to sql even with different literal values execution plan changes and causes a prob.

    Different literal values cause analysis difficult.
    Hard analysis includes the re-evaluation of the best path.
    Literal value is included in the assessment of the selectivity for the scan interval (log_seq >...)

    See
    http://www.centrexcc.com/A%20Look%20under%20The%20Hood%20Of%20CBO%20-%20The%2010053%20Event.ppt.PDF
    http://www.centrexcc.com/fallacies%20Of%20The%20Cost%20Based%20Optimizer.PDF
    more the book of Jonathan Lewis which other threads, I believe that you already have.

    You must lower your CPU.
    Previous discussions, if the situation is still the same, it sounded like hard analysis particularly with this SELECTION against the NEWSPAPER plays an important role in that.

    How to avoid this... why its different execution plan using (I mean bad index PK)

    The points raised in the previous discussion remain valid.
    -Do you have access to this SQL to change?
    for example using bind variable or trick it if necessary due to problems caused by data as discussed in the previous thread.
    - Or you could it repoint the view to a view and a hint?
    -If a particular user makes this sql, could affect you cursor_sharing just for this user. If not, you should consider implementing pan-Canadian database.

    Oracle 8.1.6 still?

  • OEM12c: in execution plans, no more links to tables (OEM10g has them)

    in the Plan for SQL, version details tab OEM 10g has hyperlinks to the objects mentioned in the implementation plan.

    OEM10g Plan has hyperlinks.jpg

    It seems not to be the case more in OEM12c:

    OEM12c no more hyperlink to table.jpg

    Does anyone know how to activate the ability to directly open the details page of the objects listed in the execution plans?

    Hello

    This feature has been valuable, but unfortunately has not been set up at EM12c.  If you want to access the Cloud control, once connected to the database, the best way is to click on the schema, database objects and then go to the correct data type to search for the object in question.  If you are looking for information on the object in the execution plan, then the best way to see it is via SQL Monitor if the process has not aged.  If it has, then use SQL statements search, (under the menu Performance/SQL for the database that you are connected) and then do a search for cache, CWA and other, you know you want to watch for the SQLID in question.

    I hope this helps!

    Kevin Pot' wine-Gorman

  • Question about lesson 1-7, slide 2: Iterable.forEach () and parallel execution

    As stated in the previous parts of this lesson, the library can choose to run lambda expressions in parallel.

    In the example: the final execution using Iterable.forEach () result will be same as using a traditional loop?

    Using a traditional loop that you are sure that the items in the list are printed in the order they are in the list.

    This is not always true using Iterable.forEach (), since the items could be printed by different threads?

    "... the library can choose to perform lambda expressions in parallel."

    I wanted to clarify a little.

    The general rule is that parallel execution can occur if the particular library used API allows him, and it is usually under the control of the programmer. For example, lambdas in parallel flow (which will be addressed later in the MOOC) can be run in parallel, but the programmer must explicitly request parallelism. If the API says nothing about parallel (or asynchronous) execution, then those that don't occur.

    If Iterable.forEach runs sequentially, and the underlying class specified an order, the execution will take place in this order.

  • Execution Plan change

    Hello world

    I have this recommendation in Enterprise Manager, I would like to implement the first recommendation where there is a best execution plan that comes with the benefit of 99.7%. Its easy to implement using Enterprise manager by clicking just. But I would like to know how I can change execution plan using sqlplus. And if I want to return to the original plan, how can I do? Thank you in advance for your precious time really appreciate it.

    recommendation.png

    Yes, you can restore it-here, you will...

    http://docs.Oracle.com/CD/B28359_01/server.111/b28274/sql_tune.htm#CHDIDBBG

  • 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

  • Why I have two different execution plans for the same query on two different servers

    Hello everyone.

    I need your help to solve the problem quickly.

    In a nutshell, we have two servers that have the same version of Oracle RDBMS (11.2.0.4 EE). One of them for purposes of development and another is a production one.

    We have therefore two different execution plans for the same query executed on both servers. The only case of execution is OK and another is too slow.

    So I have to slow down the work of query using the same scheme to explain that young.

    Fence wire.

  • Trace SQL execution plan

    Hello

    I need to get the execution plan for a particular SQL, but I don't have it. Application it issues for a second or two and then his party so I think that the definition of a trace on specific user. Is it possible to get the execution plan of the query like this? Thank you!

    Find the sql code, you are interested in v$ sql using the sql_text column and get the SQL_ID and CHILD_NUMBER. Entry of these two values for the query to get the execution below plan.

    Select * from table

    (dbms_xplan.display_cursor ('> ',>, 'ALLSTATS'));

  • Version 12: Same SQL, another scheme == &gt; different execution plan?

    I'm testing a huge application with a database middleware sophisticated against the Oracle 12 database. So far, it works well with Pervasive SQL, MSSQL and Oracle 8 database... 11.

    There are many questions about execution plans changed from Version 11 to 12. Oracle will tell what all of the improvements are (or at least have to improvements), and I can't really denied him. It's not the subject.

    But I met some SQLs with horrible execution time, especially connected to Crystal Reports. Whenever I tried to check them, the queries have been executed quickly. As far as I can see, this has to do with the schema/user who executes the SQL statement in a first time. Here are the details:

    = ADMIN, DML = GUI DDL: all data are stored in a scheme of the ADMIN. The ADMIN user creates the tables, views and so on. It grants access to and creates synonyms for users, but it cannot modify the data using DML, given that triggers prevent him. End users, named 'GUI' users, are allowed to use the DML, but they have no privileges DDL.

    • Database of reports (on paper) are generally quite complex. They have only a limited data set (must fit on sheets of paper!), and the Oracle optimizer optimizes often against this goal. Because Crystal Reports generates no advice, most of the reports are based on a view ADMIN. < xyz > (with the necessary information) and are accessible via a GUI. < xyz > synonym of user GUI.

    • Crystal Reports running slowly (~ 5 minutes) connected as a GUI. I export it, get the SQL export, log in as an ADMINISTRATORand run the query, it works quickly (~ 2 seconds). Well, I've probably changed some white space, the line endings and others then copy / paste, I don't?

    • I tried many things, connecting both GUI and ADMIN, simplifying the application, execution and so on. Then I got confused version of who this query: when the ADMIN has added an additional space character it was fast, removed again and it was slow again. Whitespace have an influence on the execution plan? Probably not, and if yes, my vision of the world would collapse.

    • Later, I found out: in Version 12, depends on the user executing this query. Nail down us the source of the query for the synonym GUI. < xyz >. Let us make a new version of it (coded by white space - smile), and if run you it like GUI first, it's slow. Even if you re - log on as ADMINISTRATOR, the same version of this query is still slow. (This is a bug!)

    Question 1: When I prepend the SQL with 'EXPLAIN PLAN FOR', I seem to be changing. As GUI has no plan_table and no privilege to explain a plan, I can't spy on the implementation plan of 'bad '. I don't want to give too much GUI, and I fear it could alter the execution plan. Is there a trick to get the plan of execution of a SQL statement in v$ sql or v$ sqlarea? (Means: execute the query: GUI and explain it as an ADMINISTRATOR)

    Question 2: Is this on the privileges of the GUI? What you think, what direction will further investigate?

    Oracle database generates an execution plan based on SQL, the dictionary, the statistics, the privileges of the user of the analysis and database and session settings. One of the privileges is GRANT MERGE [ALL] DISPLAY, which was responsible for the difference in this particular example and in this particular version.

    When you log on as another user and run the same code in SQL, Oracle database verifies all required components before she reuses the old execution plan. This is a minor bug, but it is.

    In the example, the privilege GRANT MERGE ANY NOTICE was given implicitly by the DBA privilege. Because MERGE ANY VIEW disables security controls, the privilege of s/n, default, also disables security controls. This is not a desired behavior from the DBA privilege.

  • Newbie. SELECT with Clause: bad execution plan.

    Hello

    1)

    SQL> WITH CTATEL AS
      2  (SELECT A.CTA_FACTURAC, A.NUM_TELEFONO
      3  FROM PFA_CONTABON A, PGA_CTAFACTU B, PGA_ABONOS C
      4  WHERE B.CTA_FACTURAC=A.CTA_FACTURAC
      5  AND C.NUM_TELEFONO=A.NUM_TELEFONO)
      6  SELECT 71, A.CTA_FACTURAC, B.NUM_TELEFONO, A.COD_CONFACTU, SYSDATE, 0, A.TOT_IMPORTE*166.386, A.TOT_IMPORTE, 'E'
      7  FROM SOL_FICHERO a, CTATEL b
      8  WHERE ID_SOLICITUD=71
      9  AND A.CTA_FACTURAC=B.CTA_FACTURAC
     10  AND (A.NUM_TELEFONO IS NULL OR (A.NUM_TELEFONO <> '0' AND B.NUM_TELEFONO IS NOT NULL AND A.NUM_TELEFONO=B.NUM_TELEFONO))
     11  AND A.COD_CONFACTU IS NOT NULL AND  EXISTS (SELECT 1 FROM PGSM_CONFACTU WHERE COD_CONFACTU=A.COD_CONFACTU);
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 711563975
    
    ---------------------------------------------------------------------------------------------------
    | Id  | Operation                       | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                |                 |     1 |    64 |     6   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS                   |                 |     1 |    64 |     6   (0)| 00:00:01 |
    |   2 |   NESTED LOOPS                  |                 |     1 |    54 |     5   (0)| 00:00:01 |
    |   3 |    NESTED LOOPS                 |                 |     1 |    45 |     4   (0)| 00:00:01 |
    |   4 |     NESTED LOOPS SEMI           |                 |     1 |    26 |     2   (0)| 00:00:01 |
    |*  5 |      TABLE ACCESS BY INDEX ROWID| SOL_FICHERO     |     2 |    44 |     2   (0)| 00:00:01 |
    |*  6 |       INDEX RANGE SCAN          | SOL_FICHERO_I01 |     6 |       |     1   (0)| 00:00:01 |
    |*  7 |      INDEX UNIQUE SCAN          | PK_CONFACTU     |  5820 | 23280 |     0   (0)| 00:00:01 |
    |*  8 |     INDEX RANGE SCAN            | PK_CONTABON     |     1 |    19 |     2   (0)| 00:00:01 |
    |*  9 |    INDEX UNIQUE SCAN            | PK_CTAFACTU     |     1 |     9 |     1   (0)| 00:00:01 |
    |* 10 |   INDEX UNIQUE SCAN             | PK_ABONOS       |     1 |    10 |     1   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       5 - filter("A"."COD_CONFACTU" IS NOT NULL)
       6 - access("ID_SOLICITUD"=71)
       7 - access("COD_CONFACTU"="A"."COD_CONFACTU")
       8 - access("A"."CTA_FACTURAC"="A"."CTA_FACTURAC")
           filter("A"."NUM_TELEFONO" IS NULL OR "A"."NUM_TELEFONO"="A"."NUM_TELEFONO" AND
                  "A"."NUM_TELEFONO"<>'0')
       9 - access("B"."CTA_FACTURAC"="A"."CTA_FACTURAC")
      10 - access("C"."NUM_TELEFONO"="A"."NUM_TELEFONO")
    
    
    

    2)

    SQL> WITH CTATEL AS
      2  (SELECT A.CTA_FACTURAC, A.NUM_TELEFONO
      3  FROM PFA_CONTABON A, PGA_CTAFACTU B, PGA_ABONOS C
      4  WHERE B.CTA_FACTURAC=A.CTA_FACTURAC
      5  AND C.NUM_TELEFONO=A.NUM_TELEFONO)
      6  SELECT 71, A.CTA_FACTURAC, NULL, A.COD_CONFACTU, SYSDATE, 0, A.TOT_IMPORTE*166.386, A.TOT_IMPORTE, 'E'
      7  FROM SOL_FICHERO a
      8  WHERE ID_SOLICITUD=71
      9  AND A.NUM_TELEFONO IS NOT NULL AND A.NUM_TELEFONO='0'
     10  AND EXISTS (SELECT 1 FROM CTATEL b WHERE A.CTA_FACTURAC=B.CTA_FACTURAC)
     11  AND A.COD_CONFACTU IS NOT NULL AND  EXISTS (SELECT 1 FROM PGSM_CONFACTU WHERE COD_CONFACTU=A.COD_CONFACTU);
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3992598922
    
    -------------------------------------------------------------------------------------------------
    | Id  | Operation                     | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    -------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT              |                 |     1 |    26 |     7   (0)| 00:00:01 |
    |*  1 |  FILTER                       |                 |       |       |            |          |
    |   2 |   NESTED LOOPS SEMI           |                 |     1 |    26 |     2   (0)| 00:00:01 |
    |*  3 |    TABLE ACCESS BY INDEX ROWID| SOL_FICHERO     |     1 |    22 |     2   (0)| 00:00:01 |
    |*  4 |     INDEX RANGE SCAN          | SOL_FICHERO_I01 |     6 |       |     1   (0)| 00:00:01 |
    |*  5 |    INDEX UNIQUE SCAN          | PK_CONFACTU     |  5820 | 23280 |     0   (0)| 00:00:01 |
    |   6 |   NESTED LOOPS                |                 |     1 |    38 |     5   (0)| 00:00:01 |
    |   7 |    NESTED LOOPS               |                 |     1 |    28 |     4   (0)| 00:00:01 |
    |*  8 |     INDEX UNIQUE SCAN         | PK_CTAFACTU     |     1 |     9 |     2   (0)| 00:00:01 |
    |*  9 |     INDEX RANGE SCAN          | PK_CONTABON     |     1 |    19 |     2   (0)| 00:00:01 |
    |* 10 |    INDEX UNIQUE SCAN          | PK_ABONOS       |     1 |    10 |     1   (0)| 00:00:01 |
    -------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - filter( EXISTS (SELECT /*+ */ 0 FROM "FACTMS"."PGA_ABONOS_1"
                  "C","FACTMS"."PGA_CTAFACTU" "B","FACTMS"."PFA_CONTABON_1" "A" WHERE
                  "B"."CTA_FACTURAC"="A"."CTA_FACTURAC" AND "A"."CTA_FACTURAC"=:B1 AND
                  "B"."CTA_FACTURAC"=:B2 AND "C"."NUM_TELEFONO"="A"."NUM_TELEFONO"))
       3 - filter("A"."COD_CONFACTU" IS NOT NULL AND "A"."NUM_TELEFONO" IS NOT NULL AND
                  "A"."NUM_TELEFONO"='0')
       4 - access("ID_SOLICITUD"=71)
       5 - access("COD_CONFACTU"="A"."COD_CONFACTU")
       8 - access("B"."CTA_FACTURAC"=:B1)
       9 - access("B"."CTA_FACTURAC"="A"."CTA_FACTURAC")
           filter("A"."CTA_FACTURAC"=:B1)
      10 - access("C"."NUM_TELEFONO"="A"."NUM_TELEFONO")
    

    3)

      1  WITH CTATEL AS
      2  (SELECT A.CTA_FACTURAC, A.NUM_TELEFONO
      3  FROM PFA_CONTABON A, PGA_CTAFACTU B, PGA_ABONOS C
      4  WHERE B.CTA_FACTURAC=A.CTA_FACTURAC
      5  AND C.NUM_TELEFONO=A.NUM_TELEFONO)
      6  SELECT 71, A.CTA_FACTURAC, B.NUM_TELEFONO, A.COD_CONFACTU, SYSDATE, 0, A.TOT_IMPORTE*166.386, A.TOT_IMPORTE, 'E'
      7  FROM SOL_FICHERO a, CTATEL b
      8  WHERE ID_SOLICITUD=71
      9  AND A.CTA_FACTURAC=B.CTA_FACTURAC
     10  AND (A.NUM_TELEFONO IS NULL OR (A.NUM_TELEFONO <> '0' AND B.NUM_TELEFONO IS NOT NULL AND A.NUM_TELEFONO=B.NUM_TELEFONO))
     11  AND A.COD_CONFACTU IS NOT NULL AND  EXISTS (SELECT 1 FROM PGSM_CONFACTU WHERE COD_CONFACTU=A.COD_CONFACTU)
     12  UNION ALL
     13  SELECT 71, A.CTA_FACTURAC, NULL, A.COD_CONFACTU, SYSDATE, 0, A.TOT_IMPORTE*166.386, A.TOT_IMPORTE, 'E'
     14  FROM SOL_FICHERO a
     15  WHERE ID_SOLICITUD=71
     16  AND A.NUM_TELEFONO IS NOT NULL AND A.NUM_TELEFONO='0'
     17  AND EXISTS (SELECT 1 FROM CTATEL b WHERE A.CTA_FACTURAC=B.CTA_FACTURAC)
     18* AND A.COD_CONFACTU IS NOT NULL AND  EXISTS (SELECT 1 FROM PGSM_CONFACTU WHERE COD_CONFACTU=A.COD_CONFACTU)
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3945970136
    
    -----------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                       | Name                        | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    -----------------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT                |                             |  3351 |   127K|       |   776  (53)| 00:00:10 |
    |   1 |  TEMP TABLE TRANSFORMATION      |                             |       |       |       |            |          |
    |   2 |   LOAD AS SELECT                |                             |       |       |       |            |          |
    |*  3 |    HASH JOIN                    |                             |   323K|    11M|    12M| 66832   (4)| 00:13:22 |
    |*  4 |     HASH JOIN                   |                             |   338K|  9254K|  4176K| 39353   (3)| 00:07:53 |
    |   5 |      INDEX FAST FULL SCAN       | PK_CTAFACTU                 |   203K|  1788K|       |   190   (4)| 00:00:03 |
    |   6 |      INDEX FAST FULL SCAN       | PK_CONTABON                 |    16M|   300M|       | 13975   (4)| 00:02:48 |
    |   7 |     INDEX FAST FULL SCAN        | PK_ABONOS                   |    15M|   150M|       |  9766   (5)| 00:01:58 |
    |   8 |   UNION-ALL                     |                             |       |       |       |            |          |
    |*  9 |    HASH JOIN                    |                             |  3350 |   127K|       |   388   (5)| 00:00:05 |
    |  10 |     NESTED LOOPS SEMI           |                             |     1 |    26 |       |     2   (0)| 00:00:01 |
    |* 11 |      TABLE ACCESS BY INDEX ROWID| SOL_FICHERO                 |     2 |    44 |       |     2   (0)| 00:00:01 |
    |* 12 |       INDEX RANGE SCAN          | SOL_FICHERO_I01             |     6 |       |       |     1   (0)| 00:00:01 |
    |* 13 |      INDEX UNIQUE SCAN          | PK_CONFACTU                 |  5820 | 23280 |       |     0   (0)| 00:00:01 |
    |  14 |     VIEW                        |                             |   323K|  4112K|       |   379   (4)| 00:00:05 |
    |  15 |      TABLE ACCESS FULL          | SYS_TEMP_0FD9D6621_1BE166BB |   323K|  6009K|       |   379   (4)| 00:00:05 |
    |* 16 |    HASH JOIN SEMI               |                             |     1 |    33 |       |   388   (5)| 00:00:05 |
    |  17 |     NESTED LOOPS SEMI           |                             |     1 |    26 |       |     2   (0)| 00:00:01 |
    |* 18 |      TABLE ACCESS BY INDEX ROWID| SOL_FICHERO                 |     1 |    22 |       |     2   (0)| 00:00:01 |
    |* 19 |       INDEX RANGE SCAN          | SOL_FICHERO_I01             |     6 |       |       |     1   (0)| 00:00:01 |
    |* 20 |      INDEX UNIQUE SCAN          | PK_CONFACTU                 |  5820 | 23280 |       |     0   (0)| 00:00:01 |
    |  21 |     VIEW                        |                             |   323K|  2214K|       |   379   (4)| 00:00:05 |
    |  22 |      TABLE ACCESS FULL          | SYS_TEMP_0FD9D6621_1BE166BB |   323K|  6009K|       |   379   (4)| 00:00:05 |
    -----------------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - access("C"."NUM_TELEFONO"="A"."NUM_TELEFONO")
       4 - access("B"."CTA_FACTURAC"="A"."CTA_FACTURAC")
       9 - access("A"."CTA_FACTURAC"="B"."CTA_FACTURAC")
           filter("A"."NUM_TELEFONO" IS NULL OR "A"."NUM_TELEFONO"="B"."NUM_TELEFONO" AND "A"."NUM_TELEFONO"<>'0')
      11 - filter("A"."COD_CONFACTU" IS NOT NULL)
      12 - access("ID_SOLICITUD"=71)
      13 - access("COD_CONFACTU"="A"."COD_CONFACTU")
      16 - access("A"."CTA_FACTURAC"="B"."CTA_FACTURAC")
      18 - filter("A"."COD_CONFACTU" IS NOT NULL AND "A"."NUM_TELEFONO" IS NOT NULL AND "A"."NUM_TELEFONO"='0')
      19 - access("ID_SOLICITUD"=71)
      20 - access("COD_CONFACTU"="A"."COD_CONFACTU")
    

    I use this WITH clausule in the query above:

    operating system

    WITH CTATEL AS 
    (SELECT A.CTA_FACTURAC, A.NUM_TELEFONO 
    FROM PFA_CONTABON A, PGA_CTAFACTU B, PGA_ABONOS C 
    WHERE B.CTA_FACTURAC=A.CTA_FACTURAC 
    AND C.NUM_TELEFONO=A.NUM_TELEFONO) 
    

    Why 3) plan is so bad? (In any case, it's like "UNION ALL" of 1) and 2).

    Thanks in advance,

    Jose Luis

    We do not know if one of them is 'bad' plans.

    In fact, there is no such thing as a bad plan, one or several inaccurate estimates.

    To determine whether a plan is 'bad', you really see who believes are inaccurate - and which means the time of execution of the execution plans and runtime enforcement measures.

    Please take a look at the notice in the following thread:

    HOW to: Validate a query of SQL statement tuning - model showing

    What happens in the third SQL, is that because you referenced the subquery WITH twice, Oracle decides to materialise it in a temporary table for the reason that it is cheaper that to do the same thing one subquery normally twice - a reasonable approach.

    It is probably more likely that the third query estimates are more accurate than the other two.

Maybe you are looking for