Help in TKPROF Output: Row Source Operation v.s Execution plan confusing

Hello,
Working with oracle 10g/widnows, and trying to understand from the TKPROF what is the purpose of the "Row Source operation" section.
From the "Row Source Operation" section the PMS_ROOM table is showing 16 rows selected, and accessed by an ACCESS FULL, and the following script gives another value.
select count(*) from pms_folio give the following.
COUNT(*)
148184
But in the execution plan section, the PMS_FOLIO table is accessed by ROW ID after index scan in the JIE_BITMAP_CONVERSION index
What really means Row Source operation compares to the execution plan and how both information should be read to fully know if the optimizer is not making wrong estimation?
furthermore readding 13594 buffers to fetch 2 rows, show the SQL Script itself is not sufficient, but the elapsed time is roughly 0.7seconds,but shrinking the # of buffers to be read should probably shrink the response time.
The following TKPROF output.
Thanks very much for your help
SELECT NVL(SUM(NVL(t1.TOTAL_GUESTS, 0)), 0)
FROM DEV.PMS_FOLIO t1
WHERE (t1.FOLIO_STATUS <> 'CANCEL'
AND t1.ARRIVAL_DATE <= TO_DATE(:1, 'SYYYY/MMDDHH24MISS')
AND t1.DEPARTURE_DATE > TO_DATE(:1, 'SYYYY/MMDDHH24MISS')
AND t1.PRIMARY_OR_SHARE = 'P' AND t1.IS_HOUSE = 'N')
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 2 0.12 0.12 0 13594 0 2
total 5 0.12 0.12 0 13594 0 2
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 82 (PMS5000)
Rows Row Source Operation
2 SORT AGGREGATE (cr=13594 pr=0 pw=0 time=120165 us)
16 TABLE ACCESS FULL PMS_FOLIO (cr=13594 pr=0 pw=0 time=121338 us)
Rows Execution Plan
0 SELECT STATEMENT MODE: ALL_ROWS
2 SORT (AGGREGATE)
16 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF 'PMS_FOLIO'
(TABLE)
0 INDEX MODE: ANALYZED (RANGE SCAN) OF
'JIE_BITMAP_CONVERSION' (INDEX)
<Edited by: user552326 on 8-Apr-2009 12:49 PM
Edited by: user552326 on 8-Apr-2009 12:52 PM
Edited by: user552326 on 8-Apr-2009 12:53 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Your query is using bind variables. Explain Plan doesn't work exactly the same way -- it can't handle bind variables.
See http://www.oracle.com/technology/oramag/oracle/08-jan/o18asktom.html
In your output, the row source operations listing is the real execution.
The explain plan listing may well be misleading as Oracle uses cardinality estimates when trying to explain with bind variables.
Also, it seems that your plan table may be a 9i version, not the 10g PLAN_TABLE created by catplan.sql There are additional columns in the 10g PLAN_TABLE that explain uses well.
BTW, you start off with a mention of "PMS_ROOM" showing 16 rows, but it doesn't appear in the data you have presented.

Similar Messages

  • Resource consumption details not shown for each row source operation

    Hi Friends,
    I have generated a tracefile for a query as shown below.
    set autotrace traceonly arraysize 100
    ALTER SESSION SET optimizer_mode = ALL_ROWS ;
    alter session set tracefile_identifier = 'trcwithtime_221010_03';
    alter session set events '10046 trace name context forever, level 12';
    spool on
    spool C:\Sree\trcwtime.log
    -- put your statement here
    SELECT e.*,d.dname
    FROM scott.emp e
        ,scott.dept d
    WHERE e.deptno = d.deptno;
    spool off;
    exitBelow is the trace file
    SELECT e.*,d.dname
    FROM scott.emp e
        ,scott.dept d
    WHERE e.deptno = d.deptno
    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          0          0           0
    Fetch        2      0.00       0.00          4          7          0          14
    total        4      0.00       0.00          4          7          0          14
    Misses in library cache during parse: 0
    Optimizer goal: ALL_ROWS
    Parsing user id: 173 
    Rows     Row Source Operation
         14  HASH JOIN 
          4   TABLE ACCESS FULL DEPT
         14   TABLE ACCESS FULL EMP
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       2        0.00          0.00
      db file sequential read                         4        0.00          0.00
      SQL*Net message from client                     2        0.41          0.77
    ********************************************************************************For each rowsource operation, resource consumption details (cr,pr,pw,time) are not shown in the TKPROF output.
    How can i get these details as well?
    DBVersion: 9.2.0.8
    Regards,
    Sreekanth Munagala

    Sreekanth Munagala wrote:
    For each rowsource operation, resource consumption details (cr,pr,pw,time) are not shown in the TKPROF output.
    How can i get these details as well?
    DBVersion: 9.2.0.8You can get those details by setting values for following parameters (at session level, preferably) before generating the 10046 trace.
    ALTER SESSION SET statistics_level = ALL ;
    ALTER SESSION SET timed_statistics = TRUE ;

  • Help interpreting tkprof output

    in the index range scan I only get 13,000 physical reads, but in the total I get 66,500. Why such a big difference.
    This comes from a function that is called in the where clause of a query(I know its bad, I didn't write it and I have to improve it or change it). I get
    i know the main reason is that this runs so many times.
    SELECT ID
    FROM
    MYTABLE WHERE MY_ID = :B2 AND MY_TYPE_CODE = :B1 AND
      MY_CODE IN ('A','M') AND MY_STATUS_CODE = 'S'
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute 2281215   2154.25   31475.39          0          0          0           0
    Fetch   2281215    184.79     877.79      66503    9249950          0       84758
    total   4562431   2339.04   32353.19      66503    9249950          0       84758
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 96     (recursive depth: 1)
    Rows     Row Source Operation
      84758  MAT_VIEW ACCESS BY INDEX ROWID MYTABLE (cr=9249950 pr=66503 pw=0 time=884775284 us)
    2393802   INDEX RANGE SCAN MY_UK (cr=6865057 pr=13578 pw=0 time=192128470 us)(object id 61483)

    When I create a new table with the just the columns in the query.
    I put a unique index on it that includes the select query.
    Why do I get an inlist iterator in my plan? If you look at the first query which has an index that does not include all the columns it does not do an inlist iterator and it only has 3 logical IOs.
    Execution Plan
       0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=1 Bytes=34)
       1    0   INLIST ITERATOR
       2    1     INDEX (RANGE SCAN) OF 'MY_TEST' (INDEX (UNIQUE)) (Cost
              =3 Card=1 Bytes=34)

  • Confusion in FILTER and SORT operations in the execution plan

    Hi
    I have been working on tuning of a sql query:
    SELECT SUM(DECODE(CR_FLG, 'C', NVL(TOT_AMT, 0), 0)),
           SUM(DECODE(CR_FLG, 'C', 1, 0)),
           SUM(DECODE(CR_FLG, 'R', NVL(TOT_AMT, 0), 0)),
           SUM(DECODE(CR_FLG, 'R', 1, 0)),
           SUM(DECODE(CR_FLG, 'C', NVL(TOT_AMT, 0), -1 * NVL(TOT_AMT, 0))),
           SUM(1)
         FROM TS_TEST
        WHERE SMY_DT BETWEEN TO_DATE(:1, 'DD-MM-YYYY') AND
           TO_DATE(:1, 'DD-MM-YYYY');Table TS_TEST is range partitioned on smy_dt and there is an index on smy_dt column. Explain plan of the query is:
    SQL> explain plan for  SELECT SUM(DECODE(CR_FLG, 'C', NVL(TOT_AMT, 0), 0)),
      2         SUM(DECODE(CR_FLG, 'C', 1, 0)),
      3         SUM(DECODE(CR_FLG, 'R', NVL(TOT_AMT, 0), 0)),
      4         SUM(DECODE(CR_FLG, 'R', 1, 0)),
      5         SUM(DECODE(CR_FLG, 'C', NVL(TOT_AMT, 0), -1 * NVL(TOT_AMT, 0))),
      6         SUM(1)
      7    FROM TS_TEST
      8   WHERE SMY_DT BETWEEN TO_DATE(:1, 'DD-MM-YYYY') AND
      9         TO_DATE(:1, 'DD-MM-YYYY');
    Explained.
    SQL> @E
    PLAN_TABLE_OUTPUT
    Plan hash value: 766961720
    | Id  | Operation                            | Name                | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT                     |                     |     1 |    14 | 15614   (1)| 00:03:08 |       |       |
    |   1 |  SORT AGGREGATE                      |                     |     1 |    14 |            |             |       |       |
    |*  2 |   FILTER                             |                     |       |       |            |          |       |       |
    |   3 |    TABLE ACCESS BY GLOBAL INDEX ROWID| T_TEST             | 79772 |  1090K| 15614   (1)| 00:03:08 | ROWID | ROWID |
    |*  4 |     INDEX RANGE SCAN                 | I_SMY_DT         |   143K|       |   442   (1)| 00:00:06 |       |       |
    Predicate Information (identified by operation id):
       2 - filter(TO_DATE(:1,'DD-MM-YYYY')<=TO_DATE(:1,'DD-MM-YYYY'))
       4 - access("SMY_DT">=TO_DATE(:1,'DD-MM-YYYY') AND "SMY_DT"<=TO_DATE(:1,'DD-MM-YYYY'))
    17 rows selected.
    SQL>I am not able to understand the FILTER & SORT operations. As there is an index on SMY_DT column, so index range scan is fine. But why a FILTER (Step no 2) and SORT (Step no 1) operation after that ?
    Oracle version is 10.2.0.3 on AIX 5.3 64 bit.
    Any other information required please let me know.
    Regards,
    Amardeep Sidhu

    Sort aggregate tells you that there was performed an aggregate operation which returns one row, in opposite to sort order by or hash group by which indicates you have grouping, and there more than one row can be returned.
    SQL> SELECT SUM(comm) FROM emp;
    SUM(COMM)
          2200
    Plan wykonywania
    Plan hash value: 2083865914
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     1 |     2 |     3   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE    |      |     1 |     2 |            |          |
    |   2 |   TABLE ACCESS FULL| EMP  |    14 |    28 |     3   (0)| 00:00:01 |
    SQL> SELECT AVG(comm) FROM emp;
    AVG(COMM)
           550
    Plan wykonywania
    Plan hash value: 2083865914
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     1 |     2 |     3   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE    |      |     1 |     2 |            |          |
    |   2 |   TABLE ACCESS FULL| EMP  |    14 |    28 |     3   (0)| 00:00:01 |
    SQL> SELECT MIN(comm) FROM emp;
    MIN(COMM)
             0
    Plan wykonywania
    Plan hash value: 2083865914
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     1 |     2 |     3   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE    |      |     1 |     2 |            |          |
    |   2 |   TABLE ACCESS FULL| EMP  |    14 |    28 |     3   (0)| 00:00:01 |
    SQL> SELECT deptno, SUM(comm) FROM emp GROUP BY deptno;
        DEPTNO  SUM(COMM)
            30       2200
            20
            10
    Plan wykonywania
    Plan hash value: 4067220884
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     3 |    15 |     4  (25)| 00:00:01 |
    |   1 |  HASH GROUP BY     |      |     3 |    15 |     4  (25)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| EMP  |    14 |    70 |     3   (0)| 00:00:01 |
    SQL>Edited by: Łukasz Mastalerz on Jan 14, 2009 11:41 AM

  • Help in understanding TKPROF output

    Hi All,
    Following is the TKPROF output of a user_dump_dest trace file, obtained by setting trace to [email protected] 12.
    select "CHNNL"."CHNNL_BK" "C0", case "GEOG12"."SUB_STATE_PRVNC_CD" when
    *:"SYS_B_000" then :"SYS_B_001" when :"SYS_B_002" then :"SYS_B_003" when*
    *:"SYS_B_004" then :"SYS_B_005" when :"SYS_B_006" then :"SYS_B_007" when*
    *:"SYS_B_008" then :"SYS_B_009" when :"SYS_B_010" then :"SYS_B_011" when*
    *:"SYS_B_012" then :"SYS_B_013" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end*
    *"C1", "TIME_PERIOD13"."MONTH_CD" "C2", lpad(to_char(EXTRACT( MONTH*
    FROM
    *(TIMESTAMP :"SYS_B_014") )), :"SYS_B_015", :"SYS_B_016") "C3", sum(case*
    when "TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_017" then
    *"SALES_FACT"."EXTND_NET_SALE_AMNT" else :"SYS_B_018" end ) over (partition*
    by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_019"
    then :"SYS_B_020" when :"SYS_B_021" then :"SYS_B_022" when :"SYS_B_023"
    then :"SYS_B_024" when :"SYS_B_025" then :"SYS_B_026" when :"SYS_B_027"
    then :"SYS_B_028" when :"SYS_B_029" then :"SYS_B_030" when :"SYS_B_031"
    then :"SYS_B_032" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C4", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_033" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_034" ), :"SYS_B_035" )
    + INTERVAL :"SYS_B_036" DAY) and TIMESTAMP :"SYS_B_037" then
    *"SALES_FACT"."EXTND_NET_SALE_AMNT" else :"SYS_B_038" end ) over (partition*
    by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_039"
    then :"SYS_B_040" when :"SYS_B_041" then :"SYS_B_042" when :"SYS_B_043"
    then :"SYS_B_044" when :"SYS_B_045" then :"SYS_B_046" when :"SYS_B_047"
    then :"SYS_B_048" when :"SYS_B_049" then :"SYS_B_050" when :"SYS_B_051"
    then :"SYS_B_052" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C5", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_053" then*
    *"SALES_FACT"."QTY_SOLD_IN_CASES" else :"SYS_B_054" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_055"*
    then :"SYS_B_056" when :"SYS_B_057" then :"SYS_B_058" when :"SYS_B_059"
    then :"SYS_B_060" when :"SYS_B_061" then :"SYS_B_062" when :"SYS_B_063"
    then :"SYS_B_064" when :"SYS_B_065" then :"SYS_B_066" when :"SYS_B_067"
    then :"SYS_B_068" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C6", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_069" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_070" ), :"SYS_B_071" )
    + INTERVAL :"SYS_B_072" DAY) and TIMESTAMP :"SYS_B_073" then
    *"SALES_FACT"."QTY_SOLD_IN_CASES" else :"SYS_B_074" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_075"*
    then :"SYS_B_076" when :"SYS_B_077" then :"SYS_B_078" when :"SYS_B_079"
    then :"SYS_B_080" when :"SYS_B_081" then :"SYS_B_082" when :"SYS_B_083"
    then :"SYS_B_084" when :"SYS_B_085" then :"SYS_B_086" when :"SYS_B_087"
    then :"SYS_B_088" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C7", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_089" then*
    *"SALES_FACT"."QTY_SOLD_IN_KLGMS" else :"SYS_B_090" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_091"*
    then :"SYS_B_092" when :"SYS_B_093" then :"SYS_B_094" when :"SYS_B_095"
    then :"SYS_B_096" when :"SYS_B_097" then :"SYS_B_098" when :"SYS_B_099"
    then :"SYS_B_100" when :"SYS_B_101" then :"SYS_B_102" when :"SYS_B_103"
    then :"SYS_B_104" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C8", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_105" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_106" ), :"SYS_B_107" )
    + INTERVAL :"SYS_B_108" DAY) and TIMESTAMP :"SYS_B_109" then
    *"SALES_FACT"."QTY_SOLD_IN_KLGMS" else :"SYS_B_110" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_111"*
    then :"SYS_B_112" when :"SYS_B_113" then :"SYS_B_114" when :"SYS_B_115"
    then :"SYS_B_116" when :"SYS_B_117" then :"SYS_B_118" when :"SYS_B_119"
    then :"SYS_B_120" when :"SYS_B_121" then :"SYS_B_122" when :"SYS_B_123"
    then :"SYS_B_124" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C9", sum("SALES_FACT"."EXTND_GROSS_SALE_AMNT")*
    over (partition by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD"
    when :"SYS_B_125" then :"SYS_B_126" when :"SYS_B_127" then :"SYS_B_128"
    when :"SYS_B_129" then :"SYS_B_130" when :"SYS_B_131" then :"SYS_B_132"
    when :"SYS_B_133" then :"SYS_B_134" when :"SYS_B_135" then :"SYS_B_136"
    when :"SYS_B_137" then :"SYS_B_138" else
    *"GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end , "TIME_PERIOD13"."MONTH_CD") "C10",*
    *((sum(case when ("TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_139")*
    then "SALES_FACT"."EXTND_NET_SALE_AMNT" else :"SYS_B_140" end ) over
    *(partition by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when*
    *:"SYS_B_141" then :"SYS_B_142" when :"SYS_B_143" then :"SYS_B_144" when*
    *:"SYS_B_145" then :"SYS_B_146" when :"SYS_B_147" then :"SYS_B_148" when*
    *:"SYS_B_149" then :"SYS_B_150" when :"SYS_B_151" then :"SYS_B_152" when*
    *:"SYS_B_153" then :"SYS_B_154" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end*
    *, "TIME_PERIOD13"."MONTH_CD")+sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_155" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_156" ), :"SYS_B_157" )
    + INTERVAL :"SYS_B_158" DAY) and TIMESTAMP :"SYS_B_159" then
    *"SALES_FACT"."EXTND_NET_SALE_AMNT" else :"SYS_B_160" end ) over (partition*
    by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_161"
    then :"SYS_B_162" when :"SYS_B_163" then :"SYS_B_164" when :"SYS_B_165"
    then :"SYS_B_166" when :"SYS_B_167" then :"SYS_B_168" when :"SYS_B_169"
    then :"SYS_B_170" when :"SYS_B_171" then :"SYS_B_172" when :"SYS_B_173"
    then :"SYS_B_174" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD"))+(sum(case when*
    *("TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_175") then*
    *"SALES_FACT"."QTY_SOLD_IN_CASES" else :"SYS_B_176" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_177"*
    then :"SYS_B_178" when :"SYS_B_179" then :"SYS_B_180" when :"SYS_B_181"
    then :"SYS_B_182" when :"SYS_B_183" then :"SYS_B_184" when :"SYS_B_185"
    then :"SYS_B_186" when :"SYS_B_187" then :"SYS_B_188" when :"SYS_B_189"
    then :"SYS_B_190" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD")+sum(case when "TIME_PERIOD13"."DAY_CLNDR_DATE"*
    between (TIMESTAMP :"SYS_B_191" - NUMTODSINTERVAL( EXTRACT( DAY FROM
    TIMESTAMP :"SYS_B_192" ), :"SYS_B_193" ) + INTERVAL :"SYS_B_194" DAY) and
    TIMESTAMP :"SYS_B_195" then "SALES_FACT"."QTY_SOLD_IN_CASES" else
    *:"SYS_B_196" end ) over (partition by "CHNNL"."CHNNL_BK", case*
    *"GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_197" then :"SYS_B_198" when*
    *:"SYS_B_199" then :"SYS_B_200" when :"SYS_B_201" then :"SYS_B_202" when*
    *:"SYS_B_203" then :"SYS_B_204" when :"SYS_B_205" then :"SYS_B_206" when*
    *:"SYS_B_207" then :"SYS_B_208" when :"SYS_B_209" then :"SYS_B_210" else*
    *"GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end , "TIME_PERIOD13"."MONTH_CD")))*
    +(sum(case  when ("TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_211")
    then "SALES_FACT"."QTY_SOLD_IN_KLGMS" else :"SYS_B_212" end ) over
    *(partition by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when*
    *:"SYS_B_213" then :"SYS_B_214" when :"SYS_B_215" then :"SYS_B_216" when*
    *:"SYS_B_217" then :"SYS_B_218" when :"SYS_B_219" then :"SYS_B_220" when*
    *:"SYS_B_221" then :"SYS_B_222" when :"SYS_B_223" then :"SYS_B_224" when*
    *:"SYS_B_225" then :"SYS_B_226" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end*
    *, "TIME_PERIOD13"."MONTH_CD")+sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_227" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_228" ), :"SYS_B_229" )
    + INTERVAL :"SYS_B_230" DAY) and TIMESTAMP :"SYS_B_231" then
    *"SALES_FACT"."QTY_SOLD_IN_KLGMS" else :"SYS_B_232" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_233"*
    then :"SYS_B_234" when :"SYS_B_235" then :"SYS_B_236" when :"SYS_B_237"
    then :"SYS_B_238" when :"SYS_B_239" then :"SYS_B_240" when :"SYS_B_241"
    then :"SYS_B_242" when :"SYS_B_243" then :"SYS_B_244" when :"SYS_B_245"
    then :"SYS_B_246" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD")) "C11" from "THA_SALES_DBA"."CHNNL" "CHNNL",*
    *(select "GEOG"."GEOG_KEY" "GEOG_KEY", "GEOG"."SUB_STATE_PRVNC_CD"*
    *"SUB_STATE_PRVNC_CD", "GEOG"."SUB_STATE_PRVNC_NAME_TXT"*
    *"SUB_STATE_PRVNC_NAME_TXT" from "THA_SALES_DBA"."GEOG" "GEOG" where*
    *"GEOG"."SUB_STATE_PRVNC_LOAD_DATA_TYPE"=:"SYS_B_247") "GEOG12",*
    *"THA_SALES_DBA"."TIME_PERIOD" "TIME_PERIOD13", "THA_SALES_DBA"."SALES_FACT"*
    *"SALES_FACT", (select "PROD"."PROD_KEY" "PROD_KEY", "PROD"."PROD_DVSN_CD"*
    *"PROD_DVSN_CD", "PROD"."PCKG_SIZE_CD" "PCKG_SIZE_CD" from*
    *"THA_SALES_DBA"."PROD" "PROD" where "PROD"."LOAD_DATA_TYPE_CD"=:"SYS_B_248")*
    *"PROD14", "THA_SALES_DBA"."DSTRBTR" "DSTRBTR" where*
    *"PROD14"."PROD_DVSN_CD"=:"SYS_B_249" and "PROD14"."PCKG_SIZE_CD"=*
    *:"SYS_B_250" and "DSTRBTR"."DSTRBTR_CD"<>:"SYS_B_251" and CASE*
    WHEN("DSTRBTR"."DSTRBTR_CD" IS NULL) OR ("CHNNL"."CHNNL_BK" IS NULL) THEN
    NULL ELSE ("DSTRBTR"."DSTRBTR_CD"||"CHNNL"."CHNNL_BK") END<>:"SYS_B_252"
    and "SALES_FACT"."CHNNL_KEY"="CHNNL"."CHNNL_KEY" and
    *"SALES_FACT"."DSTRBTR_KEY"="DSTRBTR"."DSTRBTR_KEY" and*
    *"SALES_FACT"."GEOG_KEY"="GEOG12"."GEOG_KEY" and "SALES_FACT"."PROD_KEY"=*
    *"PROD14"."PROD_KEY" and "SALES_FACT"."TIME_PERIOD_KEY"=*
    *"TIME_PERIOD13"."TIME_PERIOD_KEY"*
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.01       0.00          0          0          0           0
    Execute      1      0.01       0.01          0          0          0           0
    Fetch     7632    129.92     245.70     406278      12619         35      763042
    total     7634    129.95     245.73     406278      12619         35      763042
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 68
    Rows     Row Source Operation
    *763042 WINDOW BUFFER (cr=12619 pr=406278 pw=257613 time=239232878 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=372409 pw=237458 time=217248824 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=339595 pw=217662 time=194593662 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=307255 pw=198149 time=177438908 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=275292 pw=178940 time=157976971 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=244097 pw=160017 time=139997871 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=213275 pw=141404 time=119675383 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=184170 pw=123525 time=105714100 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=155800 pw=105953 time=88478655 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=128025 pw=88650 time=71243641 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=100871 pw=71641 time=54047210 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=73821 pw=54957 time=35324144 us)*
    *763042 WINDOW SORT (cr=12619 pr=48205 pw=38587 time=18865032 us)*
    *763042 HASH JOIN (cr=12619 pr=0 pw=0 time=3127703 us)*
    *15098 TABLE ACCESS FULL TIME_PERIOD (cr=693 pr=0 pw=0 time=15216 us)*
    *763042 HASH JOIN (cr=11926 pr=0 pw=0 time=2344335 us)*
    *1845 TABLE ACCESS FULL GEOG (cr=92 pr=0 pw=0 time=1910 us)*
    *763194 HASH JOIN (cr=11834 pr=0 pw=0 time=1577327 us)*
    *11 TABLE ACCESS FULL CHNNL (cr=7 pr=0 pw=0 time=47 us)*
    *765432 HASH JOIN (cr=11827 pr=0 pw=0 time=1580849 us)*
    *2 TABLE ACCESS FULL DSTRBTR (cr=7 pr=0 pw=0 time=50 us)*
    *765432 HASH JOIN (cr=11820 pr=0 pw=0 time=814835 us)*
    *313 TABLE ACCESS FULL PROD (cr=174 pr=0 pw=0 time=1195 us)*
    *1045260 TABLE ACCESS FULL SALES_FACT (cr=11646 pr=0 pw=0 time=31 us)*
    Elapsed times include waiting on following events:
    Event waited on                             Times   Max. Wait  Total Waited
    ----------------------------------------   Waited  ----------  ------------
    SQLNet message to client 7633 0.00 0.01*
    SQLNet message from client 7633 1826.57 2334.17*
    SQLNet more data from client 1 0.00 0.00*
    direct path write temp                       5332        0.09          6.23
    direct path read temp                      389239        0.09        115.09
    The query is automatically generated by Cognos 8.2. The database is 64-bit Oracle 10.2.0.4 on Windows 2003 Enterprise Edition R2.
    I am unable to understand the "*WINDOW BUFFER/WINDOW SORT*" statement under the Row Source Operation. Could one of you please explain this operation to me?
    Thanks and Regards,
    Sriraman

    The WINDOW BUFFER/WINDOW SORT operations are used when processing analytical SQLs, you can see these in your SQL statement. In WINDOW BUFFER the SQL engine do calculations above some buffered data subset and in the WINDOW SORT data subsets are being sorted.
    Dusan

  • Tkprof output.. identification

    oracle 10.2.0.2.0
    os : linux
    What are the assumptions can be derived from the output
    TKPROF: Release 10.2.0.2.0 - Production on Thu Jun 12 09:25:26 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Trace file: tld4_ora_5894.trc
    Sort options: fchela
    count = number of times OCI procedure was executed
    cpu = cpu time in seconds executing
    elapsed = elapsed time in seconds executing
    disk = number of physical reads of buffers from disk
    query = number of buffers gotten for consistent read
    current = number of buffers gotten in current mode (usually for update)
    rows = number of rows processed by the fetch or execute call
    SELECT *
    FROM (SELECT elance_paginated_data.*, ROWNUM elance_current_row_number
    FROM (SELECT elance_original_data.*
    FROM (SELECT /*+ ordered use_nl(pm) use_hash(pm) use_nl(sph) index(pm PER_RFX_ID_TY_LATEST)*/ pm.loc_id, pm.poc_user_id, pm.ID, pm.code,
    pm.NAME, pm.rfx_cost_estimate_base,
    pm.date_created, pm.status_id,
    pm.version_number, pm.latest_ind,
    pm.cat_id cat_id, pm.sponsored_by_org_id,
    pm.project_manager_id,
    (SELECT COUNT (props.ID)
    FROM spm_proposal_rfx pr,
    spm_proposals props
    WHERE pr.rfx_id = pm.ID
    AND pr.proposal_id = props.ID
    AND props.status_id NOT IN (8101, 8108))
    number_of_proposals,
    ch.contract_id,
    con.xref_contract xref_contract,
    sph.item_property_id process_type
    FROM spm_rfx pm,
    spm_contracts_hub ch,
    spm_contracts con,
    spm_properties_hub sph
    WHERE pm.ID > 0
    AND pm.rfx_type = 'REQUEST'
    AND pm.latest_ind = 'Y'
    AND pm.ID = ch.rfx_id
    AND pm.owner_id = 4000
    AND pm.rfx_type = ch.type_of
    AND EXISTS (
    SELECT 1
    FROM spm_user_folder_details ufd
    WHERE ufd.contract_id = con.ID
    AND ufd.user_id IN (
    SELECT ru.role_id
    FROM spm_role_users ru,
    spm_roles r
    WHERE ru.user_id = 29 /* Change for GE env. : changed value from 257698 to 29 */
    AND ru.role_id = r.ID
    AND r.type_of =
    'ROLE_GROUP_TYPE'
    UNION ALL
    SELECT 29
    FROM DUAL))
    AND con.ID = ch.contract_id
    AND sph.rfx_id = pm.ID
    AND sph.type_of = pm.rfx_type
    ORDER BY pm.ID DESC) elance_original_data) elance_paginated_data
    WHERE ROWNUM <= 31)
    WHERE elance_current_row_number >= 1
    call count cpu elapsed disk query current rows
    Parse 1 0.65 0.64 1 130 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 4 9.55 29.16 10039 186553 0 31
    total 6 10.20 29.80 10040 186683 0 31
    Misses in library cache during parse: 1
    Optimizer mode: CHOOSE
    Parsing user id: 21 (TLADM01)
    Rows Row Source Operation
    31 VIEW (cr=186553 pr=10039 pw=0 time=29145812 us)
    31 COUNT STOPKEY (cr=186553 pr=10039 pw=0 time=29145749 us)
    31 FILTER (cr=186553 pr=10039 pw=0 time=29145727 us)
    31 VIEW (cr=185329 pr=10037 pw=0 time=29114147 us)
    31 SORT ORDER BY (cr=185329 pr=10037 pw=0 time=29113913 us)
    29536 TABLE ACCESS BY INDEX ROWID SPM_PROPERTIES_HUB (cr=81535 pr=9636 pw=0 time=30161718 us)
    59073 NESTED LOOPS (cr=70280 pr=2137 pw=0 time=350415773 us)
    29536 HASH JOIN (cr=11107 pr=2078 pw=0 time=4575599 us)
    29536 HASH JOIN (cr=1900 pr=1891 pw=0 time=3358329 us)
    29536 TABLE ACCESS FULL SPM_RFX (cr=1068 pr=1066 pw=0 time=2287845 us)
    30935 INDEX FAST FULL SCAN PF_TEST_CHUB_IDX (cr=832 pr=825 pw=0 time=2280408 us)(object id 32367)
    181203 TABLE ACCESS FULL SPM_CONTRACTS (cr=9207 pr=187 pw=0 time=2356208 us)
    29536 INDEX RANGE SCAN PROPERTY_TYPE_RFX_IDX (cr=59173 pr=59 pw=0 time=994586 us)(object id 30553)
    31 NESTED LOOPS (cr=1224 pr=2 pw=0 time=47898 us)
    242 VIEW VW_NSO_1 (cr=708 pr=1 pw=0 time=29700 us)
    242 UNION-ALL (cr=708 pr=1 pw=0 time=29430 us)
    242 NESTED LOOPS (cr=708 pr=1 pw=0 time=28870 us)
    645 INDEX RANGE SCAN ROLE_TYPE_NDX (cr=31 pr=1 pw=0 time=11764 us)(object id 30685)
    242 INDEX UNIQUE SCAN ROLE_USERS_PK (cr=677 pr=0 pw=0 time=6000 us)(object id 30691)
    0 FAST DUAL (cr=0 pr=0 pw=0 time=0 us)
    31 INDEX RANGE SCAN UFD_CONTRACT_FK_I (cr=516 pr=1 pw=0 time=28952 us)(object id 30848)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: CHOOSE
    31 VIEW
    31 COUNT (STOPKEY)
    31 FILTER
    31 VIEW
    31 SORT (ORDER BY)
    29536 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF
    'SPM_PROPERTIES_HUB' (TABLE)
    59073 NESTED LOOPS
    29536 HASH JOIN
    29536 HASH JOIN
    29536 TABLE ACCESS MODE: ANALYZED (FULL) OF
    'SPM_RFX' (TABLE)
    30935 INDEX MODE: ANALYZED (FAST FULL SCAN) OF
    'PF_TEST_CHUB_IDX' (INDEX)
    181203 TABLE ACCESS MODE: ANALYZED (FULL) OF
    'SPM_CONTRACTS' (TABLE)
    29536 INDEX MODE: ANALYZED (RANGE SCAN) OF
    'PROPERTY_TYPE_RFX_IDX' (INDEX)
    31 NESTED LOOPS
    242 VIEW OF 'VW_NSO_1' (VIEW)
    242 UNION-ALL
    242 NESTED LOOPS
    645 INDEX MODE: ANALYZED (RANGE SCAN) OF
    'ROLE_TYPE_NDX' (INDEX)
    242 INDEX MODE: ANALYZED (UNIQUE SCAN) OF
    'ROLE_USERS_PK' (INDEX (UNIQUE))
    0 FAST DUAL
    31 INDEX MODE: ANALYZED (RANGE SCAN) OF
    'UFD_CONTRACT_FK_I' (INDEX)
    SELECT *
    FROM (SELECT elance_paginated_data.*, ROWNUM elance_current_row_number
    FROM (SELECT elance_original_data.*
    FROM (SELECT /*+ FIRST_ROWS ordered use_nl(con) use_nl(vp)*/
    vp.primary_contact_userid, con.ID, con.code,
    con.type_of_sub_contract, con.NAME,
    con.org_id, con.cat_id, con.ccy_code,
    con.end_dt, con.start_dt, con.date_created,
    con.xref_contract extrefrequestid,
    con.vendor_id, con.status_id,
    vp.NAME vendor_name, buyer.NAME AS org_name,
    con.created_by,
    contract_pcr.CHILD change_order_id,
    NVL
    (con.change_contract_status_id,
    -1
    ) AS change_contract_status_id,
    (SELECT approved_amount
    FROM spm_order_summary sos
    WHERE sos.contract_id = con.ID
    AND sos.po_id = sos.master_po_id)
    est_value,
    (SELECT billable_amount
    FROM spm_order_summary sos
    WHERE sos.contract_id = con.ID
    AND sos.po_id = sos.master_po_id)
    invoicableamount
    FROM spm_contracts con,
    (SELECT contract_id_parent PARENT,
    contract_id_child CHILD
    FROM spm_contract_pcr cp
    WHERE cp.type_of_relation =
    'CONTR_NEW_VERSION') contract_pcr,
    spm_vendor_profiles vp,
    spm_contracts_hub hub1,
    spm_orgs orgs,
    spm_orgs buyer
    WHERE con.owner_id = 4000 /* Change for GE env. : changed value from 100 to 4000 */
    AND EXISTS (
    SELECT 1
    FROM spm_user_folder_details ufd
    WHERE ufd.contract_id = con.ID
    AND ufd.user_id IN (
    SELECT ru.role_id
    FROM spm_role_users ru,
    spm_roles r
    WHERE ru.user_id = 29 /* Change for GE env. : changed value from 257698 to 29 */
    AND ru.role_id = r.ID
    AND r.type_of =
    'ROLE_GROUP_TYPE'
    UNION ALL
    SELECT 29 /* Change for GE env. : changed value from 257698 to 29 */
    FROM DUAL))
    AND ( con.version_number = 1
    OR NOT EXISTS (
    SELECT /*+ use_nl(pcr) */ 1
    FROM spm_contract_pcr pcr,
    spm_contracts ord2
    WHERE pcr.contract_id_child = con.ID
    AND pcr.type_of_relation =
    'CONTR_NEW_VERSION'
    AND pcr.contract_id_parent =
    ord2.ID
    AND ( ord2.status_id = 2612
    OR ( ord2.status_id = 2611
    AND con.status_id NOT IN
    (2612,
    2604,
    2611,
    2609,
    2610
    AND con.contract_type_id = 322
    AND con.ID = contract_pcr.PARENT(+)
    AND con.ID = hub1.contract_id
    AND hub1.type_of != 'PROJECT_CONTRACT'
    AND orgs.ID = con.org_id
    AND orgs.legal_org_id = buyer.ID
    AND vp.vendor_id = con.vendor_id
    AND con.status_id NOT IN (-1)
    AND NLS_UPPER (con.NAME) LIKE NLS_UPPER ('%%')
    ORDER BY con.date_created DESC) elance_original_data) elance_paginated_data
    WHERE ROWNUM <= 31)
    WHERE elance_current_row_number >= 1
    call count cpu elapsed disk query current rows
    Parse 1 0.74 0.71 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 4 24.29 28.98 1001 826860 0 31
    total 6 25.03 29.69 1001 826860 0 31
    Misses in library cache during parse: 1
    Optimizer mode: FIRST_ROWS
    Parsing user id: 21 (TLADM01)
    Rows Row Source Operation
    31 VIEW (cr=826860 pr=1001 pw=0 time=28977412 us)
    31 COUNT STOPKEY (cr=826860 pr=1001 pw=0 time=28977363 us)
    31 VIEW (cr=826860 pr=1001 pw=0 time=28977339 us)
    31 SORT ORDER BY STOPKEY (cr=826860 pr=1001 pw=0 time=28977308 us)
    76885 FILTER (cr=482076 pr=426 pw=0 time=17625245 us)
    76986 HASH JOIN (cr=430532 pr=160 pw=0 time=14013505 us)
    1436 VIEW index$_join$_012 (cr=23 pr=0 pw=0 time=16833 us)
    1436 HASH JOIN (cr=23 pr=0 pw=0 time=15394 us)
    1436 INDEX FAST FULL SCAN ORG_PK (cr=9 pr=0 pw=0 time=511 us)(object id 30407)
    1436 INDEX FAST FULL SCAN PF_ORG_NAME (cr=14 pr=0 pw=0 time=140 us)(object id 32369)
    76986 HASH JOIN (cr=430509 pr=160 pw=0 time=13604330 us)
    234 VIEW index$_join$_011 (cr=18 pr=0 pw=0 time=4429 us)
    234 HASH JOIN (cr=18 pr=0 pw=0 time=4427 us)
    234 INDEX FAST FULL SCAN SPM_ORGS_MHP1_IDX (cr=9 pr=0 pw=0 time=325 us)(object id 30398)
    1436 INDEX FAST FULL SCAN ORG_PK (cr=9 pr=0 pw=0 time=62 us)(object id 30407)
    76986 HASH JOIN (cr=430491 pr=160 pw=0 time=13360369 us)
    76986 TABLE ACCESS BY INDEX ROWID SPM_VENDOR_PROFILES (cr=429740 pr=106 pw=0 time=12146037 us)
    153973 NESTED LOOPS (cr=377498 pr=99 pw=0 time=105010507 us)
    76986 HASH JOIN RIGHT OUTER (cr=300158 pr=99 pw=0 time=8281127 us)
    7515 INDEX FAST FULL SCAN CONTRACT_PCR_PK (cr=643 pr=30 pw=0 time=46192 us)(object id 30115)
    76986 NESTED LOOPS (cr=299515 pr=69 pw=0 time=7155318 us)
    149239 VIEW VW_SQ_2 (cr=724 pr=0 pw=0 time=749186 us)
    149239 HASH UNIQUE (cr=724 pr=0 pw=0 time=599938 us)
    197161 NESTED LOOPS (cr=724 pr=0 pw=0 time=394773 us)
    9 VIEW VW_NSO_1 (cr=100 pr=0 pw=0 time=1160 us)
    9 UNION-ALL (cr=100 pr=0 pw=0 time=1138 us)
    8 NESTED LOOPS (cr=100 pr=0 pw=0 time=1004 us)
    97 INDEX RANGE SCAN ROLE_TYPE_NDX (cr=1 pr=0 pw=0 time=368 us)(object id 30685)
    8 INDEX UNIQUE SCAN ROLE_USERS_PK (cr=99 pr=0 pw=0 time=964 us)(object id 30691)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=4 us)
    197161 INDEX RANGE SCAN UFD_CONTRACT_FK_I (cr=624 pr=0 pw=0 time=197535 us)(object id 30848)
    76986 TABLE ACCESS BY INDEX ROWID SPM_CONTRACTS (cr=298791 pr=69 pw=0 time=6642668 us)
    149238 INDEX UNIQUE SCAN CONTRACTS_PK (cr=149553 pr=0 pw=0 time=2335192 us)(object id 30085)
    76986 INDEX RANGE SCAN VNDR_PROF_VNDR_FK_I (cr=77340 pr=0 pw=0 time=1613500 us)(object id 30959)
    202239 INDEX FAST FULL SCAN CONT_HUB_CONTID_TYPEOF_IDX (cr=751 pr=54 pw=0 time=218580 us)(object id 30101)
    101 NESTED LOOPS (cr=51544 pr=266 pw=0 time=2191923 us)
    7515 TABLE ACCESS BY INDEX ROWID SPM_CONTRACT_PCR (cr=28999 pr=266 pw=0 time=1779904 us)
    17120 INDEX RANGE SCAN CONTRACT_PCR_CHILD_FK_I (cr=19262 pr=80 pw=0 time=583382 us)(object id 30116)
    101 TABLE ACCESS BY INDEX ROWID SPM_CONTRACTS (cr=22545 pr=0 pw=0 time=383707 us)
    7515 INDEX UNIQUE SCAN CONTRACTS_PK (cr=15030 pr=0 pw=0 time=226188 us)(object id 30085)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: HINT: FIRST_ROWS
    31 VIEW
    31 COUNT (STOPKEY)
    31 VIEW
    31 SORT (ORDER BY STOPKEY)
    76885 FILTER
    76986 HASH JOIN
    1436 VIEW OF 'index$_join$_012' (VIEW)
    1436 HASH JOIN
    1436 INDEX MODE: ANALYZED (FAST FULL SCAN) OF
    'ORG_PK' (INDEX (UNIQUE))
    1436 INDEX MODE: ANALYZED (FAST FULL SCAN) OF
    'PF_ORG_NAME' (INDEX)
    76986 HASH JOIN
    234 VIEW OF 'index$_join$_011' (VIEW)
    234 HASH JOIN
    234 INDEX MODE: ANALYZED (FAST FULL SCAN) OF
    'SPM_ORGS_MHP1_IDX' (INDEX)
    1436 INDEX MODE: ANALYZED (FAST FULL SCAN) OF
    'ORG_PK' (INDEX (UNIQUE))
    76986 HASH JOIN
    76986 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID)
    OF 'SPM_VENDOR_PROFILES' (TABLE)
    153973 NESTED LOOPS
    76986 HASH JOIN (RIGHT OUTER)
    7515 INDEX MODE: ANALYZED (FAST FULL SCAN) OF
    'CONTRACT_PCR_PK' (INDEX (UNIQUE))
    76986 NESTED LOOPS
    149239 VIEW OF 'VW_SQ_2' (VIEW)
    149239 HASH (UNIQUE)
    197161 NESTED LOOPS
    9 VIEW OF 'VW_NSO_1' (VIEW)
    9 UNION-ALL
    8 NESTED LOOPS
    97 INDEX MODE: ANALYZED
    (RANGE SCAN) OF 'ROLE_TYPE_NDX' (INDEX)
    8 INDEX MODE: ANALYZED
    (UNIQUE SCAN) OF 'ROLE_USERS_PK' (INDEX
    (UNIQUE))
    1 FAST DUAL
    197161 INDEX MODE: ANALYZED (RANGE SCAN)
    OF 'UFD_CONTRACT_FK_I' (INDEX)
    76986 TABLE ACCESS MODE: ANALYZED (BY INDEX
    ROWID) OF 'SPM_CONTRACTS' (TABLE)
    149238 INDEX MODE: ANALYZED (UNIQUE SCAN)
    OF 'CONTRACTS_PK' (INDEX (UNIQUE))
    76986 INDEX MODE: ANALYZED (RANGE SCAN) OF
    'VNDR_PROF_VNDR_FK_I' (INDEX)
    202239 INDEX MODE: ANALYZED (FAST FULL SCAN) OF
    'CONT_HUB_CONTID_TYPEOF_IDX' (INDEX)
    101 NESTED LOOPS
    7515 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF
    'SPM_CONTRACT_PCR' (TABLE)
    17120 INDEX MODE: ANALYZED (RANGE SCAN) OF
    'CONTRACT_PCR_CHILD_FK_I' (INDEX)
    101 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF
    'SPM_CONTRACTS' (TABLE)
    7515 INDEX MODE: ANALYZED (UNIQUE SCAN) OF
    'CONTRACTS_PK' (INDEX (UNIQUE))
    SELECT *
    FROM (SELECT elance_paginated_data.*, ROWNUM elance_current_row_number
    FROM (SELECT elance_original_data.*
    FROM (SELECT /*+first_rows ordered use_nl(cont) use_nl(conthub) use_nl(sps) */
    cont.ID AS workorderid,
    cont.status_id AS statusid,
    cont.code AS workordercode,
    cont.NAME AS workordertitle,
    cont.description AS workorderdescription,
    cont.start_dt AS startdate,
    cont.end_dt AS enddate,
    cont.termination_dt AS terminationdate,
    cont.user_id AS hiring_manager_user_id,
    cont.org_id AS org_id,
    conthub.user_id AS contractorid,
    -- cand.last_name AS last_name,
    cand.last_name
    || ', '
    || cand.first_name AS candidatename,
    cand.became_userid AS became_userid,
    su.display_name AS hiring_manager_name,
    ord.cat_id AS cat_id, ord.ID AS order_id,
    ord.code AS order_code,
    ord.NAME AS order_name,
    ord.version_number AS version_number
    FROM spm_contracts cont,
    spm_contracts_hub conthub,
    spm_candidates cand,
    spm_users su,
    spm_pmt_sched_hub spsh,
    spm_payment_schedule sps,
    spm_contracts ord
    WHERE cont.owner_id = 4000 /* Change for GE env. : changed value from 100 to 4000 */
    AND cont.contract_type_id = 323
    AND cont.status_id IN (8705, 8709, 8708, 8702)
    AND EXISTS (
    SELECT 1
    FROM spm_user_folder_details ufd
    WHERE ufd.contract_id = cont.ID
    AND ufd.user_id IN (
    SELECT ru.role_id
    FROM spm_role_users ru,
    spm_roles r
    WHERE ru.user_id = 29 /* Change for GE env. : changed value from 257698 to 29 */
    AND ru.role_id = r.ID
    AND r.type_of =
    'ROLE_GROUP_TYPE'
    UNION ALL
    SELECT 29 /* Change for GE env. : changed value from 257698 to 29 */
    FROM DUAL))
    AND NOT EXISTS (
    SELECT /*+ use_nl(pcr) */ 1
    FROM spm_contract_pcr pcr,
    spm_contracts ord2
    WHERE pcr.contract_id_child = ord.ID
    AND pcr.contract_id_parent = ord2.ID
    AND ord2.status_id = 2612
    AND pcr.type_of_relation IN
    ('CONTR_NEW_VERSION',
    'CONTRACTOR_REENGAGED'
    AND cont.ID = conthub.contract_id
    AND conthub.type_of = 'CANDIDATE'
    AND conthub.candidate_id = cand.ID
    AND cont.user_id = su.ID
    AND cont.ID = spsh.contract_id
    AND spsh.pmt_sched_id = sps.ID
    AND sps.contract_id = ord.ID
    ORDER BY workorderid DESC) elance_original_data) elance_paginated_data
    WHERE ROWNUM <= 31)
    WHERE elance_current_row_number >= 1
    call count cpu elapsed disk query current rows
    Parse 1 0.60 0.57 1 148 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 4 12.70 21.37 3459 481585 0 31
    total 6 13.30 21.94 3460 481733 0 31
    Misses in library cache during parse: 1
    Optimizer mode: FIRST_ROWS
    Parsing user id: 21 (TLADM01)
    Rows Row Source Operation
    31 VIEW (cr=481585 pr=3459 pw=0 time=21365544 us)
    31 COUNT STOPKEY (cr=481585 pr=3459 pw=0 time=21365480 us)
    31 FILTER (cr=481585 pr=3459 pw=0 time=21365455 us)
    31 VIEW (cr=481491 pr=3459 pw=0 time=21366696 us)
    31 SORT ORDER BY (cr=481491 pr=3459 pw=0 time=21366310 us)
    32745 NESTED LOOPS (cr=481491 pr=3459 pw=0 time=19266638 us)
    32745 NESTED LOOPS (cr=415999 pr=3459 pw=0 time=18415173 us)
    32745 HASH JOIN (cr=350507 pr=2907 pw=0 time=16695622 us)
    32745 HASH JOIN (cr=349756 pr=2823 pw=0 time=16056095 us)
    32745 HASH JOIN (cr=349581 pr=2780 pw=0 time=16950617 us)
    32745 TABLE ACCESS BY INDEX ROWID SPM_CONTRACTS_HUB (cr=347407 pr=610 pw=0 time=8351793 us)
    65491 NESTED LOOPS (cr=332023 pr=338 pw=0 time=105243492 us)
    32745 NESTED LOOPS (cr=299202 pr=298 pw=0 time=6616161 us)
    149239 VIEW VW_SQ_2 (cr=724 pr=53 pw=0 time=1118731 us)
    149239 HASH UNIQUE (cr=724 pr=53 pw=0 time=969487 us)
    197161 NESTED LOOPS (cr=724 pr=53 pw=0 time=394854 us)
    9 VIEW VW_NSO_1 (cr=100 pr=0 pw=0 time=1288 us)
    9 UNION-ALL (cr=100 pr=0 pw=0 time=1269 us)
    8 NESTED LOOPS (cr=100 pr=0 pw=0 time=1133 us)
    97 INDEX RANGE SCAN ROLE_TYPE_NDX (cr=1 pr=0 pw=0 time=514 us)(object id 30685)
    8 INDEX UNIQUE SCAN ROLE_USERS_PK (cr=99 pr=0 pw=0 time=1140 us)(object id 30691)
    1 FAST DUAL (cr=0 pr=0 pw=0 time=4 us)
    197161 INDEX RANGE SCAN UFD_CONTRACT_FK_I (cr=624 pr=53 pw=0 time=197643 us)(object id 30848)
    32745 TABLE ACCESS BY INDEX ROWID SPM_CONTRACTS (cr=298478 pr=245 pw=0 time=7787761 us)
    149238 INDEX UNIQUE SCAN CONTRACTS_PK (cr=149240 pr=59 pw=0 time=2627776 us)(object id 30085)
    32745 INDEX RANGE SCAN CONT_HUB_CONTRACT_FK_I (cr=32821 pr=40 pw=0 time=1129934 us)(object id 30106)
    44590 TABLE ACCESS FULL SPM_CANDIDATES (cr=2174 pr=2170 pw=0 time=695935 us)
    35864 INDEX FAST FULL SCAN SPM_USERS_SNZ1_IDX (cr=175 pr=43 pw=0 time=49486 us)(object id 30832)
    44547 INDEX FAST FULL SCAN PMT_SCHED_HUB_IDX_1 (cr=751 pr=84 pw=0 time=101490 us)(object id 30474)
    32745 TABLE ACCESS BY INDEX ROWID SPM_PAYMENT_SCHEDULE (cr=65492 pr=552 pw=0 time=3084181 us)
    32745 INDEX UNIQUE SCAN PMT_SCHED_PK (cr=32747 pr=34 pw=0 time=512373 us)(object id 30427)
    32745 TABLE ACCESS BY INDEX ROWID SPM_CONTRACTS (cr=65492 pr=0 pw=0 time=820633 us)
    32745 INDEX UNIQUE SCAN CONTRACTS_PK (cr=32747 pr=0 pw=0 time=344850 us)(object id 30085)
    0 NESTED LOOPS (cr=94 pr=0 pw=0 time=3048 us)
    8 TABLE ACCESS BY INDEX ROWID SPM_CONTRACT_PCR (cr=70 pr=0 pw=0 time=2354 us)
    8 INDEX RANGE SCAN CONTRACT_PCR_CHILD_FK_I (cr=62 pr=0 pw=0 time=1915 us)(object id 30116)
    0 TABLE ACCESS BY INDEX ROWID SPM_CONTRACTS (cr=24 pr=0 pw=0 time=583 us)
    8 INDEX UNIQUE SCAN CONTRACTS_PK (cr=16 pr=0 pw=0 time=328 us)(object id 30085)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: HINT: FIRST_ROWS
    31 VIEW
    31 COUNT (STOPKEY)
    31 FILTER
    31 VIEW
    31 SORT (ORDER BY)
    32745 NESTED LOOPS
    32745 NESTED LOOPS
    32745 HASH JOIN
    32745 HASH JOIN
    32745 HASH JOIN
    32745 TABLE ACCESS MODE: ANALYZED (BY INDEX
    ROWID) OF 'SPM_CONTRACTS_HUB' (TABLE)
    65491 NESTED LOOPS
    32745 NESTED LOOPS
    149239 VIEW OF 'VW_SQ_2' (VIEW)
    149239 HASH (UNIQUE)
    197161 NESTED LOOPS
    9 VIEW OF 'VW_NSO_1' (VIEW)
    9 UNION-ALL
    8 NESTED LOOPS
    97 INDEX MODE: ANALYZED
    (RANGE SCAN) OF 'ROLE_TYPE_NDX' (INDEX)
    8 INDEX MODE: ANALYZED
    (UNIQUE SCAN) OF 'ROLE_USERS_PK' (INDEX
    (UNIQUE))
    1 FAST DUAL
    197161 INDEX MODE: ANALYZED (RANGE
    SCAN) OF 'UFD_CONTRACT_FK_I' (INDEX)
    32745 TABLE ACCESS MODE: ANALYZED (BY
    INDEX ROWID) OF 'SPM_CONTRACTS' (TABLE)
    149238 INDEX MODE: ANALYZED (UNIQUE SCAN)
    OF 'CONTRACTS_PK' (INDEX (UNIQUE))
    32745 INDEX MODE: ANALYZED (RANGE SCAN) OF
    'CONT_HUB_CONTRACT_FK_I' (INDEX)
    44590 TABLE ACCESS MODE: ANALYZED (FULL) OF
    'SPM_CANDIDATES' (TABLE)
    35864 INDEX MODE: ANALYZED (FAST FULL SCAN) OF
    'SPM_USERS_SNZ1_IDX' (INDEX)
    44547 INDEX MODE: ANALYZED (FAST FULL SCAN) OF
    'PMT_SCHED_HUB_IDX_1' (INDEX)
    32745 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF
    'SPM_PAYMENT_SCHEDULE' (TABLE)
    32745 INDEX MODE: ANALYZED (UNIQUE SCAN) OF
    'PMT_SCHED_PK' (INDEX (UNIQUE))
    32745 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF
    'SPM_CONTRACTS' (TABLE)
    32745 INDEX MODE: ANALYZED (UNIQUE SCAN) OF
    'CONTRACTS_PK' (INDEX (UNIQUE))
    0 NESTED LOOPS
    8 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF
    'SPM_CONTRACT_PCR' (TABLE)
    8 INDEX MODE: ANALYZED (RANGE SCAN) OF
    'CONTRACT_PCR_CHILD_FK_I' (INDEX)
    0 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF
    'SPM_CONTRACTS' (TABLE)
    8 INDEX MODE: ANALYZED (UNIQUE SCAN) OF 'CONTRACTS_PK'
    (INDEX (UNIQUE))
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 3 1.99 1.93 2 278 0 0
    Execute 3 0.00 0.00 0 0 0 0
    Fetch 12 46.54 79.51 14499 1494998 0 93
    total 18 48.53 81.44 14501 1495276 0 93
    Misses in library cache during parse: 3
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 45 0.11 0.09 0 0 0 0
    Execute 460 0.08 0.10 0 0 0 0
    Fetch 1571 0.13 0.17 6 2546 0 1135
    total 2076 0.32 0.37 6 2546 0 1135
    Misses in library cache during parse: 10
    Misses in library cache during execute: 10
    3 user SQL statements in session.
    460 internal SQL statements in session.
    463 SQL statements in session.
    3 statements EXPLAINed in this session.
    Trace file: tld4_ora_5894.trc
    Trace file compatibility: 10.01.00
    Sort options: fchela
    1 session in tracefile.
    3 user SQL statements in trace file.
    460 internal SQL statements in trace file.
    463 SQL statements in trace file.
    13 unique SQL statements in trace file.
    3 SQL statements EXPLAINed using schema:
    TLADM01.prof$plan_table
    Default table was used.
    Table was created.
    Table was dropped.
    4374 lines in trace file.
    214 elapsed seconds in trace file.
    pl. help identification of solutions to the poorly performing sqls

    TKPROF: Release 10.2.0.2.0 - Production on Thu Jun 12 09:25:26 2008
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Trace file: tld4_ora_5894.trc
    Sort options: fchela 
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    SELECT *
       FROM (SELECT elance_paginated_data.*, ROWNUM elance_current_row_number
               FROM (SELECT elance_original_data.*
                       FROM (SELECT   /*+ ordered use_nl(pm) use_hash(pm) use_nl(sph) index(pm PER_RFX_ID_TY_LATEST)*/ pm.loc_id, pm.poc_user_id, pm.ID, pm.code,
                                      pm.NAME, pm.rfx_cost_estimate_base,
                                      pm.date_created, pm.status_id,
                                      pm.version_number, pm.latest_ind,
                                      pm.cat_id cat_id, pm.sponsored_by_org_id,
                                      pm.project_manager_id,
                                      (SELECT COUNT (props.ID)
                                         FROM spm_proposal_rfx pr,
                                              spm_proposals props
                                        WHERE pr.rfx_id = pm.ID
                                          AND pr.proposal_id = props.ID
                                          AND props.status_id NOT IN (8101, 8108))
                                                               number_of_proposals,
                                      ch.contract_id,
                                      con.xref_contract xref_contract,
                                      sph.item_property_id process_type
                                 FROM spm_rfx pm,
                                      spm_contracts_hub ch,
                                      spm_contracts con,
                                      spm_properties_hub sph
                                WHERE pm.ID > 0
                                  AND pm.rfx_type = 'REQUEST'
                                  AND pm.latest_ind = 'Y'
                                  AND pm.ID = ch.rfx_id
                                  AND pm.owner_id = 4000
                                  AND pm.rfx_type = ch.type_of
                                  AND EXISTS (
                                         SELECT 1
                                           FROM spm_user_folder_details ufd
                                          WHERE ufd.contract_id = con.ID
                                            AND ufd.user_id IN (
                                                   SELECT ru.role_id
                                                     FROM spm_role_users ru,
                                                          spm_roles r
                                                    WHERE ru.user_id = 29 /* Change for GE env. : changed value from 257698 to 29 */
                                                      AND ru.role_id = r.ID
                                                      AND r.type_of =
                                                                  'ROLE_GROUP_TYPE'
                                                   UNION ALL
                                                   SELECT 29
                                                     FROM DUAL))
                                  AND con.ID = ch.contract_id
                                  AND sph.rfx_id = pm.ID
                                  AND sph.type_of = pm.rfx_type
                             ORDER BY pm.ID DESC) elance_original_data) elance_paginated_data
              WHERE ROWNUM <= 31)
      WHERE elance_current_row_number >= 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.65       0.64          1        130          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        4      9.55      29.16      10039     186553          0          31
    total        6     10.20      29.80      10040     186683          0          31
    Misses in library cache during parse: 1
    Optimizer mode: CHOOSE
    Parsing user id: 21  (TLADM01)
    Rows     Row Source Operation
         31  VIEW  (cr=186553 pr=10039 pw=0 time=29145812 us)
         31   COUNT STOPKEY (cr=186553 pr=10039 pw=0 time=29145749 us)
         31    FILTER  (cr=186553 pr=10039 pw=0 time=29145727 us)
         31     VIEW  (cr=185329 pr=10037 pw=0 time=29114147 us)
         31      SORT ORDER BY (cr=185329 pr=10037 pw=0 time=29113913 us)
      29536       TABLE ACCESS BY INDEX ROWID SPM_PROPERTIES_HUB (cr=81535 pr=9636 pw=0 time=30161718 us)
      59073        NESTED LOOPS  (cr=70280 pr=2137 pw=0 time=350415773 us)
      29536         HASH JOIN  (cr=11107 pr=2078 pw=0 time=4575599 us)
      29536          HASH JOIN  (cr=1900 pr=1891 pw=0 time=3358329 us)
      29536           TABLE ACCESS FULL SPM_RFX (cr=1068 pr=1066 pw=0 time=2287845 us)
      30935           INDEX FAST FULL SCAN PF_TEST_CHUB_IDX (cr=832 pr=825 pw=0 time=2280408 us)(object id 32367)
    181203          TABLE ACCESS FULL SPM_CONTRACTS (cr=9207 pr=187 pw=0 time=2356208 us)
      29536         INDEX RANGE SCAN PROPERTY_TYPE_RFX_IDX (cr=59173 pr=59 pw=0 time=994586 us)(object id 30553)
         31     NESTED LOOPS  (cr=1224 pr=2 pw=0 time=47898 us)
        242      VIEW  VW_NSO_1 (cr=708 pr=1 pw=0 time=29700 us)
        242       UNION-ALL  (cr=708 pr=1 pw=0 time=29430 us)
        242        NESTED LOOPS  (cr=708 pr=1 pw=0 time=28870 us)
        645         INDEX RANGE SCAN ROLE_TYPE_NDX (cr=31 pr=1 pw=0 time=11764 us)(object id 30685)
        242         INDEX UNIQUE SCAN ROLE_USERS_PK (cr=677 pr=0 pw=0 time=6000 us)(object id 30691)
          0        FAST DUAL  (cr=0 pr=0 pw=0 time=0 us)
         31      INDEX RANGE SCAN UFD_CONTRACT_FK_I (cr=516 pr=1 pw=0 time=28952 us)(object id 30848)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: CHOOSE
         31   VIEW
         31    COUNT (STOPKEY)
         31     FILTER
         31      VIEW
         31       SORT (ORDER BY)
      29536        TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                       'SPM_PROPERTIES_HUB' (TABLE)
      59073         NESTED LOOPS
      29536          HASH JOIN
      29536           HASH JOIN
      29536            TABLE ACCESS   MODE: ANALYZED (FULL) OF
                           'SPM_RFX' (TABLE)
      30935            INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                           'PF_TEST_CHUB_IDX' (INDEX)
    181203           TABLE ACCESS   MODE: ANALYZED (FULL) OF
                          'SPM_CONTRACTS' (TABLE)
      29536          INDEX   MODE: ANALYZED (RANGE SCAN) OF
                         'PROPERTY_TYPE_RFX_IDX' (INDEX)
         31      NESTED LOOPS
        242       VIEW OF 'VW_NSO_1' (VIEW)
        242        UNION-ALL
        242         NESTED LOOPS
        645          INDEX   MODE: ANALYZED (RANGE SCAN) OF
                         'ROLE_TYPE_NDX' (INDEX)
        242          INDEX   MODE: ANALYZED (UNIQUE SCAN) OF
                         'ROLE_USERS_PK' (INDEX (UNIQUE))
          0         FAST DUAL
         31       INDEX   MODE: ANALYZED (RANGE SCAN) OF
                      'UFD_CONTRACT_FK_I' (INDEX)
    SELECT *
      FROM (SELECT elance_paginated_data.*, ROWNUM elance_current_row_number
              FROM (SELECT elance_original_data.*
                      FROM (SELECT   /*+ FIRST_ROWS ordered use_nl(con) use_nl(vp)*/
                                     vp.primary_contact_userid, con.ID, con.code,
                                     con.type_of_sub_contract, con.NAME,
                                     con.org_id, con.cat_id, con.ccy_code,
                                     con.end_dt, con.start_dt, con.date_created,
                                     con.xref_contract extrefrequestid,
                                     con.vendor_id, con.status_id,
                                     vp.NAME vendor_name, buyer.NAME AS org_name,
                                     con.created_by,
                                     contract_pcr.CHILD change_order_id,
                                     NVL
                                        (con.change_contract_status_id,
                                         -1
                                        ) AS change_contract_status_id,
                                     (SELECT approved_amount
                                        FROM spm_order_summary sos
                                       WHERE sos.contract_id = con.ID
                                         AND sos.po_id = sos.master_po_id)
                                                                        est_value,
                                     (SELECT billable_amount
                                        FROM spm_order_summary sos
                                       WHERE sos.contract_id = con.ID
                                         AND sos.po_id = sos.master_po_id)
                                                                 invoicableamount
                                FROM   spm_contracts con,
                                     (SELECT contract_id_parent PARENT,
                                             contract_id_child CHILD
                                        FROM spm_contract_pcr cp
                                       WHERE cp.type_of_relation =
                                                               'CONTR_NEW_VERSION') contract_pcr,
                                     spm_vendor_profiles vp,
                                     spm_contracts_hub hub1,
                                     spm_orgs orgs,
                                     spm_orgs buyer
                               WHERE con.owner_id = 4000 /* Change for GE env. : changed value from 100 to 4000 */
                                 AND EXISTS (
                                        SELECT 1
                                          FROM spm_user_folder_details ufd
                                         WHERE ufd.contract_id = con.ID
                                           AND ufd.user_id IN (
                                                  SELECT ru.role_id
                                                    FROM spm_role_users ru,
                                                         spm_roles r
                                                   WHERE ru.user_id = 29 /* Change for GE env. : changed value from 257698 to 29 */
                                                     AND ru.role_id = r.ID
                                                     AND r.type_of =
                                                                 'ROLE_GROUP_TYPE'
                                                  UNION ALL
                                                  SELECT 29 /* Change for GE env. : changed value from 257698 to 29 */
                                                    FROM DUAL))
                                 AND (   con.version_number = 1
                                      OR NOT EXISTS (
                                            SELECT /*+ use_nl(pcr) */ 1
                                              FROM spm_contract_pcr pcr,
                                                   spm_contracts ord2
                                             WHERE pcr.contract_id_child = con.ID
                                               AND pcr.type_of_relation =
                                                               'CONTR_NEW_VERSION'
                                               AND pcr.contract_id_parent =
                                                                           ord2.ID
                                               AND (   ord2.status_id = 2612
                                                    OR (    ord2.status_id = 2611
                                                        AND con.status_id NOT IN
                                                               (2612,
                                                                2604,
                                                                2611,
                                                                2609,
                                                                2610
                                 AND con.contract_type_id = 322
                                 AND con.ID = contract_pcr.PARENT(+)
                                 AND con.ID = hub1.contract_id
                                 AND hub1.type_of != 'PROJECT_CONTRACT'
                                 AND orgs.ID = con.org_id
                                 AND orgs.legal_org_id = buyer.ID
                                 AND vp.vendor_id = con.vendor_id
                                 AND con.status_id NOT IN (-1)
                                 AND NLS_UPPER (con.NAME) LIKE NLS_UPPER ('%%')
                            ORDER BY con.date_created DESC) elance_original_data) elance_paginated_data
             WHERE ROWNUM <= 31)
    WHERE elance_current_row_number >= 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.74       0.71          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        4     24.29      28.98       1001     826860          0          31
    total        6     25.03      29.69       1001     826860          0          31
    Misses in library cache during parse: 1
    Optimizer mode: FIRST_ROWS
    Parsing user id: 21  (TLADM01)
    Rows     Row Source Operation
         31  VIEW  (cr=826860 pr=1001 pw=0 time=28977412 us)
         31   COUNT STOPKEY (cr=826860 pr=1001 pw=0 time=28977363 us)
         31    VIEW  (cr=826860 pr=1001 pw=0 time=28977339 us)
         31     SORT ORDER BY STOPKEY (cr=826860 pr=1001 pw=0 time=28977308 us)
      76885      FILTER  (cr=482076 pr=426 pw=0 time=17625245 us)
      76986       HASH JOIN  (cr=430532 pr=160 pw=0 time=14013505 us)
       1436        VIEW  index$_join$_012 (cr=23 pr=0 pw=0 time=16833 us)
       1436         HASH JOIN  (cr=23 pr=0 pw=0 time=15394 us)
       1436          INDEX FAST FULL SCAN ORG_PK (cr=9 pr=0 pw=0 time=511 us)(object id 30407)
       1436          INDEX FAST FULL SCAN PF_ORG_NAME (cr=14 pr=0 pw=0 time=140 us)(object id 32369)
      76986        HASH JOIN  (cr=430509 pr=160 pw=0 time=13604330 us)
        234         VIEW  index$_join$_011 (cr=18 pr=0 pw=0 time=4429 us)
        234          HASH JOIN  (cr=18 pr=0 pw=0 time=4427 us)
        234           INDEX FAST FULL SCAN SPM_ORGS_MHP1_IDX (cr=9 pr=0 pw=0 time=325 us)(object id 30398)
       1436           INDEX FAST FULL SCAN ORG_PK (cr=9 pr=0 pw=0 time=62 us)(object id 30407)
      76986         HASH JOIN  (cr=430491 pr=160 pw=0 time=13360369 us)
      76986          TABLE ACCESS BY INDEX ROWID SPM_VENDOR_PROFILES (cr=429740 pr=106 pw=0 time=12146037 us)
    153973           NESTED LOOPS  (cr=377498 pr=99 pw=0 time=105010507 us)
      76986            HASH JOIN RIGHT OUTER (cr=300158 pr=99 pw=0 time=8281127 us)
       7515             INDEX FAST FULL SCAN CONTRACT_PCR_PK (cr=643 pr=30 pw=0 time=46192 us)(object id 30115)
      76986             NESTED LOOPS  (cr=299515 pr=69 pw=0 time=7155318 us)
    149239              VIEW  VW_SQ_2 (cr=724 pr=0 pw=0 time=749186 us)
    149239               HASH UNIQUE (cr=724 pr=0 pw=0 time=599938 us)
    197161                NESTED LOOPS  (cr=724 pr=0 pw=0 time=394773 us)
          9                 VIEW  VW_NSO_1 (cr=100 pr=0 pw=0 time=1160 us)
          9                  UNION-ALL  (cr=100 pr=0 pw=0 time=1138 us)
          8                   NESTED LOOPS  (cr=100 pr=0 pw=0 time=1004 us)
         97                    INDEX RANGE SCAN ROLE_TYPE_NDX (cr=1 pr=0 pw=0 time=368 us)(object id 30685)
          8                    INDEX UNIQUE SCAN ROLE_USERS_PK (cr=99 pr=0 pw=0 time=964 us)(object id 30691)
          1                   FAST DUAL  (cr=0 pr=0 pw=0 time=4 us)
    197161                 INDEX RANGE SCAN UFD_CONTRACT_FK_I (cr=624 pr=0 pw=0 time=197535 us)(object id 30848)
      76986              TABLE ACCESS BY INDEX ROWID SPM_CONTRACTS (cr=298791 pr=69 pw=0 time=6642668 us)
    149238               INDEX UNIQUE SCAN CONTRACTS_PK (cr=149553 pr=0 pw=0 time=2335192 us)(object id 30085)
      76986            INDEX RANGE SCAN VNDR_PROF_VNDR_FK_I (cr=77340 pr=0 pw=0 time=1613500 us)(object id 30959)
    202239          INDEX FAST FULL SCAN CONT_HUB_CONTID_TYPEOF_IDX (cr=751 pr=54 pw=0 time=218580 us)(object id 30101)
        101       NESTED LOOPS  (cr=51544 pr=266 pw=0 time=2191923 us)
       7515        TABLE ACCESS BY INDEX ROWID SPM_CONTRACT_PCR (cr=28999 pr=266 pw=0 time=1779904 us)
      17120         INDEX RANGE SCAN CONTRACT_PCR_CHILD_FK_I (cr=19262 pr=80 pw=0 time=583382 us)(object id 30116)
        101        TABLE ACCESS BY INDEX ROWID SPM_CONTRACTS (cr=22545 pr=0 pw=0 time=383707 us)
       7515         INDEX UNIQUE SCAN CONTRACTS_PK (cr=15030 pr=0 pw=0 time=226188 us)(object id 30085)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: HINT: FIRST_ROWS
         31   VIEW
         31    COUNT (STOPKEY)
         31     VIEW
         31      SORT (ORDER BY STOPKEY)
      76885       FILTER
      76986        HASH JOIN
       1436         VIEW OF 'index$_join$_012' (VIEW)
       1436          HASH JOIN
       1436           INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                          'ORG_PK' (INDEX (UNIQUE))
       1436           INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                          'PF_ORG_NAME' (INDEX)
      76986         HASH JOIN
        234          VIEW OF 'index$_join$_011' (VIEW)
        234           HASH JOIN
        234            INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                           'SPM_ORGS_MHP1_IDX' (INDEX)
       1436            INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                           'ORG_PK' (INDEX (UNIQUE))
      76986          HASH JOIN
      76986           TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID)
                          OF 'SPM_VENDOR_PROFILES' (TABLE)
    153973            NESTED LOOPS
      76986             HASH JOIN (RIGHT OUTER)
       7515              INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                             'CONTRACT_PCR_PK' (INDEX (UNIQUE))
      76986              NESTED LOOPS
    149239               VIEW OF 'VW_SQ_2' (VIEW)
    149239                HASH (UNIQUE)
    197161                 NESTED LOOPS
          9                  VIEW OF 'VW_NSO_1' (VIEW)
          9                   UNION-ALL
          8                    NESTED LOOPS
         97                     INDEX   MODE: ANALYZED
                                    (RANGE SCAN) OF 'ROLE_TYPE_NDX' (INDEX)
          8                     INDEX   MODE: ANALYZED
                                  (UNIQUE SCAN) OF 'ROLE_USERS_PK' (INDEX
                                    (UNIQUE))
          1                    FAST DUAL
    197161                  INDEX   MODE: ANALYZED (RANGE SCAN)
                                  OF 'UFD_CONTRACT_FK_I' (INDEX)
      76986               TABLE ACCESS   MODE: ANALYZED (BY INDEX
                              ROWID) OF 'SPM_CONTRACTS' (TABLE)
    149238                INDEX   MODE: ANALYZED (UNIQUE SCAN)
                               OF 'CONTRACTS_PK' (INDEX (UNIQUE))
      76986             INDEX   MODE: ANALYZED (RANGE SCAN) OF
                            'VNDR_PROF_VNDR_FK_I' (INDEX)
    202239           INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                          'CONT_HUB_CONTID_TYPEOF_IDX' (INDEX)
        101        NESTED LOOPS
       7515         TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                        'SPM_CONTRACT_PCR' (TABLE)
      17120          INDEX   MODE: ANALYZED (RANGE SCAN) OF
                         'CONTRACT_PCR_CHILD_FK_I' (INDEX)
        101         TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                        'SPM_CONTRACTS' (TABLE)
       7515          INDEX   MODE: ANALYZED (UNIQUE SCAN) OF
                         'CONTRACTS_PK' (INDEX (UNIQUE))
    SELECT *
      FROM (SELECT elance_paginated_data.*, ROWNUM elance_current_row_number
              FROM (SELECT elance_original_data.*
                      FROM (SELECT   /*+first_rows ordered use_nl(cont) use_nl(conthub) use_nl(sps) */
                                     cont.ID AS workorderid,
                                     cont.status_id AS statusid,
                                     cont.code AS workordercode,
                                     cont.NAME AS workordertitle,
                                     cont.description AS workorderdescription,
                                     cont.start_dt AS startdate,
                                     cont.end_dt AS enddate,
                                     cont.termination_dt AS terminationdate,
                                     cont.user_id AS hiring_manager_user_id,
                                     cont.org_id AS org_id,
                                     conthub.user_id AS contractorid,
                                --     cand.last_name AS last_name,
                                        cand.last_name
                                     || ',  '
                                     || cand.first_name AS candidatename,
                                     cand.became_userid AS became_userid,
                                     su.display_name AS hiring_manager_name,
                                     ord.cat_id AS cat_id, ord.ID AS order_id,
                                     ord.code AS order_code,
                                     ord.NAME AS order_name,
                                     ord.version_number AS version_number
                                FROM spm_contracts cont,
                                     spm_contracts_hub conthub,
                                     spm_candidates cand,
                                     spm_users su,
                                     spm_pmt_sched_hub spsh,
                                     spm_payment_schedule sps,
                                     spm_contracts ord
                               WHERE cont.owner_id = 4000 /* Change for GE env. : changed value from 100 to 4000 */
                                 AND cont.contract_type_id = 323
                                 AND cont.status_id IN (8705, 8709, 8708, 8702)
                                 AND EXISTS (
                                        SELECT 1
                                          FROM spm_user_folder_details ufd
                                         WHERE ufd.contract_id = cont.ID
                                           AND ufd.user_id IN (
                                                  SELECT ru.role_id
                                                    FROM spm_role_users ru,
                                                         spm_roles r
                                                   WHERE ru.user_id = 29 /* Change for GE env. : changed value from 257698 to 29 */
                                                     AND ru.role_id = r.ID
                                                     AND r.type_of =
                                                                 'ROLE_GROUP_TYPE'
                                                  UNION ALL
                                                  SELECT 29 /* Change for GE env. : changed value from 257698 to 29 */
                                                    FROM DUAL))
                                 AND NOT EXISTS (
                                        SELECT /*+ use_nl(pcr) */ 1
                                          FROM spm_contract_pcr pcr,
                                               spm_contracts ord2
                                         WHERE pcr.contract_id_child = ord.ID
                                           AND pcr.contract_id_parent = ord2.ID
                                           AND ord2.status_id = 2612
                                           AND pcr.type_of_relation IN
                                                  ('CONTR_NEW_VERSION',
                                                   'CONTRACTOR_REENGAGED'
                                 AND cont.ID = conthub.contract_id
                                 AND conthub.type_of = 'CANDIDATE'
                                 AND conthub.candidate_id = cand.ID
                                 AND cont.user_id = su.ID
                                 AND cont.ID = spsh.contract_id
                                 AND spsh.pmt_sched_id = sps.ID
                                 AND sps.contract_id = ord.ID
                            ORDER BY workorderid DESC) elance_original_data) elance_paginated_data
             WHERE ROWNUM <= 31)
    WHERE elance_current_row_number >= 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.60       0.57          1        148          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        4     12.70      21.37       3459     481585          0          31
    total        6     13.30      21.94       3460     481733          0          31
    Misses in library cache during parse: 1
    Optimizer mode: FIRST_ROWS
    Parsing user id: 21  (TLADM01)
    Rows     Row Source Operation
         31  VIEW  (cr=481585 pr=3459 pw=0 time=21365544 us)
         31   COUNT STOPKEY (cr=481585 pr=3459 pw=0 time=21365480 us)
         31    FILTER  (cr=481585 pr=3459 pw=0 time=21365455 us)
         31     VIEW  (cr=481491 pr=3459 pw=0 time=21366696 us)
         31      SORT ORDER BY (cr=481491 pr=3459 pw=0 time=21366310 us)
      32745       NESTED LOOPS  (cr=481491 pr=3459 pw=0 time=19266638 us)
      32745        NESTED LOOPS  (cr=415999 pr=3459 pw=0 time=18415173 us)
      32745         HASH JOIN  (cr=350507 pr=2907 pw=0 time=16695622 us)
      32745          HASH JOIN  (cr=349756 pr=2823 pw=0 time=16056095 us)
      32745           HASH JOIN  (cr=349581 pr=2780 pw=0 time=16950617 us)
      32745            TABLE ACCESS BY INDEX ROWID SPM_CONTRACTS_HUB (cr=347407 pr=610 pw=0 time=8351793 us)
      65491             NESTED LOOPS  (cr=332023 pr=338 pw=0 time=105243492 us)
      32745              NESTED LOOPS  (cr=299202 pr=298 pw=0 time=6616161 us)
    149239               VIEW  VW_SQ_2 (cr=724 pr=53 pw=0 time=1118731 us)
    149239                HASH UNIQUE (cr=724 pr=53 pw=0 time=969487 us)
    197161                 NESTED LOOPS  (cr=724 pr=53 pw=0 time=394854 us)
          9                  VIEW  VW_NSO_1 (cr=100 pr=0 pw=0 time=1288 us)
          9                   UNION-ALL  (cr=100 pr=0 pw=0 time=1269 us)
          8                    NESTED LOOPS  (cr=100 pr=0 pw=0 time=1133 us)
         97                     INDEX RANGE SCAN ROLE_TYPE_NDX (cr=1 pr=0 pw=0 time=514 us)(object id 30685)
          8                     INDEX UNIQUE SCAN ROLE_USERS_PK (cr=99 pr=0 pw=0 time=1140 us)(object id 30691)
          1                    FAST DUAL  (cr=0 pr=0 pw=0 time=4 us)
    197161                  INDEX RANGE SCAN UFD_CONTRACT_FK_I (cr=624 pr=53 pw=0 time=197643 us)(object id 30848)
      32745               TABLE ACCESS BY INDEX ROWID SPM_CONTRACTS (cr=298478 pr=245 pw=0 time=7787761 us)
    149238                INDEX UNIQUE SCAN CONTRACTS_PK (cr=149240 pr=59 pw=0 time=2627776 us)(object id 30085)
      32745              INDEX RANGE SCAN CONT_HUB_CONTRACT_FK_I (cr=32821 pr=40 pw=0 time=1129934 us)(object id 30106)
      44590            TABLE ACCESS FULL SPM_CANDIDATES (cr=2174 pr=2170 pw=0 time=695935 us)
      35864           INDEX FAST FULL SCAN SPM_USERS_SNZ1_IDX (cr=175 pr=43 pw=0 time=49486 us)(object id 30832)
      44547          INDEX FAST FULL SCAN PMT_SCHED_HUB_IDX_1 (cr=751 pr=84 pw=0 time=101490 us)(object id 30474)
      32745         TABLE ACCESS BY INDEX ROWID SPM_PAYMENT_SCHEDULE (cr=65492 pr=552 pw=0 time=3084181 us)
      32745          INDEX UNIQUE SCAN PMT_SCHED_PK (cr=32747 pr=34 pw=0 time=512373 us)(object id 30427)
      32745        TABLE ACCESS BY INDEX ROWID SPM_CONTRACTS (cr=65492 pr=0 pw=0 time=820633 us)
      32745         INDEX UNIQUE SCAN CONTRACTS_PK (cr=32747 pr=0 pw=0 time=344850 us)(object id 30085)
          0     NESTED LOOPS  (cr=94 pr=0 pw=0 time=3048 us)
          8      TABLE ACCESS BY INDEX ROWID SPM_CONTRACT_PCR (cr=70 pr=0 pw=0 time=2354 us)
          8       INDEX RANGE SCAN CONTRACT_PCR_CHILD_FK_I (cr=62 pr=0 pw=0 time=1915 us)(object id 30116)
          0      TABLE ACCESS BY INDEX ROWID SPM_CONTRACTS (cr=24 pr=0 pw=0 time=583 us)
          8       INDEX UNIQUE SCAN CONTRACTS_PK (cr=16 pr=0 pw=0 time=328 us)(object id 30085)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: HINT: FIRST_ROWS
         31   VIEW
         31    COUNT (STOPKEY)
         31     FILTER
         31      VIEW
         31       SORT (ORDER BY)
      32745        NESTED LOOPS
      32745         NESTED LOOPS
      32745          HASH JOIN
      32745           HASH JOIN
      32745            HASH JOIN
      32745             TABLE ACCESS   MODE: ANALYZED (BY INDEX
                            ROWID) OF 'SPM_CONTRACTS_HUB' (TABLE)
      65491              NESTED LOOPS
      32745               NESTED LOOPS
    149239                VIEW OF 'VW_SQ_2' (VIEW)
    149239                 HASH (UNIQUE)
    197161                  NESTED LOOPS
          9                   VIEW OF 'VW_NSO_1' (VIEW)
          9                    UNION-ALL
          8                     NESTED LOOPS
         97                      INDEX   MODE: ANALYZED
                                     (RANGE SCAN) OF 'ROLE_TYPE_NDX' (INDEX)
          8                      INDEX   MODE: ANALYZED
                                   (UNIQUE SCAN) OF 'ROLE_USERS_PK' (INDEX
                                     (UNIQUE))
          1                     FAST DUAL
    197161                   INDEX   MODE: ANALYZED (RANGE
                                  SCAN) OF 'UFD_CONTRACT_FK_I' (INDEX)
      32745                TABLE ACCESS   MODE: ANALYZED (BY
                               INDEX ROWID) OF 'SPM_CONTRACTS' (TABLE)
    149238                 INDEX   MODE: ANALYZED (UNIQUE SCAN)
                                OF 'CONTRACTS_PK' (INDEX (UNIQUE))
      32745               INDEX   MODE: ANALYZED (RANGE SCAN) OF
                              'CONT_HUB_CONTRACT_FK_I' (INDEX)
      44590             TABLE ACCESS   MODE: ANALYZED (FULL) OF
                            'SPM_CANDIDATES' (TABLE)
      35864            INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                           'SPM_USERS_SNZ1_IDX' (INDEX)
      44547           INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                          'PMT_SCHED_HUB_IDX_1' (INDEX)
      32745          TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                         'SPM_PAYMENT_SCHEDULE' (TABLE)
      32745           INDEX   MODE: ANALYZED (UNIQUE SCAN) OF
                          'PMT_SCHED_PK' (INDEX (UNIQUE))
      32745         TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                        'SPM_CONTRACTS' (TABLE)
      32745          INDEX   MODE: ANALYZED (UNIQUE SCAN) OF
                         'CONTRACTS_PK' (INDEX (UNIQUE))
          0      NESTED LOOPS
          8       TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                      'SPM_CONTRACT_PCR' (TABLE)
          8        INDEX   MODE: ANALYZED (RANGE SCAN) OF
                       'CONTRACT_PCR_CHILD_FK_I' (INDEX)
          0       TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                      'SPM_CONTRACTS' (TABLE)
          8        INDEX   MODE: ANALYZED (UNIQUE SCAN) OF 'CONTRACTS_PK'
                       (INDEX (UNIQUE))
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        3      1.99       1.93          2        278          0           0
    Execute      3      0.00       0.00          0          0          0           0
    Fetch       12     46.54      79.51      14499    1494998          0          93
    total       18     48.53      81.44      14501    1495276          0          93
    Misses in library cache during parse: 3
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse       45      0.11       0.09          0          0          0           0
    Execute    460      0.08       0.10          0          0          0           0
    Fetch     1571      0.13       0.17          6       2546          0        1135
    total     2076      0.32       0.37          6       2546          0        1135
    Misses in library cache during parse: 10
    Misses in library cache during execute: 10
        3  user  SQL statements in session.
      460  internal SQL statements in session.
      463  SQL statements in session.
        3  statements EXPLAINed in this session.
    Trace file: tld4_ora_5894.trc
    Trace file compatibility: 10.01.00
    Sort options: fchela 
           1  session in tracefile.
           3  user  SQL statements in trace file.
         460  internal SQL statements in trace file.
         463  SQL statements in trace file.
          13  unique SQL statements in trace file.
           3  SQL statements EXPLAINed using schema:
               TLADM01.prof$plan_table
                 Default table was used.
                 Table was created.
                 Table was dropped.
        4374  lines in trace file.
         214  elapsed seconds in trace file.

  • How to reduce the query fetch from TKPROF output?

    Hi,
    Below is my query contains the TKPROF output.Here fetch is too high. How to reduce the fetch from here. And please check the explain plan is good or not?
    SELECT  czci.config_hdr_id,
            czci.config_rev_nbr,
            asoqla.quantity,
             (SELECT
                    node_desc.LOCALIZED_STR
                 FROM   CZ_LOCALIZED_TEXTS node_desc,
                        CZ_PS_NODES ps_nodes,
                        CZ_CONFIG_ITEMS czci1
                WHERE   czci1.config_hdr_id = asoqld.config_header_id
                AND     czci1.config_rev_nbr = asoqld.config_revision_num
                AND    node_desc.INTL_TEXT_ID = ps_nodes.INTL_TEXT_ID
                AND     NVL(node_desc.LANGUAGE,userenv('LANG')) = userenv('LANG')
                AND     czci1.PS_NODE_ID = ps_nodes.PERSISTENT_NODE_ID
                 AND    ps_nodes.DEVL_PROJECT_ID = (SELECT MAX(DEVL_PROJECT_ID) FROM CZ_DEVL_PROJECTS WHERE NAME LIKE 'Control Model')
                AND czci1.PARENT_CONFIG_ITEM_ID IN (SELECT sub_sub.CONFIG_ITEM_ID FROM CZ_CONFIG_ITEMS sub_sub
                                                        WHERE sub_sub.CONFIG_HDR_ID = asoqld.config_header_id
                                                        AND sub_sub.CONFIG_REV_NBR = asoqld.config_revision_num
                                                        AND      sub_sub.PS_NODE_NAME = 'fittings')) fitting_material,
             (SELECT
                    node_desc.LOCALIZED_STR
                 FROM   CZ_LOCALIZED_TEXTS node_desc,
                        CZ_PS_NODES ps_nodes,
                        CZ_CONFIG_ITEMS czci
                WHERE   czci.config_hdr_id = asoqld.config_header_id
                AND     czci.config_rev_nbr = asoqld.config_revision_num
                AND    node_desc.INTL_TEXT_ID = ps_nodes.INTL_TEXT_ID
                AND NVL(node_desc.LANGUAGE,userenv('LANG')) = userenv('LANG')
                AND     czci.PS_NODE_ID = ps_nodes.PERSISTENT_NODE_ID
                 AND    ps_nodes.DEVL_PROJECT_ID = (SELECT MAX(DEVL_PROJECT_ID) FROM CZ_DEVL_PROJECTS WHERE NAME LIKE 'Control Model')
                AND czci.PARENT_CONFIG_ITEM_ID IN (SELECT sub_sub.CONFIG_ITEM_ID FROM CZ_CONFIG_ITEMS sub_sub
                                                        WHERE sub_sub.CONFIG_HDR_ID = czci.CONFIG_HDR_ID
                                                        AND sub_sub.CONFIG_REV_NBR = czci.CONFIG_REV_NBR
                                                        AND      sub_sub.PS_NODE_NAME = 'tubing')) tubing_material
    FROM    aso_quote_lines_all asoqla,
            aso_quote_line_details asoqld,
            cz_config_items czci
    WHERE   asoqla.quote_header_id = 55774
    AND     asoqla.item_type_code = 'MDL'
    --AND     asoqla.org_id = 2763
    AND     asoqla.quote_line_id = asoqld.quote_line_id
    AND     asoqld.config_header_id = czci.config_hdr_id
    AND     asoqld.config_revision_num = czci.config_rev_nbr
    AND     czci.ps_node_name = 'CONTROL MASTER ASLY'
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.04       0.03          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        3      0.09       0.08          0       5100          0          19
    total        5      0.13       0.12          0       5100          0          19
    Misses in library cache during parse: 1
    Optimizer goal: ALL_ROWS
    Parsing user id: 173  (APPS)
    Rows     Row Source Operation
          3  TABLE ACCESS BY INDEX ROWID CZ_LOCALIZED_TEXTS (cr=2161 pr=0 pw=0 time=32425 us)
         40   NESTED LOOPS  (cr=2158 pr=0 pw=0 time=32276 us)
          3    NESTED LOOPS  (cr=2147 pr=0 pw=0 time=32156 us)
          3     NESTED LOOPS  (cr=925 pr=0 pw=0 time=15885 us)
          3      TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=665 pr=0 pw=0 time=13456 us)
       5490       INDEX RANGE SCAN CZ_CONFIG_ITEMS_PK (cr=96 pr=0 pw=0 time=1237 us)(object id 3049621)
          3      TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=260 pr=0 pw=0 time=2401 us)
       1094       INDEX RANGE SCAN CZ_CONFIG_ITEMS_PK (cr=19 pr=0 pw=0 time=250 us)(object id 3049621)
          3     TABLE ACCESS BY INDEX ROWID CZ_PS_NODES (cr=1222 pr=0 pw=0 time=16249 us)
          3      INDEX RANGE SCAN CZ_PS_NODES_N12 (cr=1219 pr=0 pw=0 time=16211 us)(object id 750095)
          1       SORT AGGREGATE (cr=1211 pr=0 pw=0 time=16125 us)
        209        TABLE ACCESS FULL CZ_DEVL_PROJECTS (cr=1211 pr=0 pw=0 time=15883 us)
         18    INDEX RANGE SCAN CZ_LOCALIZED_TEXTS_N1 (cr=11 pr=0 pw=0 time=68 us)(object id 31504)
          3  TABLE ACCESS BY INDEX ROWID CZ_LOCALIZED_TEXTS (cr=2161 pr=0 pw=0 time=31499 us)
         40   NESTED LOOPS  (cr=2158 pr=0 pw=0 time=31351 us)
          3    NESTED LOOPS  (cr=2147 pr=0 pw=0 time=31215 us)
          3     NESTED LOOPS  (cr=925 pr=0 pw=0 time=15271 us)
          3      TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=665 pr=0 pw=0 time=12441 us)
       5490       INDEX RANGE SCAN CZ_CONFIG_ITEMS_PK (cr=96 pr=0 pw=0 time=1230 us)(object id 3049621)
          3      TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=260 pr=0 pw=0 time=2795 us)
       1094       INDEX RANGE SCAN CZ_CONFIG_ITEMS_PK (cr=19 pr=0 pw=0 time=264 us)(object id 3049621)
          3     TABLE ACCESS BY INDEX ROWID CZ_PS_NODES (cr=1222 pr=0 pw=0 time=15920 us)
          3      INDEX RANGE SCAN CZ_PS_NODES_N12 (cr=1219 pr=0 pw=0 time=15863 us)(object id 750095)
          1       SORT AGGREGATE (cr=1211 pr=0 pw=0 time=15753 us)
        209        TABLE ACCESS FULL CZ_DEVL_PROJECTS (cr=1211 pr=0 pw=0 time=15452 us)
         18    INDEX RANGE SCAN CZ_LOCALIZED_TEXTS_N1 (cr=11 pr=0 pw=0 time=79 us)(object id 31504)
         19  TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=778 pr=0 pw=0 time=20571 us)
       5816   NESTED LOOPS  (cr=202 pr=0 pw=0 time=8497 us)
         21    NESTED LOOPS  (cr=96 pr=0 pw=0 time=2037 us)
         23     TABLE ACCESS BY INDEX ROWID ASO_QUOTE_LINES_ALL (cr=47 pr=0 pw=0 time=1427 us)
       1058      INDEX RANGE SCAN ASO_QUOTE_LINES_ALL_N1 (cr=9 pr=0 pw=0 time=51 us)(object id 81688)
         21     TABLE ACCESS BY INDEX ROWID ASO_QUOTE_LINE_DETAILS (cr=49 pr=0 pw=0 time=596 us)
         21      INDEX RANGE SCAN ASO_QUOTE_LINE_DETAILS_N1 (cr=28 pr=0 pw=0 time=323 us)(object id 81706)
       5794    INDEX RANGE SCAN CZ_CONFIG_ITEMS_PK (cr=106 pr=0 pw=0 time=1424 us)(object id 3049621)

    Hi
    After affed the exist operator i got below output. But it is more than that the previous one.
    SELECT czci.config_hdr_id, czci.config_rev_nbr, asoqla.quantity,
           (SELECT node_desc.localized_str
              FROM cz_localized_texts node_desc,
                   cz_ps_nodes ps_nodes,
                   cz_config_items czci1
             WHERE czci1.config_hdr_id = asoqld.config_header_id
               AND czci1.config_rev_nbr = asoqld.config_revision_num
               AND node_desc.intl_text_id = ps_nodes.intl_text_id
               AND NVL (node_desc.LANGUAGE, USERENV ('LANG')) = USERENV ('LANG')
               AND czci1.ps_node_id = ps_nodes.persistent_node_id
               AND ps_nodes.devl_project_id = (SELECT MAX (devl_project_id)
                                                 FROM cz_devl_projects
                                                WHERE NAME = 'Control Model')
               AND EXISTS (
                      SELECT NULL
                        FROM cz_config_items sub_sub
                       WHERE sub_sub.config_hdr_id = asoqld.config_header_id
                         AND sub_sub.config_rev_nbr = asoqld.config_revision_num
                         AND sub_sub.ps_node_name = 'fittings'
                         AND czci1.parent_config_item_id = sub_sub.config_item_id))
                                                                 fitting_material,
           (SELECT node_desc.localized_str
              FROM cz_localized_texts node_desc,
                   cz_ps_nodes ps_nodes,
                   cz_config_items czci1
             WHERE czci1.config_hdr_id = asoqld.config_header_id
               AND czci1.config_rev_nbr = asoqld.config_revision_num
               AND node_desc.intl_text_id = ps_nodes.intl_text_id
               AND node_desc.LANGUAGE = USERENV ('LANG')
               AND czci1.ps_node_id = ps_nodes.persistent_node_id
               AND ps_nodes.devl_project_id = (SELECT MAX (devl_project_id)
                                                 FROM cz_devl_projects
                                                WHERE NAME = 'Control Model')
               AND EXISTS (
                      SELECT NULL
                        FROM cz_config_items sub_sub
                       WHERE sub_sub.config_hdr_id = czci.config_hdr_id
                         AND sub_sub.config_rev_nbr = czci.config_rev_nbr
                         AND sub_sub.ps_node_name = 'tubing'
                         AND czci1.parent_config_item_id = sub_sub.config_item_id))
                                                                  tubing_material
      FROM aso_quote_lines_all asoqla,
           aso_quote_line_details asoqld,
           cz_config_items czci
    WHERE asoqla.quote_header_id = 55774
       AND asoqla.item_type_code = 'MDL'
    --AND     asoqla.org_id = 2763
       AND asoqla.quote_line_id = asoqld.quote_line_id
       AND asoqld.config_header_id = czci.config_hdr_id
       AND asoqld.config_revision_num = czci.config_rev_nbr
       AND czci.ps_node_name = 'CONTROL MASTER ASLY'
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.02       0.03          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        3      0.16       0.14          0      16526          0          19
    total        5      0.18       0.17          0      16526          0          19
    Misses in library cache during parse: 1
    Optimizer goal: ALL_ROWS
    Parsing user id: 173  (APPS)
    Rows     Row Source Operation
          3  TABLE ACCESS BY INDEX ROWID CZ_LOCALIZED_TEXTS (cr=7874 pr=0 pw=0 time=51192 us)
         40   NESTED LOOPS  (cr=7871 pr=0 pw=0 time=50953 us)
          3    NESTED LOOPS  (cr=7860 pr=0 pw=0 time=50729 us)
          3     TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=6638 pr=0 pw=0 time=33183 us)
          3      INDEX RANGE SCAN CZ_CONFIG_ITEMS_N1 (cr=6635 pr=0 pw=0 time=33060 us)(object id 31734)
          3       TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=6536 pr=0 pw=0 time=22873 us)
       1292        INDEX UNIQUE SCAN CZ_CONFIG_ITEMS_PK (cr=5244 pr=0 pw=0 time=15326 us)(object id 3049621)
          3     TABLE ACCESS BY INDEX ROWID CZ_PS_NODES (cr=1222 pr=0 pw=0 time=17483 us)
          3      INDEX RANGE SCAN CZ_PS_NODES_N12 (cr=1219 pr=0 pw=0 time=17411 us)(object id 750095)
          1       SORT AGGREGATE (cr=1211 pr=0 pw=0 time=17266 us)
        209        TABLE ACCESS FULL CZ_DEVL_PROJECTS (cr=1211 pr=0 pw=0 time=16844 us)
         18    INDEX RANGE SCAN CZ_LOCALIZED_TEXTS_N1 (cr=11 pr=0 pw=0 time=122 us)(object id 31504)
          3  NESTED LOOPS  (cr=7874 pr=0 pw=0 time=48203 us)
          3   NESTED LOOPS  (cr=7860 pr=0 pw=0 time=47973 us)
          3    TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=6638 pr=0 pw=0 time=30352 us)
          3     INDEX RANGE SCAN CZ_CONFIG_ITEMS_N1 (cr=6635 pr=0 pw=0 time=30218 us)(object id 31734)
          3      TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=6536 pr=0 pw=0 time=20960 us)
       1292       INDEX UNIQUE SCAN CZ_CONFIG_ITEMS_PK (cr=5244 pr=0 pw=0 time=14224 us)(object id 3049621)
          3    TABLE ACCESS BY INDEX ROWID CZ_PS_NODES (cr=1222 pr=0 pw=0 time=17570 us)
          3     INDEX RANGE SCAN CZ_PS_NODES_N12 (cr=1219 pr=0 pw=0 time=17510 us)(object id 750095)
          1      SORT AGGREGATE (cr=1211 pr=0 pw=0 time=17395 us)
        209       TABLE ACCESS FULL CZ_DEVL_PROJECTS (cr=1211 pr=0 pw=0 time=16937 us)
          3   TABLE ACCESS BY INDEX ROWID CZ_LOCALIZED_TEXTS (cr=14 pr=0 pw=0 time=165 us)
          3    INDEX UNIQUE SCAN CZ_LOCALIZED_TEXTS_PK (cr=11 pr=0 pw=0 time=132 us)(object id 3050530)
         19  TABLE ACCESS BY INDEX ROWID CZ_CONFIG_ITEMS (cr=778 pr=0 pw=0 time=41677 us)
       5816   NESTED LOOPS  (cr=202 pr=0 pw=0 time=16173 us)
         21    NESTED LOOPS  (cr=96 pr=0 pw=0 time=3617 us)
         23     TABLE ACCESS BY INDEX ROWID ASO_QUOTE_LINES_ALL (cr=47 pr=0 pw=0 time=2528 us)
       1058      INDEX RANGE SCAN ASO_QUOTE_LINES_ALL_N1 (cr=9 pr=0 pw=0 time=83 us)(object id 81688)
         21     TABLE ACCESS BY INDEX ROWID ASO_QUOTE_LINE_DETAILS (cr=49 pr=0 pw=0 time=1053 us)
         21      INDEX RANGE SCAN ASO_QUOTE_LINE_DETAILS_N1 (cr=28 pr=0 pw=0 time=598 us)(object id 81706)
       5794    INDEX RANGE SCAN CZ_CONFIG_ITEMS_PK (cr=106 pr=0 pw=0 time=8245 us)(object id 3049621)

  • Tkprof output -- 10.2.0.4

    Hi All,
    I am facing a problem at the client side.The EOD process is taking long time.The database version is 10.2.0.4 and the OS is windows server 2003 R1
    03:57:20database >show parameter optimizer
    NAME                                 TYPE                             VALUE
    optimizer_dynamic_sampling           integer                          2
    optimizer_features_enable            string                           10.2.0.4
    optimizer_index_caching              integer                          0
    optimizer_index_cost_adj             integer                          10
    optimizer_mode                       string                           ALL_ROWS
    optimizer_secure_view_merging        boolean                          TRUE
    03:57:20database >
    03:57:20database >show parameter db_file_multi
    NAME                                 TYPE                             VALUE
    db_file_multiblock_read_count        integer                          64
    03:57:20database >
    03:57:20database >show parameter db_block_size
    NAME                                 TYPE                             VALUE
    db_block_size                        integer                          8192
    03:57:20database >
    03:57:20database >column sname format a20
    03:57:20database >column pname format a20
    03:57:20database >column pval2 format a20
    03:57:20database >
    03:57:20database >select
    03:57:20   2  sname
    03:57:20   3  , pname
    03:57:20   4  , pval1
    03:57:20   5  , pval2
    03:57:20   6  from
    03:57:20   7  sys.aux_stats$;
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          03-14-2008 19:37
    SYSSTATS_INFO        DSTOP                           03-14-2008 19:37
    SYSSTATS_INFO        FLAGS                         1
    SYSSTATS_MAIN        CPUSPEEDNW           1171.76471
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM
    SYSSTATS_MAIN        MREADTIM
    SYSSTATS_MAIN        CPUSPEED
    SYSSTATS_MAIN        MBRC
    SYSSTATS_MAIN        MAXTHR
    SYSSTATS_MAIN        SLAVETHR
    13 rows selected.
    04:01:38database >sho sga
    Total System Global Area  872415232 bytes
    Fixed Size                  1299660 bytes
    Variable Size             327158580 bytes
    Database Buffers          536870912 bytes
    Redo Buffers                7086080 bytes
    SGA_TARGET is set to 876609536
    ============================================================
    TKPROF: Release 10.2.0.4.0 - Production on Fri Apr 3 20:00:02 2009
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Trace file: E:\oracle\product\10.2.0\admin\user\udump\user_ora_456.trc
    Sort options: default
    SELECT *
    FROM
    CITY_CODES_UTI
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   7750      5.39       5.06          0          0          0           0
    Fetch     7750     14.48      14.35          0      23250          0       31000
    total    15500     19.87      19.42          0      23250          0       31000
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   TABLE ACCESS   MODE: ANALYZED (FULL) OF 'CITY_CODES_UTI' (TABLE)
    SELECT BIN,BANK_CODE
    FROM
    BIN_BANK ORDER BY BANK_CODE
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   7750      5.53       5.55          0          0          0           0
    Fetch     7750     14.60      14.07          0       7750          0       69750
    total    15500     20.14      19.63          0       7750          0       69750
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   SORT (ORDER BY)
          0    INDEX   MODE: ANALYZED (FULL SCAN) OF 'BIN_BANK_IDX' (INDEX)
    SELECT *
    FROM
    BANK_CURRENCY WHERE BANK_CODE=:B2 AND CUR_CODE=:B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   7750      5.48       4.97          0          0          0           0
    Fetch     7750      4.29       3.85          0       7750          0        7750
    total    15500      9.78       8.83          0       7750          0        7750
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   INDEX   MODE: ANALYZED (UNIQUE SCAN) OF 'PK_BANK_CUR_CODE'
                  (INDEX (UNIQUE))
    SELECT CARD_NO
    FROM
    TEST_CARDS WHERE CARD_NO=:B1 ORDER BY CARD_NO
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute  54346     45.56      41.30          0          0          0           0
    Fetch    54346    124.48     122.01          0     163038          0          70
    total   108692    170.04     163.31          0     163038          0          70
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   SORT (ORDER BY)
          0    TABLE ACCESS   MODE: ANALYZED (FULL) OF 'TEST_CARDS' (TABLE)
    SELECT NVL(DCC_FLAG,'N')
    FROM
    BANK_MASTER WHERE BANK_CODE = :B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute  27208     18.57      17.01          0          0          0           0
    Fetch    27208     15.62      13.78          0      54416          0       27208
    total    54416     34.20      30.80          0      54416          0       27208
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF 'BANK_MASTER'
                  (TABLE)
          0    INDEX   MODE: ANALYZED (UNIQUE SCAN) OF 'SYS_C006437' (INDEX
                   (UNIQUE))
    SELECT DQP_VALIDATION
    FROM
    BANK_RPTFORMAT WHERE BANK_CODE = :B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute  27208     17.87      16.04          0          0          0           0
    Fetch    27208     30.71      29.51          0      81624          0       27208
    total    54416     48.59      45.55          0      81624          0       27208
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   TABLE ACCESS   MODE: ANALYZED (FULL) OF 'BANK_RPTFORMAT' (TABLE)
    SELECT SUBSTR(TRANS, 4, 2)
    FROM
    RAW_BTH WHERE BTHSEQ = :B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute  42708     30.01      27.46          0          0          0           0
    Fetch    42708     82.06    6168.61       2014     170918          0       42708
    total    85416    112.07    6196.08       2014     170918          0       42708
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF 'RAW_BTH'
                  (TABLE)
          0    INDEX   MODE: ANALYZED (RANGE SCAN) OF 'RAW_BTH_IDX' (INDEX)
    SELECT BTH_KEY,BTH_NO
    FROM
    BTH_REG WHERE BTH_KEY = :B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   8219      6.09       5.21          0          0          0           0
    Fetch     8219      4.60       4.54          0      16559          0        1266
    total    16438     10.70       9.75          0      16559          0        1266
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   INDEX   MODE: ANALYZED (RANGE SCAN) OF 'BTH_REG_BTH_KEY_IDX'
                  (INDEX)
    SELECT COUNT(*)
    FROM
    BTH_REG WHERE BTH_KEY=:B2 ||:B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   8195      6.93       6.52          0          0          0           0
    Fetch     8195      5.70       4.88          0      16454          0        8195
    total    16390     12.64      11.41          0      16454          0        8195
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   SORT (AGGREGATE)
          0    INDEX   MODE: ANALYZED (RANGE SCAN) OF 'BTH_REG_IDX' (INDEX)
    SELECT *
    FROM
    ME_UTI WHERE MID_UTI=:B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   8195      6.37       6.20          0          0          0           0
    Fetch     8195   8983.73    9067.57          0   13595505          0        7750
    total    16390   8990.10    9073.78          0   13595505          0        7750
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   VIEW OF 'index$_join$_002' (VIEW)
          0    HASH JOIN
          0     INDEX   MODE: ANALYZED (RANGE SCAN) OF 'COMP' (INDEX)
          0     INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                    'CMPPK_MERCHANT_MASTER' (INDEX (UNIQUE))
    SELECT TRANS,BANK_CODE,BTHSEQ,VALIDITY_FLAG
    FROM
    RAW_BTH ORDER BY BANK_CODE,BTHSEQ
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch      536     12.39      13.24       1819          0          0       53600
    total      536     12.39      13.24       1819          0          0       53600
    Misses in library cache during parse: 0
    Parsing user id: 61  (user)   (recursive depth: 1)
    UPDATE BTH_REG SET BTH_NO=:B3
    WHERE
    BTH_KEY=:B2 ||:B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   1242      5.78       5.52          0       2504       8755        1242
    Fetch        0      0.00       0.00          0          0          0           0
    total     1242      5.78       5.52          0       2504       8755        1242
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  UPDATE STATEMENT   MODE: ALL_ROWS
          0   UPDATE OF 'BTH_REG'
          0    INDEX   MODE: ANALYZED (RANGE SCAN) OF 'BTH_REG_BTH_KEY_IDX'
                   (INDEX)
    SELECT TRANS,BANK_CODE,BTHSEQ
    FROM
    RAW_BTH WHERE BTHSEQ >= :B2 AND BTHSEQ <= :B1 ORDER BY BANK_CODE,BTHSEQ
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute    469      0.28       0.33          0          0          0           0
    Fetch      472    154.29     156.48        124     495389          0        3146
    total      941    154.57     156.81        124     495389          0        3146
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   FILTER
          0    TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF 'RAW_BTH'
                   (TABLE)
          0     INDEX   MODE: ANALYZED (FULL SCAN) OF
                    'RAW_BTH_BKCODE_SEQ_IDX' (INDEX)
    ********************************************************************************Especially in the below query the logical I/O is alot along with the elapsed time
    SELECT *
    FROM
    ME_UTI WHERE MID_UTI=:B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   8195      6.37       6.20          0          0          0           0
    Fetch     8195   8983.73    9067.57          0   13595505          0        7750
    total    16390   8990.10    9073.78          0   13595505          0        7750
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   VIEW OF 'index$_join$_002' (VIEW)
          0    HASH JOIN
          0     INDEX   MODE: ANALYZED (RANGE SCAN) OF 'COMP' (INDEX)
          0     INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                    'CMPPK_MERCHANT_MASTER' (INDEX (UNIQUE))
    04:16:43database >@index_col
    Enter value for table_name: ACQ_MERCHANT_MASTER
    Enter value for owner: user
    TABLE_NAME           INDEX_NAME                     COLUMN_NAME          COLUMN_POSITION
    ACQ_MERCHANT_MASTER  COMP                           DBANAME                            2
    ACQ_MERCHANT_MASTER  COMP                           MCC                                3
    ACQ_MERCHANT_MASTER  COMP                           BRANCH_CODE                        4
    ACQ_MERCHANT_MASTER  COMP                           MISC10                             5
    ACQ_MERCHANT_MASTER  COMP                           FIRC_FLAG                          6
    ACQ_MERCHANT_MASTER  COMP                           MCA_FLAG                           7
    ACQ_MERCHANT_MASTER  MEMASTTERMINALID               TERMINAL_ID                        1
    ACQ_MERCHANT_MASTER  CMPPK_MERCHANT_MASTER          MERCHANT_CODE                      1
    ACQ_MERCHANT_MASTER  CMPPK_MERCHANT_MASTER          BANK_CODE                          2
    ACQ_MERCHANT_MASTER  COMP                           BANK_CODE                          1
    10 rows selected.The ME_UTI is a view. The text of the view is
    04:07:41database >select VIEW_NAME,TEXT from  dba_views where view_name='ME_UTI';
    VIEW_NAME                      TEXT
    ME_UTI                         Select substr(lpad(merchant_code,15,'0'),4,12) MID_UTI,substr(dbaname,1,40) ME_NAME
                                  from ACQ_MERCHANT_MASTER
                                   where bank_code='00013'What are your suggestions????? What can be done.
    Anand

    >
    Anand,
    first of all I think that the row-by-row processing issue identified by others is much more significant to your batch processing run time than any of the things that I've mentioned. So you quite likely achieve the biggest gain in performance by re-writing the process to use plain SQL as much as possible instead of PL/SQL loops.
    That said, the parameters that I've questioned might be very reasonable for your particular environment. I just wanted to ask how you arrived at these values, e.g. measured your average index / block caching pattern to arrive at these values or similar.
    I agree with you.Higher db_file_multiblock_read_count and lower optimizer_index_cost_adj will make FTS more cheaper.No, not really. Your index based costs are 10 times lower, but your FTS costs are not even two times lower compared to default settings, so your current settings actually favor index access significantly.
    Consider:
    SQL>
    SQL> exec dbms_random.seed(0)
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    SQL>
    SQL> drop table t1 purge;
    Table dropped.
    Elapsed: 00:00:00.16
    SQL>
    SQL> create table t1
      2  pctfree 99
      3  pctused 1
      4  -- tablespace test_2k
      5  -- tablespace test_4k
      6  tablespace test_8k
      7  -- tablespace test_16k
      8  as
      9  with generator as (
    10            select  --+ materialize
    11                 rownum  id
    12            from    all_objects
    13            where   rownum <= 3000
    14  )
    15  select
    16            /*+ ordered use_nl(v2) */
    17            rownum                         id,
    18            trunc(100 * dbms_random.normal)          val,
    19            rpad('x',100)                    padding
    20  from
    21            generator          v1,
    22            generator          v2
    23  where
    24            rownum <= 10000
    25  ;
    Table created.
    Elapsed: 00:00:02.53
    SQL>
    SQL> begin
      2            dbms_stats.gather_table_stats(
      3                 user,
      4                 't1',
      5                 cascade => true,
      6                 estimate_percent => null,
      7                 method_opt => 'for all columns size 1'
      8            );
      9  end;
    10  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:02.58
    SQL>
    SQL> select
      2            sum(bytes)/1024/1024 as size_mb
      3  from
      4            user_segments
      5  where
      6            segment_name = 'T1';
       SIZE_MB
            79
    Elapsed: 00:00:00.24
    SQL>
    SQL> -- default NOWORKLOAD system statistics
    SQL> column sname format a20
    SQL> column pname format a20
    SQL> column pval2 format a20
    SQL>
    SQL> select
      2             sname
      3           , pname
      4           , pval1
      5           , pval2
      6  from
      7           sys.aux_stats$;
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          03-19-2009 18:28
    SYSSTATS_INFO        DSTOP                           03-19-2009 18:28
    SYSSTATS_INFO        FLAGS                         0
    SYSSTATS_MAIN        CPUSPEEDNW              408,478
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM
    SYSSTATS_MAIN        MREADTIM
    SYSSTATS_MAIN        CPUSPEED
    SYSSTATS_MAIN        MBRC
    SYSSTATS_MAIN        MAXTHR
    SYSSTATS_MAIN        SLAVETHR
    13 rows selected.
    Elapsed: 00:00:00.03
    SQL>
    SQL> alter session set db_file_multiblock_read_count = 8;
    Session altered.
    Elapsed: 00:00:00.01
    SQL>
    SQL> explain plan for
      2  select
      3            max(val)
      4  from
      5            t1;
    Explained.
    Elapsed: 00:00:00.01
    SQL>
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 3724264953
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     1 |     4 |  2725   (1)| 00:00:33 |
    |   1 |  SORT AGGREGATE    |      |     1 |     4 |            |          |
    |   2 |   TABLE ACCESS FULL| T1   | 10000 | 40000 |  2725   (1)| 00:00:33 |
    9 rows selected.
    Elapsed: 00:00:00.12
    SQL>
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.01
    SQL>
    SQL> alter session set db_file_multiblock_read_count = 64;
    Session altered.
    Elapsed: 00:00:00.01
    SQL>
    SQL> explain plan for
      2  select
      3            max(val)
      4  from
      5            t1;
    Explained.
    Elapsed: 00:00:00.02
    SQL>
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 3724264953
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     1 |     4 |  1814   (1)| 00:00:22 |
    |   1 |  SORT AGGREGATE    |      |     1 |     4 |            |          |
    |   2 |   TABLE ACCESS FULL| T1   | 10000 | 40000 |  1814   (1)| 00:00:22 |
    9 rows selected.
    Elapsed: 00:00:00.12
    SQL>
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.01
    SQL>
    SQL> create index t1_idx on t1 (id);
    Index created.
    Elapsed: 00:00:01.70
    SQL>
    SQL> alter table t1 modify id not null;
    Table altered.
    Elapsed: 00:00:01.63
    SQL>
    SQL> alter session set optimizer_index_cost_adj = 100;
    Session altered.
    Elapsed: 00:00:00.00
    SQL>
    SQL> explain plan for
      2  select   /*+ index (t1) */
      3             *
      4  from
      5             t1
      6  order by
      7             id;
    Explained.
    Elapsed: 00:00:00.07
    SQL>
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 510677707
    | Id  | Operation                   | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |        | 10000 |  1054K| 10037   (1)| 00:02:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T1     | 10000 |  1054K| 10037   (1)| 00:02:01 |
    |   2 |   INDEX FULL SCAN           | T1_IDX | 10000 |       |    22   (0)| 00:00:01 |
    9 rows selected.
    Elapsed: 00:00:00.14
    SQL>
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.01
    SQL>
    SQL> alter session set optimizer_index_cost_adj = 10;
    Session altered.
    Elapsed: 00:00:00.00
    SQL>
    SQL> -- no hint required, will use index anyway
    SQL> explain plan for
      2  select
      3             *
      4  from
      5             t1
      6  order by
      7             id;
    Explained.
    Elapsed: 00:00:00.01
    SQL>
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 510677707
    | Id  | Operation                   | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |        | 10000 |  1054K|  1004   (1)| 00:00:13 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T1     | 10000 |  1054K|  1004   (1)| 00:00:13 |
    |   2 |   INDEX FULL SCAN           | T1_IDX | 10000 |       |     2   (0)| 00:00:01 |
    9 rows selected.
    Elapsed: 00:00:00.10
    SQL>
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.00
    SQL> As you can see the index costs are lower by an order of magnitude, making the optimizer favor the index full scan instead of the FTS (full table scan) when using the OICA (optimizer_index_cost_adj) setting of 10, even when using the MBRC (db_file_multiblock_read_count) setting of 64, because the higher MBRC setting reduces the FTS costs only from ~2700 to ~1800.
    The moderate reduction in FTS costs is caused by the formula used by the NOWORKLOAD system statistics to derive the MREADTIM and SREADTIM values from the IOSEEKTIM, MBRC, DB_BLOCK_SIZE and IOTFRSPEED values.
    When MBRC = 8:
    SREADTIM = IOSEEKTIM + DB_BLOCK_SIZE/IOTFRSPEED = 10 + 8192 / 4096 = 10 + 2 = 12ms
    MREADTIM = IOSEEKTIM + MBRC * DB_BLOCK_SIZE/IOTFRSPEED = 10 + 8 * 8192 / 4096 = 10 + 16 = 26ms
    FTS cost for reading 10,000 blocks (80MB):
    10,000 / 8 * MREADTIM / SREADTIM = 1,250 * 26 / 12 = 2,709 (+ CPU cost)
    When MBRC = 64:
    SREADTIM = IOSEEKTIM + DB_BLOCK_SIZE/IOTFRSPEED = 10 + 8192 / 4096 = 10 + 2 = 12ms
    MREADTIM = IOSEEKTIM + MBRC * DB_BLOCK_SIZE/IOTFRSPEED = 10 + 64 * 8192 / 4096 = 10 + 128 = 138ms
    FTS cost for reading 10,000 blocks (80MB):
    10,000 / 64 * MREADTIM / SREADTIM = 157 * 138 / 12 = 1,806 (+ CPU cost)
    So in a nutshell using NOWORKLOAD system statistics the derived MREADTIM is quite large, therefore the net reduction in cost is moderate when increasing the MBRC.
    Furthermore when using a low OICA setting you have the inherent risk that due to the reduction in index cost multiple indexes can end up with the same cost making the optimizer choose a bad index over an good index since indexes having the same cost will be chosen by index name...
    That's one of the major drawbacks of low OICA settings.
    How did you know that we are using default NOWORKLOAD system statistics.
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096These are the default settings, a seek time of 10ms and 4096 bytes per millisecond transfer speed, which is a very conservative assumption (4MB/sec. transfer speed)
    because it looks like that your trace file doesn't contain any STATS lines because all cursors were still held open when the tracing was disabledCan you elaborate more.Up to 10.2 Oracle writes STAT lines into the trace file only if the corresponding cursor got closed. Since your PL/SQL procedure obviously benefits from the PL/SQL cursor cache I assume that the cursors have not been closed. You can check the generated trace file for STAT lines representing the actual row source operation statistics.
    Note that 11g changes this, and the default behaviour is to write the STAT lines at first execution, which is basically a good idea but it can be misleading (as STAT statistics for further executions of the same child cursor might be missing from the trace file). For more information, see e.g. here:
    http://antognini.ch/2009/02/11g-new-feature-in-dbms_monitor/
    You don't need to use the EXPLAIN option of TKPROF, having the "Row Source Operations" recorded in the trace file is of much more valueWhy?The "Row Source Operation" tells you for each operation of the actual execution plan used the number of logical I/Os, physical I/Os and elapsed time, which tells you very exactly which step of the execution caused what kind of work.
    The EXPLAIN PLAN output of TKPROF only shows an EXPLAIN PLAN, therefore it can be quite different from the actual execution plan used, especially if bind variables are used, which is the default when using static SQL in PL/SQL.
    Can i have your email id.Follow the provided links, these include contact information if required.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Suggestions from tkprof output

    Hi All,
    I need to tune the following sql query. I have given the tkprof output of the sql, can you please suggest ways to improvise the query?
    Trace file: hsctst09_ora_1671386_10046.trc
    Sort options: prsela  fchela  exeela
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    error connecting to database using: rms12/rms12
    ORA-01017: invalid username/password; logon denied
    EXPLAIN PLAN option disabled.
    select distinct RPE.promo_event_display_id             Event_Number,
           RPE.description                                 Event_Description,
           RPE.start_date                                  Event_Start_Date,
           RPE.end_date                                    Event_End_Date,
           (CASE RPD.state  
                 WHEN 'pcd.active'                     THEN 'Active'
                 WHEN 'pcd.approved'                   THEN 'Approved'
                 WHEN 'pcd.cancelled'                  THEN 'Cancelled'
                 WHEN 'pcd.conflictCheckForApproved'   THEN 'Conflict Check'
                 WHEN 'pcd.submitted'                  THEN 'Submitted'
                 WHEN 'pcd.complete'                   THEN 'Complete'
                 WHEN 'pcd.substate.working.worksheet' THEN 'Worksheet'
                 ELSE 'Unknown'                      
           END)                                            Event_Status,
           RP.promo_display_id                             Promotion_ID,
           RP.description                                  Promotion_Description,
           RP.start_date                                   Promotion_Start_Date,
           RP.end_date                                     Promotion_End_Date,
           RPDT.dept                                       Valid_Section,
           RTH.threshold_display_id                        Threshold_Number,
           RTH.name                                        Threshold_Description,
           RPC.comp_display_id                             Component_ID,
           RPC.name                                        Component_Description,
           RPC.tsl_comp_level_desc                         Description_at_the_till,
           'Threshold'                                     Component_Type,
           RPC.tsl_ext_promo_id                            External_ID,
           decode(RPC.funding_percent,null,'No','Yes')     Funding_Indicator,
           (CASE RPD.apply_to_code
                 WHEN 0 THEN 'Regular Only'
                 WHEN 1 THEN 'Clearance Only'
                 WHEN 2 THEN 'Regular and Clearance'
                 ELSE NULL
           END)                                            Apply_to,
           RPD.start_date                                  Component_start_date,
           RPD.end_date                                    Component_End_Date,
           '="'||RPT.item||'"'                             Item,
           IM.item_desc                                    Item_Description,
           '="'||TRPCT.tpnd_id||'"'                        Pack,
           IM1.item_desc                                   Pack_Description,
           decode(TRPCT.primary_tpnd,1,'Yes','No')         Primary_Pack,
           RPC.funding_percent                             Corporate_Funding_Percent,
           DP.contribution_pct                             Supplier_Funding_Percent,
           RPCT.uptake_percent                             Uptake_Percent,
           RPT.tsl_uplift_perc                             Uplift_Percent,
           NULL                                            List_Type,
           NULL                                            Buy_Type,
           NULL                                            Buy_Value,
           (CASE RTI.threshold_type
                 WHEN 0 THEN 'Amount'
                 WHEN 1 THEN 'Quantity'
                 WHEN 2 THEN 'Weight'
                 ELSE NULL
           END)                                            Get_Type,
           RTI.threshold_amount                            Get_Value,
           (CASE RTI.change_type
                 WHEN 0 THEN 'Percent Off'
                 WHEN 1 THEN 'Amount Off'
                 WHEN 2 THEN 'Fixed Price'
                 WHEN 3 THEN 'No Change'
                 WHEN 4 THEN 'Exclude'
                 WHEN 5 THEN 'ClubCard Points'
                 WHEN 6 THEN 'Voucher'
                 WHEN 7 THEN 'Cheapest Free'
                 ELSE NULL
           END)                                            Change_Type,
           RTI.change_amount                               Change_Amount,
           RTI.tsl_voucher_number                          Voucher_Number,
           NULL                                            Get_Quantity,
           RZFR.selling_uom                                Selling_UOM,
           RPCT.tsl_coupon_number                          Coupon_Number,
           RPCT.tsl_coupon_desc                            Coupon_Description,
           RPT.zone_id                                     Zone,
           RPD.Ignore_Constraints                          Ignore_Constraints,
           RPT.tsl_feature_space_end_num                   Feature_Space
      from rpm_promo RP,
           rpm_promo_comp RPC,
           rpm_promo_comp_detail RPD,
           rpm_promo_event RPE,
           rpm_promo_dept RPDT,
           rpm_promo_comp_threshold RPT,
           rpm_threshold RTH,
           rpm_threshold_interval RTI,
           v_item_master IM,
           item_supplier SU,
           rpm_promo_comp_thresh_link RPCT,
           tsl_rpm_promo_comp_tpnd TRPCT,
           v_item_master IM1,
           rpm_zone_future_retail RZFR,
           ( select isu.supplier,
                    isu.item,
                    dh.deal_id,
                    dcp.promotion_id,
                    dcp.promo_comp_id,
                    dcp.contribution_pct
               from item_supplier isu inner join
                    deal_head dh on (isu.supplier = dh.supplier)
                    inner join deal_comp_prom dcp on (dcp.deal_id = dh.deal_id) ) dp
    where RP.promo_id = RPC.promo_id
       and RPD.promo_comp_id = RPC.promo_comp_id
       and RPE.promo_event_id = RP.promo_event_id
       and RP.promo_id = RPDT.promo_id
       and RPDT.dept = IM.dept
       and DP.promotion_id (+) = RP.promo_id
       and RPT.rpm_promo_comp_detail_id = RPD.rpm_promo_comp_detail_id
       and RPT.threshold_id = RTH.threshold_id
       and RPT.threshold_id = RTI.threshold_id
       and TRPCT.rpm_promo_comp_detail_id = RPD.rpm_promo_comp_detail_id
       and RPT.item = IM.item
       and IM.item = SU.item
       and RPD.promo_comp_id = RPCT.promo_comp_id
       and TRPCT.tpnb_id = RPT.item
       and TRPCT.tpnd_id = IM1.item
       and RZFR.item = IM.item
    UNION ALL
    -- Simple Query
    select distinct RPE.promo_event_display_id             Event_Number,
           RPE.description                                 Event_Description,
           RPE.start_date                                  Event_Start_Date,
           RPE.end_date                                    Event_End_Date,
           (CASE RPD.state  
                 WHEN 'pcd.active'                     THEN 'Active'
                 WHEN 'pcd.approved'                   THEN 'Approved'
                 WHEN 'pcd.cancelled'                  THEN 'Cancelled'
                 WHEN 'pcd.conflictCheckForApproved'   THEN 'Conflict Check'
                 WHEN 'pcd.submitted'                  THEN 'Submitted'
                 WHEN 'pcd.complete'                   THEN 'Complete'
                 WHEN 'pcd.substate.working.worksheet' THEN 'Worksheet'
                 ELSE 'Unknown'                      
           END)                                            Event_Status,
           RP.promo_display_id                             Promotion_ID,
           RP.description                                  Promotion_Description,
           RP.start_date                                   Promotion_Start_Date,
           RP.end_date                                     Promotion_End_Date,
           RPDT.dept                                       Valid_Section,
           NULL                                            Threshold_Number,
           NULL                                            Threshold_Description,
           RPC.comp_display_id                             Component_ID,
           RPC.name                                        Component_Description,
           RPC.tsl_comp_level_desc                         Description_at_the_till,
           'Simple'                                        Component_Type,
           RPC.tsl_ext_promo_id                            External_ID,
           decode(RPC.funding_percent,null,'No','Yes')     Funding_Indicator,
           (CASE RPD.apply_to_code
                 WHEN 0 THEN 'Regular Only'
                 WHEN 1 THEN 'Clearance Only'
                 WHEN 2 THEN 'Regular and Clearance'
                 ELSE NULL
           END)                                            Apply_to,
           RPD.start_date                                  Component_start_date,
           RPD.end_date                                    Component_End_Date,
           '="'||RPS.item||'"'                             Item,
           IM.item_desc                                    Item_Description,
           '="'||TRPCT.tpnd_id||'"'                        Pack,
           IM1.item_desc                                   Pack_Description,
           decode(TRPCT.primary_tpnd,1,'Yes','No')         Primary_Pack,
           RPC.funding_percent                             Corporate_Funding_Percent,
           DP.contribution_pct                             Supplier_Funding_Percent,
           RPS.tsl_simple_uptake_percent                   Uptake_Percent,
           RPS.tsl_uplift_perc                             Uplift_Percent,
           NULL                                            List_Type,
           NULL                                            Buy_Type,
           NULL                                            Buy_Value,
           NULL                                            Get_Type,
           NULL                                            Get_Value,
           (CASE RPS.change_type
                 WHEN 0 THEN 'Percent Off'
                 WHEN 1 THEN 'Amount Off'
                 WHEN 2 THEN 'Fixed Price'
                 WHEN 3 THEN 'No Change'
                 WHEN 4 THEN 'Exclude'
                 WHEN 5 THEN 'ClubCard Points'
                 WHEN 6 THEN 'Voucher'
                 WHEN 7 THEN 'Cheapest Free'
                 ELSE NULL
           END)                                            Change_Type,
           RPS.change_amount                               Change_Amount,
           RPS.tsl_voucher_number                          Voucher_Number,
           NULL                                            Get_Quantity,
           RZFR.selling_uom                                Selling_UOM,
           RPS.tsl_coupon_number                           Coupon_Number,
           RPS.tsl_coupon_desc                             Coupon_Description,
           RPS.zone_id                                     Zone,
           RPD.Ignore_Constraints                          Ignore_Constraints,
           RPS.tsl_feature_space_end_num                   Feature_Space
      from rpm_promo RP,
           rpm_promo_comp RPC,
           rpm_promo_comp_detail RPD,
           rpm_promo_event RPE,
           rpm_promo_dept RPDT,
           rpm_promo_comp_simple RPS,
           v_item_master IM,
           item_supplier SU,
           tsl_rpm_promo_comp_tpnd TRPCT,
           v_item_master IM1,
           rpm_zone_future_retail RZFR,
           ( select isu.supplier,
                    isu.item,
                    dh.deal_id,
                    dcp.promotion_id,
                    dcp.promo_comp_id,
                    dcp.contribution_pct
               from item_supplier isu inner join
                    deal_head dh on (isu.supplier = dh.supplier)
                    inner join deal_comp_prom dcp on (dcp.deal_id = dh.deal_id) ) dp
    where RP.promo_id = RPC.promo_id
       and RPD.promo_comp_id = RPC.promo_comp_id
       and RPE.promo_event_id = RP.promo_event_id
       and RP.promo_id = RPDT.promo_id
       and RPDT.dept = IM.dept
       and DP.promotion_id (+) = RP.promo_id
       and RPS.rpm_promo_comp_detail_id = RPD.rpm_promo_comp_detail_id
       and TRPCT.rpm_promo_comp_detail_id = RPD.rpm_promo_comp_detail_id
       and RPS.item = IM.item
       and IM.item = SU.item
       and RZFR.item = RPS.item
       and TRPCT.tpnb_id = RPS.item
       and TRPCT.tpnd_id = IM1.item
    UNION ALL
    -- Multi-Buy Query
    select distinct RPE.promo_event_display_id             Event_Number,
           RPE.description                                 Event_Description,
           RPE.start_date                                  Event_Start_Date,
           RPE.end_date                                    Event_End_Date,
           (CASE RPD.state  
                 WHEN 'pcd.active'                     THEN 'Active'
                 WHEN 'pcd.approved'                   THEN 'Approved'
                 WHEN 'pcd.cancelled'                  THEN 'Cancelled'
                 WHEN 'pcd.conflictCheckForApproved'   THEN 'Conflict Check'
                 WHEN 'pcd.submitted'                  THEN 'Submitted'
                 WHEN 'pcd.complete'                   THEN 'Complete'
                 WHEN 'pcd.substate.working.worksheet' THEN 'Worksheet'
                 ELSE 'Unknown'                      
           END)                                            Event_Status,
           RP.promo_display_id                             Promotion_ID,
           RP.description                                  Promotion_Description,
           RP.start_date                                   Promotion_Start_Date,
           RP.end_date                                     Promotion_End_Date,
           RPDT.dept                                       Valid_Section,
           NULL                                            Threshold_Number,
           NULL                                            Threshold_Description,
           RPC.comp_display_id                             Component_ID,
           RPC.name                                        Component_Description,
           RPC.tsl_comp_level_desc                         Description_at_the_till,
           'MultiBuy'                                      Component_Type,
           RPC.tsl_ext_promo_id                            External_ID,
           decode(RPC.funding_percent,null,'No','Yes')     Funding_Indicator,
           (CASE RPD.apply_to_code
                 WHEN 0 THEN 'Regular Only'
                 WHEN 1 THEN 'Clearance Only'
                 WHEN 2 THEN 'Regular and Clearance'
                 ELSE NULL
           END)                                            Apply_to,
           RPD.start_date                                  Component_start_date,
           RPD.end_date                                    Component_End_Date,
           '="'||RPG.item||'"'                             Item,
           IM.item_desc                                    Item_Description,
           '="'||TRPCT.tpnd_id||'"'                        Pack,
           IM1.item_desc                                   Pack_Description,
           decode(TRPCT.primary_tpnd,1,'Yes','No')         Primary_Pack,
           RPC.funding_percent                             Corporate_Funding_Percent,
           DP.contribution_pct                             Supplier_Funding_Percent,
           NULL                                            Uptake_Percent,
           TRPM.uplift_perc                                Uplift_Percent,
           decode(TBD.list_type,0,'Buy List',1,'Get List') List_Type,
           TBD.buy_item_type                               Buy_Type,
           TBD.buy_item_value                              Buy_Value,
           NULL                                            Get_Type,
           NULL                                            Get_Value,
           (CASE TBD.change_type
                 WHEN 0 THEN 'Percent Off'
                 WHEN 1 THEN 'Amount Off'
                 WHEN 2 THEN 'Fixed Price'
                 WHEN 3 THEN 'No Change'
                 WHEN 4 THEN 'Exclude'
                 WHEN 5 THEN 'ClubCard Points'
                 WHEN 6 THEN 'Voucher'
                 WHEN 7 THEN 'Cheapest Free'
                 ELSE NULL
           END)                                            Change_Type,
           TBD.change_amount                               Change_Amount,
           TBD.voucher_number                              Voucher_Number,
           TBD.get_quantity                                Get_Quantity,
           RZPR.selling_uom                                Selling_UOM,               
           TB.tsl_coupon_number                            Coupon_Number,
           TB.tsl_coupon_desc                              Coupon_Description,
           TBZ.zone_id                                     Zone,
           RPD.Ignore_Constraints                          Ignore_Constraints,
           NULL                                            Feature_Space
      from rpm_promo RP,
           rpm_promo_comp RPC,
           rpm_promo_comp_detail RPD,
           rpm_promo_event RPE,
           rpm_promo_dept RPDT,
           tsl_rpm_promo_comp_m_b TB,
           tsl_rpm_promo_comp_m_b_dtl TBD,
           tsl_rpm_promo_multi_buy_zone TBZ,
           tsl_rpm_promo_get_item RPG,
           v_item_master IM,
           item_supplier SU,
           tsl_rpm_promo_comp_tpnd TRPCT,
           v_item_master IM1,
           rpm_zone_future_retail RZPR,
           tsl_rpm_promo_mb_attr TRPM,
           ( select isu.supplier,
                    isu.item,
                    dh.deal_id,
                    dcp.promotion_id,
                    dcp.promo_comp_id,
                    dcp.contribution_pct
               from item_supplier isu inner join
                    deal_head dh on (isu.supplier = dh.supplier)
                    inner join deal_comp_prom dcp on (dcp.deal_id = dh.deal_id) ) dp
    where RP.promo_id = RPC.promo_id
       and RPD.promo_comp_id = RPC.promo_comp_id
       and RPE.promo_event_id = RP.promo_event_id
       and RP.promo_id = RPDT.promo_id
       and RPDT.dept = IM.dept
       and DP.promotion_id (+) = RP.promo_id
       and RPD.rpm_promo_comp_detail_id = TB.rpm_promo_comp_detail_id
       and TB.rpm_promo_comp_detail_id = TBD.rpm_promo_comp_detail_id
       and TBD.rpm_promo_comp_detail_id = TBZ.rpm_promo_comp_detail_id
       and RPG.item = IM.item
       and IM.item = SU.item
       and TRPM.item = RPG.item
       and TRPM.rpm_promo_comp_detail_id = RPD.rpm_promo_comp_detail_id
       and TRPM.zone_id = TBZ.zone_id
       and RZPR.item = RPG.item
       and TRPCT.tpnb_id = RPG.item
       and TRPCT.tpnd_id = IM1.item

    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      4.16       4.48          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        5     53.01     276.29      91547    1615664          9          48
    total        7     57.17     280.78      91547    1615664          9          48
    Misses in library cache during parse: 1
    Optimizer mode: CHOOSE
    Parsing user id: 191
    Rows     Row Source Operation
         48  UNION-ALL  (cr=17287 pr=3663 pw=1876 time=2033194 us)
         13   SORT UNIQUE (cr=11286 pr=1052 pw=0 time=2033182 us)
        364    NESTED LOOPS OUTER (cr=11286 pr=1052 pw=0 time=1861854 us)
        364     NESTED LOOPS  (cr=10922 pr=1051 pw=0 time=1857466 us)
         75      NESTED LOOPS  (cr=10770 pr=1041 pw=0 time=1855506 us)
         15       NESTED LOOPS  (cr=10723 pr=1029 pw=0 time=1857844 us)
         15        NESTED LOOPS  (cr=10691 pr=1021 pw=0 time=1857525 us)
         15         NESTED LOOPS  (cr=10689 pr=1021 pw=0 time=1857391 us)
         15          NESTED LOOPS  (cr=10657 pr=1017 pw=0 time=1856760 us)
         15           NESTED LOOPS  (cr=10655 pr=1017 pw=0 time=1856639 us)
         15            NESTED LOOPS  (cr=10623 pr=1006 pw=0 time=1855895 us)
         15             NESTED LOOPS  (cr=10606 pr=1003 pw=0 time=1846410 us)
       1208              NESTED LOOPS  (cr=8188 pr=989 pw=0 time=1846542 us)
       1208               NESTED LOOPS  (cr=5770 pr=978 pw=0 time=1834421 us)
       1208                NESTED LOOPS  (cr=4560 pr=971 pw=0 time=1821047 us)
       1208                 HASH JOIN  (cr=3350 pr=970 pw=0 time=1801632 us)
       1367                  HASH JOIN  (cr=2533 pr=157 pw=0 time=25928 us)
         96                   TABLE ACCESS FULL RPM_PROMO_COMP_THRESH_LINK (cr=9 pr=8 pw=0 time=435 us)
       1371                   HASH JOIN  (cr=2524 pr=149 pw=0 time=24005 us)
       1371                    TABLE ACCESS FULL RPM_PROMO_COMP_THRESHOLD (cr=47 pr=0 pw=0 time=33 us)
    190227                    TABLE ACCESS FULL RPM_PROMO_COMP_DETAIL (cr=2477 pr=149 pw=0 time=87 us)
    132392                  TABLE ACCESS FULL TSL_RPM_PROMO_COMP_TPND (cr=817 pr=813 pw=0 time=337 us)
       1208                 TABLE ACCESS BY INDEX ROWID RPM_THRESHOLD_INTERVAL (cr=1210 pr=1 pw=0 time=16962 us)
       1208                  INDEX RANGE SCAN RPM_THRESHOLD_INTERVAL_I1 (cr=2 pr=1 pw=0 time=4680 us)(object id 459922)
       1208                TABLE ACCESS BY INDEX ROWID RPM_THRESHOLD (cr=1210 pr=7 pw=0 time=8397 us)
       1208                 INDEX UNIQUE SCAN PK_RPM_THRESHOLD (cr=2 pr=1 pw=0 time=3405 us)(object id 459954)
       1208               TABLE ACCESS BY INDEX ROWID RPM_PROMO_COMP (cr=2418 pr=11 pw=0 time=37425 us)
       1208                INDEX UNIQUE SCAN PK_RPM_PROMO_COMP (cr=1210 pr=4 pw=0 time=4700 us)(object id 459902)
         15              TABLE ACCESS BY INDEX ROWID RPM_PROMO (cr=2418 pr=14 pw=0 time=69147 us)
       1208               INDEX UNIQUE SCAN PK_RPM_PROMO (cr=1210 pr=4 pw=0 time=4755 us)(object id 459849)
         15             TABLE ACCESS BY INDEX ROWID RPM_PROMO_EVENT (cr=17 pr=3 pw=0 time=9808 us)
         15              INDEX UNIQUE SCAN PK_RPM_PROMO_EVENT (cr=2 pr=0 pw=0 time=55 us)(object id 459871)
         15            TABLE ACCESS BY INDEX ROWID ITEM_MASTER (cr=32 pr=11 pw=0 time=638 us)
         15             INDEX UNIQUE SCAN PK_ITEM_MASTER (cr=17 pr=7 pw=0 time=398 us)(object id 460014)
         15           INDEX UNIQUE SCAN PK_DEPS (cr=2 pr=0 pw=0 time=55 us)(object id 460063)
         15          TABLE ACCESS BY INDEX ROWID ITEM_MASTER (cr=32 pr=4 pw=0 time=284 us)
         15           INDEX UNIQUE SCAN PK_ITEM_MASTER (cr=17 pr=3 pw=0 time=179 us)(object id 460014)
         15         INDEX UNIQUE SCAN PK_DEPS (cr=2 pr=0 pw=0 time=47 us)(object id 460063)
         15        INDEX UNIQUE SCAN PK_RPM_PROMO_DEPT (cr=32 pr=8 pw=0 time=423 us)(object id 461683)
         75       TABLE ACCESS BY INDEX ROWID RPM_ZONE_FUTURE_RETAIL (cr=47 pr=12 pw=0 time=846 us)
         75        INDEX RANGE SCAN RPM_ZONE_FUTURE_RETAIL_I1 (cr=32 pr=12 pw=0 time=536 us)(object id 459917)
        364      INDEX RANGE SCAN PK_ITEM_SUPPLIER (cr=152 pr=10 pw=0 time=915 us)(object id 461283)
          0     VIEW PUSHED PREDICATE  (cr=364 pr=1 pw=0 time=4468 us)
          0      NESTED LOOPS  (cr=364 pr=1 pw=0 time=4023 us)
          0       NESTED LOOPS  (cr=364 pr=1 pw=0 time=3596 us)
          0        TABLE ACCESS BY INDEX ROWID DEAL_COMP_PROM (cr=364 pr=1 pw=0 time=2839 us)
          0         INDEX SKIP SCAN PK_DEAL_COMP_PROM (cr=364 pr=1 pw=0 time=2252 us)(object id 460586)
          0        TABLE ACCESS BY INDEX ROWID DEAL_HEAD (cr=0 pr=0 pw=0 time=0 us)
          0         INDEX UNIQUE SCAN PK_DEAL_HEAD (cr=0 pr=0 pw=0 time=0 us)(object id 460002)
          0       INDEX RANGE SCAN ITEM_SUPPLIER_I1 (cr=0 pr=0 pw=0 time=0 us)(object id 461281)
         35   SORT UNIQUE (cr=6001 pr=2611 pw=1876 time=1787923 us)
        483    TABLE ACCESS BY INDEX ROWID RPM_ZONE_FUTURE_RETAIL (cr=6001 pr=2611 pw=1876 time=1781697 us)
        579     NESTED LOOPS  (cr=5969 pr=2609 pw=1876 time=205507332 us)
         95      NESTED LOOPS  (cr=5777 pr=2600 pw=1876 time=1777879 us)
         41       NESTED LOOPS  (cr=5693 pr=2592 pw=1876 time=1778919 us)
         41        HASH JOIN  (cr=5609 pr=2573 pw=1876 time=1778377 us)
        276         TABLE ACCESS FULL DEPS (cr=5 pr=0 pw=0 time=36 us)
         41         NESTED LOOPS  (cr=5604 pr=2573 pw=1876 time=1776404 us)
         41          HASH JOIN  (cr=5520 pr=2567 pw=1876 time=1776506 us)
         41           NESTED LOOPS  (cr=5515 pr=2567 pw=1876 time=1753418 us)
         41            HASH JOIN  (cr=5431 pr=2555 pw=1876 time=1752249 us)
    132392             TABLE ACCESS FULL TSL_RPM_PROMO_COMP_TPND (cr=817 pr=0 pw=0 time=44 us)
         57             HASH JOIN  (cr=4614 pr=1820 pw=1099 time=1200744 us)
    129467              TABLE ACCESS FULL RPM_PROMO_COMP_SIMPLE (cr=1693 pr=164 pw=0 time=186 us)
      45903              HASH JOIN  (cr=2921 pr=557 pw=0 time=81106 us)
        236               HASH JOIN  (cr=444 pr=28 pw=0 time=37993 us)
        373                NESTED LOOPS OUTER (cr=413 pr=23 pw=0 time=10806 us)
        373                 HASH JOIN  (cr=40 pr=23 pw=0 time=6301 us)
        277                  TABLE ACCESS FULL RPM_PROMO_EVENT (cr=6 pr=1 pw=0 time=79 us)
        373                  TABLE ACCESS FULL RPM_PROMO (cr=34 pr=22 pw=0 time=4177 us)
          0                 VIEW PUSHED PREDICATE  (cr=373 pr=0 pw=0 time=4164 us)
          0                  NESTED LOOPS  (cr=373 pr=0 pw=0 time=3634 us)
          0                   NESTED LOOPS  (cr=373 pr=0 pw=0 time=3221 us)
          0                    TABLE ACCESS BY INDEX ROWID DEAL_COMP_PROM (cr=373 pr=0 pw=0 time=2799 us)
          0                     INDEX SKIP SCAN PK_DEAL_COMP_PROM (cr=373 pr=0 pw=0 time=2244 us)(object id 460586)
          0                    TABLE ACCESS BY INDEX ROWID DEAL_HEAD (cr=0 pr=0 pw=0 time=0 us)
          0                     INDEX UNIQUE SCAN PK_DEAL_HEAD (cr=0 pr=0 pw=0 time=0 us)(object id 460002)
          0                   INDEX RANGE SCAN ITEM_SUPPLIER_I1 (cr=0 pr=0 pw=0 time=0 us)(object id 461281)
       1452                TABLE ACCESS FULL RPM_PROMO_COMP (cr=31 pr=5 pw=0 time=8984 us)
    190227               TABLE ACCESS FULL RPM_PROMO_COMP_DETAIL (cr=2477 pr=529 pw=0 time=1525455 us)
         41            TABLE ACCESS BY INDEX ROWID ITEM_MASTER (cr=84 pr=12 pw=0 time=21811 us)
         41             INDEX UNIQUE SCAN PK_ITEM_MASTER (cr=43 pr=2 pw=0 time=500 us)(object id 460014)
        276           TABLE ACCESS FULL DEPS (cr=5 pr=0 pw=0 time=39 us)
         41          TABLE ACCESS BY INDEX ROWID ITEM_MASTER (cr=84 pr=6 pw=0 time=750 us)
         41           INDEX UNIQUE SCAN PK_ITEM_MASTER (cr=43 pr=2 pw=0 time=360 us)(object id 460014)
         41        INDEX UNIQUE SCAN PK_RPM_PROMO_DEPT (cr=84 pr=19 pw=0 time=1025 us)(object id 461683)
         95       INDEX RANGE SCAN PK_ITEM_SUPPLIER (cr=84 pr=8 pw=0 time=717 us)(object id 461283)
        483      INDEX RANGE SCAN RPM_ZONE_FUTURE_RETAIL_I1 (cr=192 pr=9 pw=0 time=1661 us)(object id 459917)
          0   SORT UNIQUE (cr=0 pr=0 pw=0 time=34 us)
          0    HASH JOIN  (cr=0 pr=0 pw=0 time=8 us)
        276     TABLE ACCESS FULL DEPS (cr=5 pr=0 pw=0 time=175 us)
          0     HASH JOIN  (cr=0 pr=0 pw=0 time=4 us)
    110442      TABLE ACCESS FULL RPM_ZONE_FUTURE_RETAIL (cr=990 pr=101 pw=0 time=108 us)
          0      HASH JOIN  (cr=0 pr=0 pw=0 time=11 us)
    126852       TABLE ACCESS FULL ITEM_MASTER (cr=5389 pr=5268 pw=0 time=1522285 us)
    8076819       HASH JOIN  (cr=1591993 pr=82513 pw=128338 time=97917982 us)
    1611192        HASH JOIN  (cr=1591176 pr=80224 pw=78099 time=57413444 us)
    1611192         HASH JOIN  (cr=1590457 pr=28794 pw=27384 time=20659952 us)
    793008          HASH JOIN  (cr=1589595 pr=1843 pw=1267 time=12259546 us)
        276           TABLE ACCESS FULL DEPS (cr=5 pr=0 pw=0 time=383 us)
    793008           NESTED LOOPS  (cr=1589590 pr=1843 pw=1267 time=10672032 us)
    793008            HASH JOIN  (cr=3572 pr=1815 pw=1267 time=2741847 us)
      43362             HASH JOIN  (cr=3426 pr=493 pw=0 time=379252 us)
        985              TABLE ACCESS FULL TSL_RPM_PROMO_MULTI_BUY_ZONE (cr=5 pr=4 pw=0 time=207 us)
      43362              HASH JOIN  (cr=3421 pr=489 pw=0 time=288896 us)
        388               HASH JOIN  (cr=2934 pr=5 pw=0 time=22834 us)
       1624                TABLE ACCESS FULL TSL_RPM_PROMO_COMP_M_B_DTL (cr=9 pr=0 pw=0 time=34 us)
        194                HASH JOIN  (cr=2925 pr=5 pw=0 time=30088 us)
        795                 TABLE ACCESS FULL TSL_RPM_PROMO_COMP_M_B (cr=4 pr=2 pw=0 time=179 us)
      45903                 HASH JOIN  (cr=2921 pr=3 pw=0 time=109197 us)
        236                  HASH JOIN  (cr=444 pr=3 pw=0 time=16642 us)
        373                   NESTED LOOPS OUTER (cr=413 pr=0 pw=0 time=7419 us)
        373                    HASH JOIN  (cr=40 pr=0 pw=0 time=2166 us)
        277                     TABLE ACCESS FULL RPM_PROMO_EVENT (cr=6 pr=0 pw=0 time=48 us)
        373                     TABLE ACCESS FULL RPM_PROMO (cr=34 pr=0 pw=0 time=414 us)
          0                    VIEW PUSHED PREDICATE  (cr=373 pr=0 pw=0 time=4519 us)
          0                     NESTED LOOPS  (cr=373 pr=0 pw=0 time=4033 us)
          0                      NESTED LOOPS  (cr=373 pr=0 pw=0 time=3611 us)
          0                       TABLE ACCESS BY INDEX ROWID DEAL_COMP_PROM (cr=373 pr=0 pw=0 time=3166 us)
          0                        INDEX SKIP SCAN PK_DEAL_COMP_PROM (cr=373 pr=0 pw=0 time=2559 us)(object id 460586)
          0                       TABLE ACCESS BY INDEX ROWID DEAL_HEAD (cr=0 pr=0 pw=0 time=0 us)
          0                        INDEX UNIQUE SCAN PK_DEAL_HEAD (cr=0 pr=0 pw=0 time=0 us)(object id 460002)
          0                      INDEX RANGE SCAN ITEM_SUPPLIER_I1 (cr=0 pr=0 pw=0 time=0 us)(object id 461281)
       1452                   TABLE ACCESS FULL RPM_PROMO_COMP (cr=31 pr=3 pw=0 time=38 us)
    190227                  TABLE ACCESS FULL RPM_PROMO_COMP_DETAIL (cr=2477 pr=0 pw=0 time=36 us)
      69561               TABLE ACCESS FULL TSL_RPM_PROMO_MB_ATTR (cr=487 pr=484 pw=0 time=361 us)
      25271             TABLE ACCESS FULL TSL_RPM_PROMO_GET_ITEM (cr=146 pr=55 pw=0 time=53 us)
    793008            TABLE ACCESS BY INDEX ROWID ITEM_MASTER (cr=1586018 pr=28 pw=0 time=7006432 us)
    793008             INDEX UNIQUE SCAN PK_ITEM_MASTER (cr=793010 pr=19 pw=0 time=3817845 us)(object id 460014)
    211165          INDEX FAST FULL SCAN PK_ITEM_SUPPLIER (cr=862 pr=834 pw=0 time=341 us)(object id 461283)
    378625         TABLE ACCESS FULL RPM_PROMO_DEPT (cr=719 pr=715 pw=0 time=333 us)
    132392        TABLE ACCESS FULL TSL_RPM_PROMO_COMP_TPND (cr=817 pr=0 pw=0 time=80 us)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       5        0.00          0.00
      db file sequential read                       627        0.51          1.69
      db file scattered read                        699        0.08          0.68
      SQL*Net more data to client                     1        0.00          0.00
      SQL*Net message from client                     4       50.64        149.95
      direct path write temp                      56227        0.32        219.45
      direct path read temp                       11746        0.01          0.69
      control file sequential read                    7        0.00          0.00
      SQL*Net break/reset to client                   2        0.00          0.00
    SQL ID:
    Plan Hash: 1248216388
    SELECT NAME NAME_COL_PLUS_SHOW_PARAM,DECODE(TYPE,1,'boolean',2,'string',3,
      'integer',4,'file',5,'number',        6,'big integer', 'unknown') TYPE,
      DISPLAY_VALUE VALUE_COL_PLUS_SHOW_PARAM
    FROM
    V$PARAMETER WHERE UPPER(NAME) LIKE UPPER('%USER_DUMP_DEST%') ORDER BY
      NAME_COL_PLUS_SHOW_PARAM,ROWNUM
    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          0          0           0
    Fetch        2      0.01       0.01          0          0          0           1
    total        4      0.01       0.02          0          0          0           1
    Misses in library cache during parse: 1
    Optimizer mode: CHOOSE
    Parsing user id: 191
    Rows     Row Source Operation
          1  SORT ORDER BY (cr=0 pr=0 pw=0 time=15029 us)
          1   COUNT  (cr=0 pr=0 pw=0 time=15015 us)
          1    MERGE JOIN  (cr=0 pr=0 pw=0 time=15004 us)
       1495     FIXED TABLE FULL X$KSPPCV (cr=0 pr=0 pw=0 time=3021 us)
          1     FILTER  (cr=0 pr=0 pw=0 time=10994 us)
          1      SORT JOIN (cr=0 pr=0 pw=0 time=9469 us)
          1       FIXED TABLE FULL X$KSPPI (cr=0 pr=0 pw=0 time=7735 us)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       2        0.00          0.00
      SQL*Net message from client                     2     2763.24       2763.24
    SQL ID:
    Plan Hash: 643305917
    SELECT 'Y'
    FROM
    SEC_USER_GROUP SUG WHERE SUG.USER_ID = SYS_CONTEXT('USERENV', 'SESSION_USER')
       AND EXISTS(SELECT 'x' FROM FILTER_GROUP_MERCH FGM WHERE FGM.SEC_GROUP_ID =
      SUG.GROUP_ID AND ROWNUM = 1) AND ROWNUM = 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.01       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       0.01          1          3          0           0
    total        3      0.01       0.02          1          3          0           0
    Misses in library cache during parse: 1
    Optimizer mode: CHOOSE
    Parsing user id: 191     (recursive depth: 2)
    Rows     Row Source Operation
          0  COUNT STOPKEY (cr=3 pr=1 pw=0 time=12073 us)
          0   INDEX FULL SCAN PK_SEC_USER_GROUP (cr=3 pr=1 pw=0 time=12070 us)(object id 460226)
          0    COUNT STOPKEY (cr=2 pr=1 pw=0 time=12026 us)
          0     INDEX RANGE SCAN UK_FILTER_GROUP_MERCH (cr=2 pr=1 pw=0 time=12023 us)(object id 461052)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                         1        0.01          0.01
    SQL ID:
    Plan Hash: 643277548
    SELECT 'Y'
    FROM
    SEC_USER_GROUP SUG WHERE SUG.USER_ID = SYS_CONTEXT('USERENV', 'SESSION_USER')
       AND (EXISTS(SELECT 'x' FROM FILTER_GROUP_ORG FGO WHERE FGO.SEC_GROUP_ID =
      SUG.GROUP_ID AND ROWNUM = 1) OR EXISTS(SELECT 'x' FROM SEC_GROUP_LOC_MATRIX
      SGLM WHERE SGLM.GROUP_ID = SUG.GROUP_ID AND ROWNUM = 1)) AND ROWNUM = 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.01       0.01          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.02       0.00          2          3          0           0
    total        3      0.03       0.02          2          3          0           0
    Misses in library cache during parse: 1
    Optimizer mode: CHOOSE
    Parsing user id: 191     (recursive depth: 2)
    Rows     Row Source Operation
          0  COUNT STOPKEY (cr=3 pr=2 pw=0 time=8617 us)
          0   FILTER  (cr=3 pr=2 pw=0 time=8614 us)
          1    INDEX FULL SCAN PK_SEC_USER_GROUP (cr=1 pr=0 pw=0 time=39 us)(object id 460226)
          0    COUNT STOPKEY (cr=1 pr=1 pw=0 time=5403 us)
          0     INDEX RANGE SCAN PK_FILTER_GROUP_ORG (cr=1 pr=1 pw=0 time=5400 us)(object id 461061)
          0    COUNT STOPKEY (cr=1 pr=1 pw=0 time=3127 us)
          0     INDEX SKIP SCAN UK_SEC_GROUP_LOC_MATRIX (cr=1 pr=1 pw=0 time=3125 us)(object id 460888)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                         2        0.00          0.00
    SQL ID:
    Plan Hash: 4011473558
    SELECT NAME NAME_COL_PLUS_SHOW_PARAM,DECODE(TYPE,1,'boolean',2,'string',3,
      'integer',4,'file',5,'number',        6,'big integer', 'unknown') TYPE,
      DISPLAY_VALUE VALUE_COL_PLUS_SHOW_PARAM
    FROM
    V$PARAMETER WHERE UPPER(NAME) LIKE UPPER('%USER_DUMP_DEST%') ORDER BY
      NAME_COL_PLUS_SHOW_PARAM,ROWNUM
    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          0          0           0
    Fetch        2      0.01       0.01          0          0          0           1
    total        4      0.01       0.01          0          0          0           1
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: 191
    Rows     Row Source Operation
          1  SORT ORDER BY (cr=0 pr=0 pw=0 time=15250 us)
          1   COUNT  (cr=0 pr=0 pw=0 time=15226 us)
          1    MERGE JOIN  (cr=0 pr=0 pw=0 time=15207 us)
       1495     FIXED TABLE FULL X$KSPPCV (cr=0 pr=0 pw=0 time=3166 us)
          1     FILTER  (cr=0 pr=0 pw=0 time=11059 us)
          1      SORT JOIN (cr=0 pr=0 pw=0 time=9512 us)
          1       FIXED TABLE FULL X$KSPPI (cr=0 pr=0 pw=0 time=7741 us)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       2        0.00          0.00
      SQL*Net message from client                     2     3143.23       3143.23
    SQL ID:
    Plan Hash: 643140929
    SELECT 'Y'
    FROM
    SEC_USER_GROUP SUG WHERE SUG.USER_ID = SYS_CONTEXT('USERENV', 'SESSION_USER')
       AND ROWNUM = 1
    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          0          0           0
    Fetch        1      0.00       0.00          1          1          0           1
    total        3      0.00       0.01          1          1          0           1
    Misses in library cache during parse: 1
    Optimizer mode: CHOOSE
    Parsing user id: 191     (recursive depth: 2)
    Rows     Row Source Operation
          1  COUNT STOPKEY (cr=1 pr=1 pw=0 time=6617 us)
          1   INDEX RANGE SCAN SEC_USER_GROUP_I1 (cr=1 pr=1 pw=0 time=6614 us)(object id 460225)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                         1        0.00          0.00
    SQL ID:
    Plan Hash: 642786159
    SELECT DATA_LEVEL_SECURITY_IND, DIFF_GROUP_ORG_LEVEL_CODE,
      LOC_LIST_ORG_LEVEL_CODE, LOC_TRAIT_ORG_LEVEL_CODE, SEASON_ORG_LEVEL_CODE,
      SKULIST_ORG_LEVEL_CODE, TICKET_TYPE_ORG_LEVEL_CODE, UDA_ORG_LEVEL_CODE,
      DIFF_GROUP_MERCH_LEVEL_CODE, SEASON_MERCH_LEVEL_CODE,
      TICKET_TYPE_MERCH_LEVEL_CODE, UDA_MERCH_LEVEL_CODE, TSL_LOC_SEC_IND
    FROM
    SYSTEM_OPTIONS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.01       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       0.00          1          4          0           1
    total        3      0.01       0.01          1          4          0           1
    Misses in library cache during parse: 1
    Optimizer mode: CHOOSE
    Parsing user id: 191     (recursive depth: 2)
    Rows     Row Source Operation
          1  TABLE ACCESS FULL SYSTEM_OPTIONS (cr=4 pr=1 pw=0 time=6518 us)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                         1        0.00          0.00
    SQL ID:
    Plan Hash: 643306006
    begin :con := FILTER_POLICY_SQL.V_ITEM_MASTER_S(:sn, :on); end;
    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          0          0           1
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      0.00       0.00          0          0          0           1
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: 191     (recursive depth: 1)
    SQL ID:
    Plan Hash: 647750573
    begin :con := FILTER_POLICY_SQL.V_ITEM_MASTER_S(:sn, :on); end;
    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          0          0           1
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      0.00       0.00          0          0          0           1
    Misses in library cache during parse: 0
    Optimizer mode: CHOOSE
    Parsing user id: 191     (recursive depth: 1)
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        3      4.16       4.49          0          0          0           0
    Execute      3      0.00       0.00          0          0          0           0
    Fetch        9     53.03     276.32      91547    1615664          9          50
    total       15     57.19     280.82      91547    1615664          9          50
    Misses in library cache during parse: 2
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                      10        0.00          0.00
      SQL*Net message from client                     9     3143.23       6091.69
      SQL*Net more data from client                   8        0.00          0.00
      db file sequential read                       627        0.51          1.69
      db file scattered read                        699        0.08          0.68
      SQL*Net more data to client                     1        0.00          0.00
      direct path write temp                      56227        0.32        219.45
      direct path read temp                       11746        0.01          0.69
      control file sequential read                    7        0.00          0.00
      SQL*Net break/reset to client                   2        0.00          0.00
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse       93      0.08       0.07          0          0          0           0
    Execute    579      0.12       0.14          0          0          0           2
    Fetch      930      0.06       0.51         63       2154          0        3254
    total     1602      0.26       0.73         63       2154          0        3256
    Misses in library cache during parse: 25
    Misses in library cache during execute: 21
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                        63        0.14          0.47
        9  user  SQL statements in session.
      573  internal SQL statements in session.
      582  SQL statements in session.
        0  statements EXPLAINed in this session.
    Trace file: hsctst09_ora_1671386_10046.trc
    Trace file compatibility: 11.1.0.7
    Sort options: prsela  fchela  exeela
           1  session in tracefile.
           9  user  SQL statements in trace file.
         573  internal SQL statements in trace file.
         582  SQL statements in trace file.
          36  unique SQL statements in trace file.
       81769  lines in trace file.
    17819535  elapsed seconds in trace file.Thanks in advance.

  • Tkprof not showing the Execution Plan for Statement

    Hi all
    using oracle 9i release 2
    I have issued the following statements
    alter session set sql_trace
    alter session set events '10046 trace name context forever, level 12';
    --then executed a pl-sql procedure
    after reading the traceout outfile it shows the Execution plan for statements directly wirtten under begin and end block and doesnot displays the plan for the statements written like this
    procedure a is
    cursor b is
    select ename,dname from dept a,emp b
    where a.deptno=b.deptno;
    begin
    for x in a loop --plan not found but stats are written
    select ename into v_ename from emp where empno=300; --does show the plan+stats
    end;
    what I am missing to get the actual plan in trace output file
    thanks in advance

    You have to exit sql*plus after running the procedure, example tkprof is below:
    declare
    cursor c is
    select ename, dname
    from emp, dept
    where emp.deptno = dept.deptno;
    begin
    for v_x in c
    loop
    dbms_output.put_line(v_x.ename || ' ' ||v_x.dname);
    end loop;
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.06 0 0 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.06 0 0 0 1
    Misses in library cache during parse: 0
    Optimizer goal: CHOOSE
    Parsing user id: 68
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net message to client 1 0.00 0.00
    SQL*Net message from client 1 0.00 0.00
    SELECT ENAME, DNAME
    FROM
    EMP, DEPT WHERE EMP.DEPTNO = DEPT.DEPTNO
    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 0 0 0
    Fetch 15 0.01 0.00 0 44 0 14
    total 17 0.01 0.00 0 44 0 14
    Misses in library cache during parse: 0
    Optimizer goal: CHOOSE
    Parsing user id: 68 (recursive depth: 1)
    Rows Row Source Operation
    14 NESTED LOOPS
    14 TABLE ACCESS FULL EMP
    14 TABLE ACCESS BY INDEX ROWID DEPT
    14 INDEX UNIQUE SCAN DEPT_PK (object id 40350)
    Best Regards
    Krystian Zieja / mob

  • Ellapsed time too much in tkprof output

    Hi All,
    I don't know exactly how to interprete Tkprof output file but i have a problem of performance inserting data to my one table, it takes around 1min but before it was 10 secs. i trace the program and analyze the output from tkprof and i get the following portion:
    insert /*+ APPEND +*/ into T_NAME(COL1,  COL2, COL3, .....)
    values
    (:s1 ,:s2 ,:s3 ,:s4 ,:s5 ,:s6 ,:s7 ,:s8 ,:s9 ,:s10 ,:s11 ,:s12 ,:s13 ,:s14 ,
    :s15 ,:s16 ,:s17 ,:s18 ,:s19 ,:s20 ,:s21 ,:s22 ,:s23 ,:s24 ,:s25 ,:s26 ,
    :s27 ,:s28 ,:s29 ,:s30 ,:s31 ,:s32 ,:s33 ,:s34 ,:s35 ,:s36 ,:s37 ,:s38 ,
    :s39 ,:s40 ,:s41 ,:s42 ,:s43 ,:s44 ,:s45 ,:s46 ,:s47 ,:s48 ,:s49 ,:s50 ,
    :s51 ,:s52 ,:s53 ,:s54 ,:s55 ,:s56 ,:s57 ,:s58 ,:s59 ,:s60 ,:s61 ,:s62 ,
    :s63 ,:s64 ,:s65 ,:s66 ,:s67 ,:s68 )
    call count cpu elapsed disk query current rows
    Parse 2 0.00 0.00 0 0 0 0
    Execute 3 2.94 292.24 12144 1501 57125 4728
    Fetch 0 0.00 0.00 0 0 0 0
    total 5 2.94 292.24 12144 1501 57125 4728
    Misses in library cache during parse: 2
    Misses in library cache during execute: 3
    Optimizer mode: ALL_ROWS
    Parsing user id: 103 (USERNAME)
    Rows Execution Plan
    0 INSERT STATEMENT MODE: ALL_ROWS
    When interpreting this, i got huge value on Ellapsed, disk column during execution:
    The command was exectued 3 times and it was taking 292 secs means 97 secs per execution. I thought it was making my insert problem slow.
    So if i'm not wrong how to avaoid this insertion problem, how to reduce this time of ellapsed.
    What is the problem causing table insertion slow.
    Please help because it is affecting our business
    Thanks for your help
    Raitsarevo

    raitsarevo wrote:
    Hi,
    Gathering statistics will affect performance or not. I mean when i gather statistics of my table now, will this affect operation in this table during execution, the table will be locked or not, indexes will be also or not. Can users work in the table during stat gathering.
    Can anybody give me script to gather stats for partitionned table please.
    Gathering statistics is a good idea in general but it's very unlikely that will help in your particular case. The data needs to be inserted into the table and indexes need to be maintained, this in independent from any statistics. Still it's a good idea in general to refresh statistics if e.g. bulk inserts increased the size and number of rows significantly.
    Have you followed up the advices already given so far regarding further checks and running your statement with tracing enabled at a higher level?
    You can enable this using the following instead of using sql_trace = true:
    ALTER SESSION SET EVENTS '10046 trace name context forever, level 8';and switch it off like that:
    ALTER SESSION SET EVENTS '10046 trace name context off';For more information regarding this, e.g. enabling trace in another session, see e.g. here:
    http://www.juliandyke.com/Diagnostics/Trace/EnablingTrace.html
    raitsarevo wrote:
    Hi guys,
    Reading an output fromENterprise manager, i found that this insert statement is consuming to much "db file sequential read ". I know that is causing wait event. So my question is how to reduce this consumption.
    Thanks
    Raitsarevo.That's very likely caused by the required index maintenance and there is not much you can do about it apart from dropping the indexes. As already mentioned by Jonathan you might hits bugs of the ASSM space management, therefore it would also be good to know if the tablespace the object resides in uses ASSM or not (check the columns EXTENT_MANAGEMENT, ALLOCATION_TYPE, SEGMENT_SPACE_MANAGEMENT of DBA_TABLESPACES).
    Try to generate the extended trace as advised and post the tkprof output here.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Abnormal high "query" count in customer tkprof output

    We have a performance problem with one of our customer.
    A query is made on a 12K rows table, and there is no full scan, the index is used.
    If we run the query on our test database, which is identical, and examine the tkprof output, things appears normal:
    Fetch=80, cpu=0.0, disk=0, query=15738,rows=782
    But the same query, on and identical table, same index at our customer:
    Fetch=831, cpu=4.75, disk=141, query=550564, rows=830
    I dont unerstand what is the "query" parameter, the number of cache buffers read in memory ?
    It is unbeleivebly high, further more, hard to understand high number of rows in the execution plan:
    Ours
    1570 TABLE ACCESS BY INDEX ROWID MY_SECRET_TABLE_NAME
    1570 INDEX RANGE SCAN MY_PRIMARY_KEY_INDEX
    Customers:
    88413 TABLE ACCESS BY INDEX ROWID MY_SECRET_TABLE_NAME
    92917 INDEX RANGE SCAN MY_PRIMARY_KEY_INDEX
    We dont understand such high numbers. On theory, from our former DBA, was that our indexes where not create properly. A unique key index was create, then a primary constraint with the same name, was added to the table. Apparently we should have created only the constraint, and not the second index.
    Any help appreciated.

    Hi Guy,
    Query = db block gets + consistent gets.
    Consistent gets are the block reads you need to reconstruct a read-consistent image of the data.
    If you can't fetch all records at a time, you will get multiple fetches. At each fetch Oracle will issue consistent gets, as it needs to provide to you the data in the state when you started the query.
    Looking at your statistics, it is quite clear what happened.
    Fetch=80, cpu=0.0, disk=0, query=15738,rows=782
    782 rows in 80 fetches. Roughly 10 rows per fetch.
    But the same query, on an identical table, same index at our customer:
    Fetch=831, cpu=4.75, disk=141, query=550564, rows=830
    830 rows in 830 fetches (the last fetch is to check there is no more data), which means 1 row per fetch.
    In both cases: consistent gets at every fetch.
    Somehow your client has made sure, by means of a setting, he will fetch only 1 row at a time. And that is killing him.
    Nothing wrong with any index.
    Hth
    Sybrand Bakker
    Senior Oracle DBA

  • What does the row source generator does ?

    Hi,
    I am looking for a small sort of defination of row source generator. actually i have gone through the defintaion,and bit confused.please follow your defination with an example which could give me better see .i am confused in these line
    "it outputs the execution plan for the sql statements" and " the row source generator is collection of row sources structred in the form of tree".
    thanks
    Alok.

    The source of these words is a the Oracle documentation.
    The row source generator is a translator: it converts the optimal execution plan into a concrete set of instructions for the SQL engine. That, at least, is my understanding.
    Perhaps it might help to think of it as an exercise in navigation. The optimal plan for getting from A to B is to go via D and F. But what you tell the driver is, "go 2 miles down A-road, take third turning on left, go straight ahead at the D crossroads, take the first road on the right, then it's the third exit off the F roundabout and B is the lefthand road at the next t-junction". Of course, the problem witrh analogies is that they can confuse the issue rather than illuminate it.
    So my advice is, don't sweat the details. Approach the optimizer as a black box and get a feel for what it does by playing with queries. Then re-read the architectural definition and see if it makes more sense.
    Cheers, APC

  • Interpret of TKPROF Output

    Hello friends,
    I have a 'select' within a loop while...
    Viewing the file generated by tkprof, has the information below:
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.00 0 0 0 0
    Execute 109 2.12 7.24 284 7586 111205 21582
    Fetch 0 0.00 0.00 0 0 0 0
    total 110 2.13 7.25 284 7586 111205 21582
    The field 'count' tells me that she will be parsed 1 time and executed 109 times?
    Although it is considered 1 time, is difference in performance if it were played only 1 time?
    And what I see fields to improve performance?

    If it was executed only 1 time, it would be faster, sure, but is that what you want?
    Does your tkprof output has more information? I cant see any information to help improve performance.
    Try put here some AUTOTRACE info too.
    Edited by: user10146205 on 18/09/2008 14:38

  • Need SQL statement to generate a sequence number in the output rows

    Hi folks. I need to create an SQL statement that generates a sequence number column in the output rows (records) such that the first returned row has this column set to 1, second returned row has the column set to 2, etc.
    For example, consider the query:
    SELECT income from employees WHERE income != 20000 ORDER BY income;
    If employees.income contains 60,000, 20,000, 35,000, and 19,000 for respective rows, the output would be this:
    19,000
    35,000
    60,000
    I would like the SQL to also return a sequence number that is computed across the returned rows, resulting in two output columns:
    1 19,000
    2 35,000
    3 60,000
    Is there a simple SQL function that generates the sequence number, in order, and only for the returned rows? Or is there another way?
    I'm stumped. Any help is appreciated! Thanks!
    - Jack Cochrane

    Hi,
    Welcome to the forum!
    Use ROWNUM, like (example):
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    SQL> select rownum, first_name from (select e.first_name from employees e where e.first_name like 'J%' order by e.first_name);
        ROWNUM FIRST_NAME
             1 Jack
             2 James
             3 James
             4 Janette
             5 Jason
             6 Jean
             7 Jennifer
             8 Jennifer
             9 John
            10 John
            11 John
            12 Jonathon
            13 Jose Manuel
            14 Joshua
            15 Julia
            16 Julia
    16 rows selected
    SQL> But rememeber if you want to be sure of unique numbers in certain field is better to use sequences and use seq_name.nextval each time you need.
    Regards,

Maybe you are looking for

  • Android App - works fine in Device Central but not in phone

    Greetings! Just looking for some general "you might try this" tips.  I've built a very basic game app for Android so I can start learning not only how to develop for Android, but also how to publish and distribute Android apps to users. My game works

  • NAS that's Windows PC and Mac compatible?

    Hi All, I'm brand new to the Mac world, I've never own a Mac of any kind before and I've played with one for a grand total of 10 minutes before deciding I want one. I ordered one last week and it should be here in a few days. I'm excited to say the l

  • Bluetooth not available in Windows 8.1 for ProBook 6360b

    Installed Windows 8.1 64-bit on ProBook 6360b, however I am unable to turn on  bluetooth in Windows. In Wireless devices section in the pictur below, there should be "Bluetooth" to turn on/off, but it is completelly missing. Checked in BIOS - Bluetoo

  • Strange message: "Firefox can't find the file at /b" Please advise.

    When I open Firefox I get this message: "Firefox can't find the file at /b". As a browser Firefox is working for me but I have to click the google search button to connect to the internet. I have tried everything I can think of including uninstalling

  • I am not able to print in cannon ir series 2520 after Maverick update

    I am not able to print in cannon ir series 2520 after Maverick update, printer is in pause and even after resuming it it dosent work. Pl help Same case with the projector not able to connect it.