Resource plan to limit execution time

Hi,
I am using 11.1.0.7 database. Can anyone guide me how should i create a resource consumer group/resource plan and assign to my user "dev" so that any query run by this user should not take more than 10 minutes for execution and should abort if execution time exceeds 10 minutes.
Thanks
Salman

BEGIN
dbms_resource_manager.clear_pending_area();
dbms_resource_manager.create_pending_area();
dbms_resource_manager.create_consumer_group(consumer_group => 'mytest_group', comment => '', cpu_mth => 'ROUND-ROBIN');
dbms_resource_manager.submit_pending_area();
END;
BEGIN
dbms_resource_manager.clear_pending_area();
dbms_resource_manager.create_pending_area();
dbms_resource_manager.create_plan( 'MYTEST_PLAN', '');
dbms_resource_manager.create_plan_directive(
    plan => 'MYTEST_PLAN',
    group_or_subplan => 'MYTEST_GROUP',
    comment => '',
    cpu_p1 => NULL, cpu_p2 => NULL, cpu_p3 => NULL, cpu_p4 => NULL,
    cpu_p5 => NULL, cpu_p6 => NULL, cpu_p7 => NULL, cpu_p8 => NULL,
    parallel_degree_limit_p1 => NULL,
    active_sess_pool_p1 => NULL,
    queueing_p1 => NULL,
    switch_group => 'KILL_SESSION',
    switch_time => 600,
    switch_estimate => false,
    max_est_exec_time => NULL,
    undo_pool => NULL,
    max_idle_time => NULL,
    max_idle_blocker_time => NULL,
    switch_time_in_call => NULL
dbms_resource_manager.create_plan_directive(
    plan => 'MYTEST_PLAN',
    group_or_subplan => 'OTHER_GROUPS',
    comment => '',
    cpu_p1 => NULL, cpu_p2 => NULL, cpu_p3 => NULL, cpu_p4 => NULL,
    cpu_p5 => NULL, cpu_p6 => NULL, cpu_p7 => NULL, cpu_p8 => NULL,
    parallel_degree_limit_p1 => NULL,
    active_sess_pool_p1 => NULL,
    queueing_p1 => NULL,
    switch_group => NULL,
    switch_time => NULL,
    switch_estimate => false,
    max_est_exec_time => NULL,
    undo_pool => NULL,
    max_idle_time => NULL,
    max_idle_blocker_time => NULL,
    switch_time_in_call => NULL
dbms_resource_manager.submit_pending_area();
END;
BEGIN
dbms_resource_manager.clear_pending_area();
dbms_resource_manager.create_pending_area();
dbms_resource_manager.set_consumer_group_mapping(
    dbms_resource_manager.oracle_user,
    'DEV',
    'MYTEST_GROUP'
dbms_resource_manager.submit_pending_area();
END;

Similar Messages

  • Plan shows SQL execution time Hrs 999:59:59 Sec.

    Dear Masters,
    Today my development team reported that the below query is taking more time. When I check the plan for my shok it is showing Hrs 999:59:59 Sec.
    Kindly help me in tuning this query.
    I am using oracle 10.2.0.3 version.
    SELECT 
    S_INVLOC.NAME , S_ORDER.ACCNT_ID , S_ORDER.APPR_BY_EMP_ID , S_ORDER.BL_CON_ID , S_ORDER.BL_OU_ID , S_ORDER.CARRIER_CD , S_ORDER.CONTACT_ID , S_ORDER.CURCY_CD , S_ORDER.TAX_EXEMPT_FLG ,
    S_ORDER.REQ_SHIP_DT , S_ORDER.SHIP_ADDR_ID , S_ORDER.SHIP_CON_ID , S_ORDER.SHIP_METH_CD , S_ORDER.SHIP_OU_ID , S_ORDER.STATUS_CD , S_ORDER.TAX_EXEMPT_NUM , S_ORDER.TAX_EXEMPT_REASON ,
    S_ORDER.OPTY_ID , S_ORDER.BU_ID PR_VIS_ORG_ID , S_ORDER.PROMO_ID , S_ORDER.PRI_LST_ID , S_ORDER.AGREE_ID AGREEMENT_ID , S_ORDER.ENTLMNT_ID ENTITLEMENT_ID , S_ORDER.SR_ID ,
    S_ORDER.BILLABLE_FLG , S_ORDER_ITEM.ROW_ID , S_ORDER_ITEM.ORDER_ID , S_ORDER_ITEM.LN_NUM , S_ORDER_ITEM.PROD_ID , S_ORDER_ITEM.ADJ_UNIT_PRI , S_ORDER_ITEM.BASE_UNIT_PRI ,
    S_ORDER_ITEM.CARRIER_CD CARRIER_CD1 , S_ORDER_ITEM.EXTD_QTY , S_ORDER_ITEM.QTY_SHIPPED , S_ORDER_ITEM.REQ_SHIP_DT REQ_SHIP_DT1 , S_ORDER_ITEM.SHIP_ADDR_ID SHIP_ADDR_ID1 ,
    S_ORDER_ITEM.SHIP_CON_ID SHIP_CON_ID1 , S_ORDER_ITEM.SHIP_METH_CD SHIP_METH_CD1 , S_ORDER_ITEM.STATUS_CD STATUS_CD1 , S_ORDER_ITEM.PROD_STATUS_CD , S_ORDER_ITEM.PROD_NAME ,
    S_ORDER_ITEM.LOANER_FLG , S_ORDER_ITEM.DISCNT_METH_CD , S_ORDER_ITEM.SHIP_OU_ID SHIP_OU_ID1 , S_ORDER_ITEM.STATUS_DT , S_ORDER_ITEM.MUST_DLVR_BY_DT , S_ORDER_ITEM.ACTION_CD ,
    S_ORDER_ITEM.ROLLUP_PRI , S_PROD_INT.NAME NAME1 , A.NAME NAME2 , B.NAME NAME3 , S_VOL_DISCNT.NAME NAME4 , ACCNT.PR_INDUST_ID , POSCRTDORG.OU_ID CREATED_BY_ORG_ID ,
    POSOWNERORG.OU_ID PR_OWNER_ORG_ID , PAROITEM.LN_NUM , PAROITEM.PROD_ID , SHIPOITEM.CITY , SHIPOITEM.COUNTRY , SHIPOITEM.ZIPCODE , SHIPO.CITY , SHIPO.COUNTRY , SHIPO.ZIPCODE ,
    BILL.CITY , BILL.COUNTRY , BILL.ZIPCODE , S_CAMP_CON.PR_CALL_LST_ID SEGMENT_ID , S_ORDER.DCP_ID OFFER_ID , APPRBYPOS.PR_HELD_POSTN_ID , POSOWNERORG.ROW_ID , POSOWNERORG.PR_EMP_ID ,
    S_ENTLMNT.PAR_AGREE_ID , ROOTOITEM.PROD_ID ROOT_LN_PROD_ID , ROOTOITEM.LN_NUM ROOT_LN_NUM , S_ORDER.PR_POSTN_ID , S_CAMP_CON.CAMP_LD_WAVE_ID , S_SRC.REGION_ID , OPRI.COST_PRI ,
    S_ORDER_ITEM.ORDER_ITM_CURCY_CD OITM_CURCY_CD , ROOTOITEM.ORDER_ITM_CURCY_CD ROOTOITM_CURCY_CD , S_ORDER_ITEM.ORDER_ITM_EXCH_DT OITM_AMT_DT , S_ORDER.ORDER_EXCH_DT ,
    S_ORDER_ITEM.CREATED , S_ORDER_ITEM.NET_PRI , S_ORDER_ITEM.CRSE_OFFR_ID , S_ORDER_ITEM.PRI_LST_ID OITM_PRI_LST_ID , ROOTOITEM.PRI_LST_ID ROOTOITM_PRI_LST_ID ,
    OWNORG.PRTNR_FLG , VISORG.PRTNR_FLG , S_CAMP_LD_WAVE.LAUNCHED_TS , QUOTE.CREATED , S_ORDER.ACTIVE_FLG , S_ORDER.APPROVED_FLG , PARPROD.PROD_TYPE_CD , ROOTPROD.PROD_TYPE_CD ,
    S_PROD_INT.PRICE_TYPE_CD , S_SRC.PROG_END_DT , S_SRC.PROG_START_DT , S_SRC.ROW_ID , S_ORDER.CREATED , OWNORG.ROW_ID , 0 AS X_CUSTOM , S_ORDER_ITEM. X_PHONE_NUMBER ,
    S_ORDER_ITEM.X_BACKEND_SERVICE_ID , S_ORDER_ITEM.SERVICE_NUM , S_ORDER_ITEM.BILL_ACCNT_ID , S_ORDER_X.ATTRIB_04 , S_ORDER_X.ATTRIB_30 , S_ORDER_X.ATTRIB_31
       FROM
    SIEBEL.V_ORDER_ITEM S_ORDER_ITEM, SIEBEL.S_ORDER_ITEM PAROITEM, SIEBEL.S_ORDER_ITEM ROOTOITEM, SIEBEL.S_ORDER, SIEBEL.S_VDISCNT_ITEM A, SIEBEL.S_VOL_DISCNT, SIEBEL.S_PROD_INT,
    SIEBEL.S_VDISCNT_ITEM B, SIEBEL.S_INVLOC, SIEBEL.S_ORG_EXT ACCNT, SIEBEL.S_POSTN POSOWNERORG, SIEBEL.S_CONTACT CRTD, SIEBEL.S_CONTACT APPRBYPOS, SIEBEL.S_POSTN POSCRTDORG,
    SIEBEL.S_ADDR_ORG SHIPOITEM, SIEBEL.S_ADDR_ORG SHIPO, SIEBEL.S_ADDR_ORG BILL, SIEBEL.S_CAMP_CON, SIEBEL.S_ENTLMNT, SIEBEL.S_SRC, SIEBEL.S_ORDER_ITM_PRI OPRI,
    SIEBEL.S_CAMP_LD_WAVE, SIEBEL.S_DOC_QUOTE QUOTE, SIEBEL.S_ORG_EXT OWNORG, SIEBEL.S_ORG_EXT OWNORG1, SIEBEL.S_ORG_EXT VISORG1, SIEBEL.S_ORG_EXT VISORG,
    SIEBEL.S_PROD_INT PARPROD, SIEBEL.S_PROD_INT ROOTPROD, SIEBEL.S_ORDER_X
    WHERE
         S_ORDER_ITEM.ORDER_ID     = S_ORDER.ROW_ID
        AND S_ORDER_ITEM.ROOT_ORDER_ITEM_ID  = ROOTOITEM.ROW_ID
        AND S_ORDER_ITEM.PAR_ORDER_ITEM_ID   = PAROITEM.ROW_ID(+)
        AND S_ORDER_ITEM.PROD_ID      = S_PROD_INT.ROW_ID(+)
        AND S_ORDER_ITEM.SRC_INVLOC_ID       = S_INVLOC.ROW_ID(+)
        AND S_ORDER_ITEM.VOL_DISCNT_ITEM_ID  = A.ROW_ID(+)
        AND S_ORDER_ITEM.VOL_DISCNT_ID       = S_VOL_DISCNT.ROW_ID(+)
        AND S_ORDER_ITEM.VOL_UPSELL_ITEM_ID  = B.ROW_ID(+)
        AND S_ORDER_ITEM.SHIP_ADDR_ID = SHIPOITEM.ROW_ID(+)
        AND S_ORDER.PR_POSTN_ID       = POSOWNERORG.ROW_ID(+)
        AND S_ORDER_ITEM.CREATED_BY   = CRTD.ROW_ID(+)
        AND CRTD.PR_HELD_POSTN_ID     = POSCRTDORG.ROW_ID(+)
        AND S_ORDER.ACCNT_ID   = ACCNT.ROW_ID(+)
        AND S_ORDER.CAMP_CON_ID       = S_CAMP_CON.ROW_ID(+)
        AND S_ORDER.SHIP_ADDR_ID      = SHIPO.ROW_ID(+)
        AND S_ORDER.BL_ADDR_ID        = BILL.ROW_ID(+)
        AND S_ORDER.APPR_BY_EMP_ID    = APPRBYPOS.ROW_ID(+)
        AND S_ORDER.ENTLMNT_ID        = S_ENTLMNT.ROW_ID(+)
        AND S_ORDER.PROMO_ID   = S_SRC.ROW_ID(+)
        AND S_ORDER_ITEM.ROW_ID       = OPRI.PAR_ROW_ID(+)
        AND S_CAMP_CON.CAMP_LD_WAVE_ID       = S_CAMP_LD_WAVE.ROW_ID(+)
        AND S_ORDER.QUOTE_ID   = QUOTE.ROW_ID(+)
        AND POSOWNERORG.OU_ID  = OWNORG1.ROW_ID(+)
        AND OWNORG1.PAR_BU_ID  = OWNORG.ROW_ID(+)
        AND S_ORDER.BU_ID      = VISORG1.ROW_ID(+)
        AND VISORG1.PAR_BU_ID  = VISORG.ROW_ID(+)
        AND PAROITEM.PROD_ID   = PARPROD.ROW_ID(+)
        AND ROOTOITEM.PROD_ID  = ROOTPROD.ROW_ID(+)
        AND S_ORDER_ITEM.ORDER_ID     = S_ORDER_X.PAR_ROW_ID(+)
        AND S_ORDER_ITEM.ROOT_ORDER_ITEM_ID IS NOT NULL;Execution Plan is : select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 73463824
    | Id  | Operation                                                | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                                         |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |   1 |  NESTED LOOPS OUTER                                      |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |   2 |   NESTED LOOPS OUTER                                     |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |   3 |    NESTED LOOPS OUTER                                    |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |   4 |     NESTED LOOPS OUTER                                   |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |   5 |      NESTED LOOPS OUTER                                  |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |   6 |       NESTED LOOPS                                       |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |   7 |        NESTED LOOPS OUTER                                |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |   8 |         NESTED LOOPS OUTER                               |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |   9 |          NESTED LOOPS OUTER                              |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |  10 |           NESTED LOOPS OUTER                             |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |  11 |            NESTED LOOPS OUTER                            |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |  12 |             NESTED LOOPS OUTER                           |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |  13 |              NESTED LOOPS OUTER                          |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |  14 |               NESTED LOOPS OUTER                         |                   |  3170K|    12G|  4100G  (4)|999:59:59 |
    |  15 |                NESTED LOOPS OUTER                        |                   |  3170K|    11G|  4100G  (4)|999:59:59 |
    |  16 |                 NESTED LOOPS OUTER                       |                   |  3170K|    11G|  4100G  (4)|999:59:59 |
    |  17 |                  NESTED LOOPS OUTER                      |                   |  3170K|    11G|  4100G  (4)|999:59:59 |
    |  18 |                   NESTED LOOPS OUTER                     |                   |  3170K|    10G|  4100G  (4)|999:59:59 |
    |  19 |                    NESTED LOOPS OUTER                    |                   |  3170K|    10G|  4100G  (4)|999:59:59 |
    |  20 |                     NESTED LOOPS OUTER                   |                   |  3170K|    10G|  4100G  (4)|999:59:59 |
    |  21 |                      NESTED LOOPS                        |                   |  3170K|  9911M|  4100G  (4)|999:59:59 |
    |  22 |                       NESTED LOOPS OUTER                 |                   |  3108K|  4927M|  2569K  (2)| 01:08:47 |
    |  23 |                        NESTED LOOPS OUTER                |                   |  3108K|  4835M|   115K (14)| 00:03:06 |
    |  24 |                         NESTED LOOPS OUTER               |                   |  3108K|  4782M|   115K (14)| 00:03:06 |
    |  25 |                          NESTED LOOPS OUTER              |                   |  3108K|  4660M|   112K (12)| 00:03:02 |
    |  26 |                           NESTED LOOPS OUTER             |                   |  3108K|  4417M|   112K (12)| 00:03:02 |
    |  27 |                            NESTED LOOPS OUTER            |                   |  3108K|  4227M|   112K (12)| 00:03:02 |
    |  28 |                             NESTED LOOPS OUTER           |                   |  3108K|  3943M|   112K (12)| 00:03:02 |
    |  29 |                              NESTED LOOPS OUTER          |                   |  3108K|  3178M|   111K (11)| 00:02:59 |
    |  30 |                               TABLE ACCESS FULL          | S_ORDER           |  3108K|  2413M|   109K  (9)| 00:02:56 |
    |  31 |                               TABLE ACCESS BY INDEX ROWID| S_ADDR_ORG        |     1 |   258 |     1   (0)| 00:00:01 |
    |* 32 |                                INDEX UNIQUE SCAN         | S_ADDR_ORG_P1     |     1 |       |     1   (0)| 00:00:01 |
    |  33 |                              TABLE ACCESS BY INDEX ROWID | S_ADDR_ORG        |     1 |   258 |     1   (0)| 00:00:01 |
    |* 34 |                               INDEX UNIQUE SCAN          | S_ADDR_ORG_P1     |     1 |       |     1   (0)| 00:00:01 |
    |  35 |                             TABLE ACCESS BY INDEX ROWID  | S_CAMP_CON        |     1 |    96 |     1   (0)| 00:00:01 |
    |* 36 |                              INDEX UNIQUE SCAN           | S_CAMP_CON_P1     |     1 |       |     1   (0)| 00:00:01 |
    |  37 |                            TABLE ACCESS BY INDEX ROWID   | S_ENTLMNT         |     1 |    64 |     1   (0)| 00:00:01 |
    |* 38 |                             INDEX UNIQUE SCAN            | S_ENTLMNT_P1      |     1 |       |     1   (0)| 00:00:01 |
    |  39 |                           TABLE ACCESS BY INDEX ROWID    | S_SRC             |     1 |    82 |     1   (0)| 00:00:01 |
    |* 40 |                            INDEX UNIQUE SCAN             | S_SRC_P1          |     1 |       |     1   (0)| 00:00:01 |
    |  41 |                          TABLE ACCESS BY INDEX ROWID     | S_CAMP_LD_WAVE    |     1 |    41 |     1   (0)| 00:00:01 |
    |* 42 |                           INDEX UNIQUE SCAN              | S_CAMP_LD_WAVE_P1 |     1 |       |     1   (0)| 00:00:01 |
    |  43 |                         TABLE ACCESS BY INDEX ROWID      | S_DOC_QUOTE       |     1 |    18 |     1   (0)| 00:00:01 |
    |* 44 |                          INDEX UNIQUE SCAN               | S_DOC_QUOTE_P1    |     1 |       |     1   (0)| 00:00:01 |
    |  45 |                        TABLE ACCESS BY INDEX ROWID       | S_POSTN           |     1 |    31 |     1   (0)| 00:00:01 |
    |* 46 |                         INDEX UNIQUE SCAN                | S_POSTN_P1        |     1 |       |     1   (0)| 00:00:01 |
    |* 47 |                       VIEW                               | V_ORDER_ITEM      |     1 |  1616 |  1318K  (4)| 00:35:19 |
    |  48 |                        NESTED LOOPS                      |                   |  3128K|  1372M|  1318K  (4)| 00:35:19 |
    |  49 |                         INDEX FAST FULL SCAN             | S_ETL_I_IMG_25_M2 |  3128K|    32M|  2756  (11)| 00:00:05 |
    |* 50 |                         TABLE ACCESS BY INDEX ROWID      | S_ORDER_ITEM      |     1 |   449 |     2   (0)| 00:00:01 |
    |* 51 |                          INDEX UNIQUE SCAN               | S_ORDER_ITEM_P1   |     1 |       |     2   (0)| 00:00:01 |
    |  52 |                      TABLE ACCESS BY INDEX ROWID         | S_VDISCNT_ITEM    |     1 |   134 |     1   (0)| 00:00:01 |
    |* 53 |                       INDEX UNIQUE SCAN                  | S_VDISCNT_ITEM_P1 |     1 |       |     1   (0)| 00:00:01 |
    |  54 |                     TABLE ACCESS BY INDEX ROWID          | S_VOL_DISCNT      |     1 |   134 |     1   (0)| 00:00:01 |
    |* 55 |                      INDEX UNIQUE SCAN                   | S_VOL_DISCNT_P1   |     1 |       |     1   (0)| 00:00:01 |
    |  56 |                    TABLE ACCESS BY INDEX ROWID           | S_VDISCNT_ITEM    |     1 |   134 |     1   (0)| 00:00:01 |
    |* 57 |                     INDEX UNIQUE SCAN                    | S_VDISCNT_ITEM_P1 |     1 |       |     1   (0)| 00:00:01 |
    |  58 |                   TABLE ACCESS BY INDEX ROWID            | S_ADDR_ORG        |     1 |   258 |     1   (0)| 00:00:01 |
    |* 59 |                    INDEX UNIQUE SCAN                     | S_ADDR_ORG_P1     |     1 |       |     1   (0)| 00:00:01 |
    |* 60 |                  TABLE ACCESS FULL                       | S_ORDER_ITM_PRI   |     1 |    45 |     0   (0)| 00:00:01 |
    |  61 |                 TABLE ACCESS BY INDEX ROWID              | S_INVLOC          |     1 |    33 |     1   (0)| 00:00:01 |
    |* 62 |                  INDEX UNIQUE SCAN                       | S_INVLOC_P1       |     1 |       |     1   (0)| 00:00:01 |
    |  63 |                TABLE ACCESS BY INDEX ROWID               | S_PROD_INT        |     1 |    58 |     1   (0)| 00:00:01 |
    |* 64 |                 INDEX UNIQUE SCAN                        | S_PROD_INT_P1     |     1 |       |     1   (0)| 00:00:01 |
    |  65 |               TABLE ACCESS BY INDEX ROWID                | S_ORDER_X         |     1 |    36 |     2   (0)| 00:00:01 |
    |* 66 |                INDEX RANGE SCAN                          | S_ORDER_X_U1      |     1 |       |     2   (0)| 00:00:01 |
    |  67 |              TABLE ACCESS BY INDEX ROWID                 | S_CONTACT         |     1 |    14 |     2   (0)| 00:00:01 |
    |* 68 |               INDEX UNIQUE SCAN                          | S_CONTACT_P1      |     1 |       |     1   (0)| 00:00:01 |
    |  69 |             TABLE ACCESS BY INDEX ROWID                  | S_POSTN           |     1 |    20 |     1   (0)| 00:00:01 |
    |* 70 |              INDEX UNIQUE SCAN                           | S_POSTN_P1        |     1 |       |     1   (0)| 00:00:01 |
    |  71 |            TABLE ACCESS BY INDEX ROWID                   | S_CONTACT         |     1 |    14 |     1   (0)| 00:00:01 |
    |* 72 |             INDEX UNIQUE SCAN                            | S_CONTACT_P1      |     1 |       |     1   (0)| 00:00:01 |
    |  73 |           TABLE ACCESS BY INDEX ROWID                    | S_ORG_EXT         |     1 |    14 |     2   (0)| 00:00:01 |
    |* 74 |            INDEX UNIQUE SCAN                             | S_ORG_EXT_P1      |     1 |       |     1   (0)| 00:00:01 |
    |  75 |          TABLE ACCESS BY INDEX ROWID                     | S_ORG_EXT         |     1 |    14 |     2   (0)| 00:00:01 |
    |* 76 |           INDEX UNIQUE SCAN                              | S_ORG_EXT_P1      |     1 |       |     1   (0)| 00:00:01 |
    |  77 |         TABLE ACCESS BY INDEX ROWID                      | S_ORG_EXT         |     1 |    17 |     2   (0)| 00:00:01 |
    |* 78 |          INDEX UNIQUE SCAN                               | S_ORG_EXT_P1      |     1 |       |     1   (0)| 00:00:01 |
    |  79 |        TABLE ACCESS BY INDEX ROWID                       | S_ORDER_ITEM      |     1 |    60 |     2   (0)| 00:00:01 |
    |* 80 |         INDEX UNIQUE SCAN                                | S_ORDER_ITEM_P1   |     1 |       |     2   (0)| 00:00:01 |
    |  81 |       TABLE ACCESS BY INDEX ROWID                        | S_ORDER_ITEM      |     1 |    24 |     2   (0)| 00:00:01 |
    |* 82 |        INDEX UNIQUE SCAN                                 | S_ORDER_ITEM_P1   |     1 |       |     2   (0)| 00:00:01 |
    |  83 |      TABLE ACCESS BY INDEX ROWID                         | S_PROD_INT        |     1 |    16 |     1   (0)| 00:00:01 |
    |* 84 |       INDEX UNIQUE SCAN                                  | S_PROD_INT_P1     |     1 |       |     1   (0)| 00:00:01 |
    |  85 |     TABLE ACCESS BY INDEX ROWID                          | S_PROD_INT        |     1 |    16 |     1   (0)| 00:00:01 |
    |* 86 |      INDEX UNIQUE SCAN                                   | S_PROD_INT_P1     |     1 |       |     1   (0)| 00:00:01 |
    |  87 |    TABLE ACCESS BY INDEX ROWID                           | S_ORG_EXT         |     1 |    14 |     2   (0)| 00:00:01 |
    |* 88 |     INDEX UNIQUE SCAN                                    | S_ORG_EXT_P1      |     1 |       |     1   (0)| 00:00:01 |
    |  89 |   TABLE ACCESS BY INDEX ROWID                            | S_ORG_EXT         |     1 |    17 |     2   (0)| 00:00:01 |
    |* 90 |    INDEX UNIQUE SCAN                                     | S_ORG_EXT_P1      |     1 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
      32 - access("S_ORDER"."SHIP_ADDR_ID"="SHIPO"."ROW_ID"(+))
      34 - access("S_ORDER"."BL_ADDR_ID"="BILL"."ROW_ID"(+))
      36 - access("S_ORDER"."CAMP_CON_ID"="S_CAMP_CON"."ROW_ID"(+))
      38 - access("S_ORDER"."ENTLMNT_ID"="S_ENTLMNT"."ROW_ID"(+))
      40 - access("S_ORDER"."PROMO_ID"="S_SRC"."ROW_ID"(+))
      42 - access("S_CAMP_CON"."CAMP_LD_WAVE_ID"="S_CAMP_LD_WAVE"."ROW_ID"(+))
      44 - access("S_ORDER"."QUOTE_ID"="QUOTE"."ROW_ID"(+))
      46 - access("S_ORDER"."PR_POSTN_ID"="POSOWNERORG"."ROW_ID"(+))
      47 - filter("S_ORDER_ITEM"."ORDER_ID"="S_ORDER"."ROW_ID")
      50 - filter("S_ORDER_ITEM"."ROOT_ORDER_ITEM_ID" IS NOT NULL)
      51 - access("S_ORDER_ITEM"."ROW_ID"="S_ETL_I_IMG_25"."ROW_ID")
      53 - access("S_ORDER_ITEM"."VOL_DISCNT_ITEM_ID"="A"."ROW_ID"(+))
      55 - access("S_ORDER_ITEM"."VOL_DISCNT_ID"="S_VOL_DISCNT"."ROW_ID"(+))
      57 - access("S_ORDER_ITEM"."VOL_UPSELL_ITEM_ID"="B"."ROW_ID"(+))
      59 - access("S_ORDER_ITEM"."SHIP_ADDR_ID"="SHIPOITEM"."ROW_ID"(+))
      60 - filter("S_ORDER_ITEM"."ROW_ID"="OPRI"."PAR_ROW_ID"(+))
    PLAN_TABLE_OUTPUT
      62 - access("S_ORDER_ITEM"."SRC_INVLOC_ID"="S_INVLOC"."ROW_ID"(+))
      64 - access("S_ORDER_ITEM"."PROD_ID"="S_PROD_INT"."ROW_ID"(+))
      66 - access("S_ORDER_ITEM"."ORDER_ID"="S_ORDER_X"."PAR_ROW_ID"(+))
      68 - access("S_ORDER_ITEM"."CREATED_BY"="CRTD"."ROW_ID"(+))
      70 - access("CRTD"."PR_HELD_POSTN_ID"="POSCRTDORG"."ROW_ID"(+))
      72 - access("S_ORDER"."APPR_BY_EMP_ID"="APPRBYPOS"."ROW_ID"(+))
      74 - access("S_ORDER"."ACCNT_ID"="ACCNT"."ROW_ID"(+))
      76 - access("POSOWNERORG"."OU_ID"="OWNORG1"."ROW_ID"(+))
      78 - access("OWNORG1"."PAR_BU_ID"="OWNORG"."ROW_ID"(+))
      80 - access("S_ORDER_ITEM"."ROOT_ORDER_ITEM_ID"="ROOTOITEM"."ROW_ID")
      82 - access("S_ORDER_ITEM"."PAR_ORDER_ITEM_ID"="PAROITEM"."ROW_ID"(+))
      84 - access("PAROITEM"."PROD_ID"="PARPROD"."ROW_ID"(+))
      86 - access("ROOTOITEM"."PROD_ID"="ROOTPROD"."ROW_ID"(+))
      88 - access("S_ORDER"."BU_ID"="VISORG1"."ROW_ID"(+))
      90 - access("VISORG1"."PAR_BU_ID"="VISORG"."ROW_ID"(+))
    132 rows selected.Edited by: KODS on Dec 13, 2012 2:11 PM

    Output of : select * from table(dbms_xplan.display_cursor('4nn6jbvwf0b2k', null, 'iostats last'));
    PLAN_TABLE_OUTPUT
    SQL_ID  4nn6jbvwf0b2k, child number 0
             S_ORDER.APPR_BY_EMP_ID ,
             S_ORDER.CARRIER_CD ,
             S_ORDER.CURCY_CD ,
             S_ORDER.SHIP_ADDR_ID,
             S_ORDER.SHIP_METH_CD ,
             S_ORDER.TAX_EXEMPT_NUM ,
             S_ORDER.BU_IDID ,EASON ,
             S_ORDER.PRI_LST_ID ,
             S_ORDER.ENTLMNT_ID ENTITLEMENT_ID ,
             S_ORDER_ITEM.ROW_ID ,,
             S_ORDER_ITEM.PROD_ID,
             S_ORDER_ITEM.BASE_UNIT_PRI ,
    S_
    Plan hash value: 73463824
    | Id  | Operation                                                | Name              | E-Rows |
    |   1 |  NESTED LOOPS OUTER                                      |                   |   3170K|
    |   2 |   NESTED LOOPS OUTER                                     |                   |   3170K|
    |   3 |    NESTED LOOPS OUTER                                    |                   |   3170K|
    |   4 |     NESTED LOOPS OUTER                                   |                   |   3170K|
    |   5 |      NESTED LOOPS OUTER                                  |                   |   3170K|
    |   6 |       NESTED LOOPS                                       |                   |   3170K|
    |   7 |        NESTED LOOPS OUTER                                |                   |   3170K|
    |   8 |         NESTED LOOPS OUTER                               |                   |   3170K|
    |   9 |          NESTED LOOPS OUTER                              |                   |   3170K|
    |  10 |           NESTED LOOPS OUTER                             |                   |   3170K|
    |  11 |            NESTED LOOPS OUTER                            |                   |   3170K|
    |  12 |             NESTED LOOPS OUTER                           |                   |   3170K|
    |  13 |              NESTED LOOPS OUTER                          |                   |   3170K|
    |  14 |               NESTED LOOPS OUTER                         |                   |   3170K|
    |  15 |                NESTED LOOPS OUTER                        |                   |   3170K|
    |  16 |                 NESTED LOOPS OUTER                       |                   |   3170K|
    |  17 |                  NESTED LOOPS OUTER                      |                   |   3170K|
    |  18 |                   NESTED LOOPS OUTER                     |                   |   3170K|
    |  19 |                    NESTED LOOPS OUTER                    |                   |   3170K|
    |  20 |                     NESTED LOOPS OUTER                   |                   |   3170K|
    |  21 |                      NESTED LOOPS                        |                   |   3170K|
    |  22 |                       NESTED LOOPS OUTER                 |                   |   3108K|
    |  23 |                        NESTED LOOPS OUTER                |                   |   3108K|
    |  24 |                         NESTED LOOPS OUTER               |                   |   3108K|
    |  25 |                          NESTED LOOPS OUTER              |                   |   3108K|
    |  26 |                           NESTED LOOPS OUTER             |                   |   3108K|
    |  27 |                            NESTED LOOPS OUTER            |                   |   3108K|
    |  28 |                             NESTED LOOPS OUTER           |                   |   3108K|
    |  29 |                              NESTED LOOPS OUTER          |                   |   3108K|
    |  30 |                               TABLE ACCESS FULL          | S_ORDER           |   3108K|
    |  31 |                               TABLE ACCESS BY INDEX ROWID| S_ADDR_ORG        |      1 |
    |* 32 |                                INDEX UNIQUE SCAN         | S_ADDR_ORG_P1     |      1 |
    |  33 |                              TABLE ACCESS BY INDEX ROWID | S_ADDR_ORG        |      1 |
    |* 34 |                               INDEX UNIQUE SCAN          | S_ADDR_ORG_P1     |      1 |
    |  35 |                             TABLE ACCESS BY INDEX ROWID  | S_CAMP_CON        |      1 |
    |* 36 |                              INDEX UNIQUE SCAN           | S_CAMP_CON_P1     |      1 |
    |  37 |                            TABLE ACCESS BY INDEX ROWID   | S_ENTLMNT         |      1 |
    |* 38 |                             INDEX UNIQUE SCAN            | S_ENTLMNT_P1      |      1 |
    |  39 |                           TABLE ACCESS BY INDEX ROWID    | S_SRC             |      1 |
    |* 40 |                            INDEX UNIQUE SCAN             | S_SRC_P1          |      1 |
    |  41 |                          TABLE ACCESS BY INDEX ROWID     | S_CAMP_LD_WAVE    |      1 |
    |* 42 |                           INDEX UNIQUE SCAN              | S_CAMP_LD_WAVE_P1 |      1 |
    |  43 |                         TABLE ACCESS BY INDEX ROWID      | S_DOC_QUOTE       |      1 |
    |* 44 |                          INDEX UNIQUE SCAN               | S_DOC_QUOTE_P1    |      1 |
    |  45 |                        TABLE ACCESS BY INDEX ROWID       | S_POSTN           |      1 |
    |* 46 |                         INDEX UNIQUE SCAN                | S_POSTN_P1        |      1 |
    |* 47 |                       VIEW                               | V_ORDER_ITEM      |      1 |
    |  48 |                        NESTED LOOPS                      |                   |   3128K|
    |  49 |                         INDEX FAST FULL SCAN             | S_ETL_I_IMG_25_M2 |   3128K|
    |* 50 |                         TABLE ACCESS BY INDEX ROWID      | S_ORDER_ITEM      |      1 |
    |* 51 |                          INDEX UNIQUE SCAN               | S_ORDER_ITEM_P1   |      1 |
    |  52 |                      TABLE ACCESS BY INDEX ROWID         | S_VDISCNT_ITEM    |      1 |
    |* 53 |                       INDEX UNIQUE SCAN                  | S_VDISCNT_ITEM_P1 |      1 |
    |  54 |                     TABLE ACCESS BY INDEX ROWID          | S_VOL_DISCNT      |      1 |
    |* 55 |                      INDEX UNIQUE SCAN                   | S_VOL_DISCNT_P1   |      1 |
    |  56 |                    TABLE ACCESS BY INDEX ROWID           | S_VDISCNT_ITEM    |      1 |
    |* 57 |                     INDEX UNIQUE SCAN                    | S_VDISCNT_ITEM_P1 |      1 |
    |  58 |                   TABLE ACCESS BY INDEX ROWID            | S_ADDR_ORG        |      1 |
    |* 59 |                    INDEX UNIQUE SCAN                     | S_ADDR_ORG_P1     |      1 |
    |* 60 |                  TABLE ACCESS FULL                       | S_ORDER_ITM_PRI   |      1 |
    |  61 |                 TABLE ACCESS BY INDEX ROWID              | S_INVLOC          |      1 |
    |* 62 |                  INDEX UNIQUE SCAN                       | S_INVLOC_P1       |      1 |
    |  63 |                TABLE ACCESS BY INDEX ROWID               | S_PROD_INT        |      1 |
    |* 64 |                 INDEX UNIQUE SCAN                        | S_PROD_INT_P1     |      1 |
    |  65 |               TABLE ACCESS BY INDEX ROWID                | S_ORDER_X         |      1 |
    |* 66 |                INDEX RANGE SCAN                          | S_ORDER_X_U1      |      1 |
    |  67 |              TABLE ACCESS BY INDEX ROWID                 | S_CONTACT         |      1 |
    |* 68 |               INDEX UNIQUE SCAN                          | S_CONTACT_P1      |      1 |
    |  69 |             TABLE ACCESS BY INDEX ROWID                  | S_POSTN           |      1 |
    |* 70 |              INDEX UNIQUE SCAN                           | S_POSTN_P1        |      1 |
    |  71 |            TABLE ACCESS BY INDEX ROWID                   | S_CONTACT         |      1 |
    |* 72 |             INDEX UNIQUE SCAN                            | S_CONTACT_P1      |      1 |
    |  73 |           TABLE ACCESS BY INDEX ROWID                    | S_ORG_EXT         |      1 |
    |* 74 |            INDEX UNIQUE SCAN                             | S_ORG_EXT_P1      |      1 |
    |  75 |          TABLE ACCESS BY INDEX ROWID                     | S_ORG_EXT         |      1 |
    |* 76 |           INDEX UNIQUE SCAN                              | S_ORG_EXT_P1      |      1 |
    |  77 |         TABLE ACCESS BY INDEX ROWID                      | S_ORG_EXT         |      1 |
    |* 78 |          INDEX UNIQUE SCAN                               | S_ORG_EXT_P1      |      1 |
    |  79 |        TABLE ACCESS BY INDEX ROWID                       | S_ORDER_ITEM      |      1 |
    |* 80 |         INDEX UNIQUE SCAN                                | S_ORDER_ITEM_P1   |      1 |
    |  81 |       TABLE ACCESS BY INDEX ROWID                        | S_ORDER_ITEM      |      1 |
    |* 82 |        INDEX UNIQUE SCAN                                 | S_ORDER_ITEM_P1   |      1 |
    |  83 |      TABLE ACCESS BY INDEX ROWID                         | S_PROD_INT        |      1 |
    |* 84 |       INDEX UNIQUE SCAN                                  | S_PROD_INT_P1     |      1 |
    |  85 |     TABLE ACCESS BY INDEX ROWID                          | S_PROD_INT        |      1 |
    |* 86 |      INDEX UNIQUE SCAN                                   | S_PROD_INT_P1     |      1 |
    |  87 |    TABLE ACCESS BY INDEX ROWID                           | S_ORG_EXT         |      1 |
    |* 88 |     INDEX UNIQUE SCAN                                    | S_ORG_EXT_P1      |      1 |
    |  89 |   TABLE ACCESS BY INDEX ROWID                            | S_ORG_EXT         |      1 |
    |* 90 |    INDEX UNIQUE SCAN                                     | S_ORG_EXT_P1      |      1 |
    Predicate Information (identified by operation id):
      32 - access("S_ORDER"."SHIP_ADDR_ID"="SHIPO"."ROW_ID")
    PLAN_TABLE_OUTPUT
      34 - access("S_ORDER"."BL_ADDR_ID"="BILL"."ROW_ID")
      36 - access("S_ORDER"."CAMP_CON_ID"="S_CAMP_CON"."ROW_ID")
      38 - access("S_ORDER"."ENTLMNT_ID"="S_ENTLMNT"."ROW_ID")
      40 - access("S_ORDER"."PROMO_ID"="S_SRC"."ROW_ID")
      42 - access("S_CAMP_CON"."CAMP_LD_WAVE_ID"="S_CAMP_LD_WAVE"."ROW_ID")
      44 - access("S_ORDER"."QUOTE_ID"="QUOTE"."ROW_ID")
      46 - access("S_ORDER"."PR_POSTN_ID"="POSOWNERORG"."ROW_ID")
      47 - filter("S_ORDER_ITEM"."ORDER_ID"="S_ORDER"."ROW_ID")
      50 - filter("S_ORDER_ITEM"."ROOT_ORDER_ITEM_ID" IS NOT NULL)
      51 - access("S_ORDER_ITEM"."ROW_ID"="S_ETL_I_IMG_25"."ROW_ID")
      53 - access("S_ORDER_ITEM"."VOL_DISCNT_ITEM_ID"="A"."ROW_ID")
      55 - access("S_ORDER_ITEM"."VOL_DISCNT_ID"="S_VOL_DISCNT"."ROW_ID")
      57 - access("S_ORDER_ITEM"."VOL_UPSELL_ITEM_ID"="B"."ROW_ID")
      59 - access("S_ORDER_ITEM"."SHIP_ADDR_ID"="SHIPOITEM"."ROW_ID")
      60 - filter("S_ORDER_ITEM"."ROW_ID"="OPRI"."PAR_ROW_ID")
      62 - access("S_ORDER_ITEM"."SRC_INVLOC_ID"="S_INVLOC"."ROW_ID")
      64 - access("S_ORDER_ITEM"."PROD_ID"="S_PROD_INT"."ROW_ID")
      66 - access("S_ORDER_ITEM"."ORDER_ID"="S_ORDER_X"."PAR_ROW_ID")
      68 - access("S_ORDER_ITEM"."CREATED_BY"="CRTD"."ROW_ID")
      70 - access("CRTD"."PR_HELD_POSTN_ID"="POSCRTDORG"."ROW_ID")
      72 - access("S_ORDER"."APPR_BY_EMP_ID"="APPRBYPOS"."ROW_ID")
      74 - access("S_ORDER"."ACCNT_ID"="ACCNT"."ROW_ID")
      76 - access("POSOWNERORG"."OU_ID"="OWNORG1"."ROW_ID")
      78 - access("OWNORG1"."PAR_BU_ID"="OWNORG"."ROW_ID")
      80 - access("S_ORDER_ITEM"."ROOT_ORDER_ITEM_ID"="ROOTOITEM"."ROW_ID")
      82 - access("S_ORDER_ITEM"."PAR_ORDER_ITEM_ID"="PAROITEM"."ROW_ID")
      84 - access("PAROITEM"."PROD_ID"="PARPROD"."ROW_ID")
      86 - access("ROOTOITEM"."PROD_ID"="ROOTPROD"."ROW_ID")
      88 - access("S_ORDER"."BU_ID"="VISORG1"."ROW_ID")
      90 - access("VISORG1"."PAR_BU_ID"="VISORG"."ROW_ID")
    Note
       - Warning: basic plan statistics not available. These are only collected when:
           * hint 'gather_plan_statistics' is used for the statement or
           * parameter 'statistics_level' is set to 'ALL', at session or system level
    154 rows selected.

  • Can the format of a SQL Statement modify the execution time of an SQL ....

    Can the format of a SQL Statement modify the execution time of an SQL statement?
    Thanks in advance

    It depends on:
    1) What oracle version are you using
    2) What do you mean for "format"
    For example: if you're on Oracle9i and changing format means changing the order of the tables in the FROM clause and you're using Rule Based Optimizer then the execution plan and the execution time can be very different...
    Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2009/12/29/estrarre-i-dati-in-formato-xml-da-sql/]

  • How to know the execution time of rule in Calculation Manager

    Hi All,
    How do we come to know the time of execution of rule in calculation manager ?
    Regards
    Vikram

    At this point there is no way to know the execution time of a rule in calculation Manager . If you are working on Planning rules, I believe planning displays the execution time in its job console.
    -SR

  • Same sqlID with different  execution plan  and  Elapsed Time (s), Executions time

    Hello All,
    The AWR reports for two days  with same sqlID with different  execution plan  and  Elapsed Time (s), Executions time please help me to find out what is  reason for this change.
    Please find the below detail 17th  day my process are very slow as compare to 18th
    17th Oct                                                                                                          18th Oct
    221,808,602
    21
    2tc2d3u52rppt
    213,170,100
    72,495,618
    9c8wqzz7kyf37
    209,239,059
    71,477,888
    9c8wqzz7kyf37
    139,331,777
    1
    7b0kzmf0pfpzn
    144,813,295
    1
    0cqc3bxxd1yqy
    102,045,818
    1
    8vp1ap3af0ma5
    128,892,787
    16,673,829
    84cqfur5na6fg
    89,485,065
    1
    5kk8nd3uzkw13
    127,467,250
    16,642,939
    1uz87xssm312g
    67,520,695
    8,058,820
    a9n705a9gfb71
    104,490,582
    12,443,376
    a9n705a9gfb71
    62,627,205
    1
    ctwjy8cs6vng2
    101,677,382
    15,147,771
    3p8q3q0scmr2k
    57,965,892
    268,353
    akp7vwtyfmuas
    98,000,414
    1
    0ybdwg85v9v6m
    57,519,802
    53
    1kn9bv63xvjtc
    87,293,909
    1
    5kk8nd3uzkw13
    52,690,398
    0
    9btkg0axsk114
    77,786,274
    74
    1kn9bv63xvjtc
    34,767,882
    1,003
    bdgma0tn8ajz9
    Not only queries are different but also the number of blocks read by top 10 queries are much higher on 17th than 18th.
    The other big difference is the average read time on two days
    Tablespace IO Stats
    17th Oct
    Tablespace
    Reads
    Av Reads/s
    Av Rd(ms)
    Av Blks/Rd
    Writes
    Av Writes/s
    Buffer Waits
    Av Buf Wt(ms)
    INDUS_TRN_DATA01
    947,766
    59
    4.24
    4.86
    185,084
    11
    2,887
    6.42
    UNDOTBS2
    517,609
    32
    4.27
    1.00
    112,070
    7
    108
    11.85
    INDUS_MST_DATA01
    288,994
    18
    8.63
    8.38
    52,541
    3
    23,490
    7.45
    INDUS_TRN_INDX01
    223,581
    14
    11.50
    2.03
    59,882
    4
    533
    4.26
    TEMP
    198,936
    12
    2.77
    17.88
    11,179
    1
    732
    2.13
    INDUS_LOG_DATA01
    45,838
    3
    4.81
    14.36
    348
    0
    1
    0.00
    INDUS_TMP_DATA01
    44,020
    3
    4.41
    16.55
    244
    0
    1,587
    4.79
    SYSAUX
    19,373
    1
    19.81
    1.05
    14,489
    1
    0
    0.00
    INDUS_LOG_INDX01
    17,559
    1
    4.75
    1.96
    2,837
    0
    2
    0.00
    SYSTEM
    7,881
    0
    12.15
    1.04
    1,361
    0
    109
    7.71
    INDUS_TMP_INDX01
    1,873
    0
    11.48
    13.62
    231
    0
    0
    0.00
    INDUS_MST_INDX01
    256
    0
    13.09
    1.04
    194
    0
    2
    10.00
    UNDOTBS1
    70
    0
    1.86
    1.00
    60
    0
    0
    0.00
    STG_DATA01
    63
    0
    1.27
    1.00
    60
    0
    0
    0.00
    USERS
    63
    0
    0.32
    1.00
    60
    0
    0
    0.00
    INDUS_LOB_DATA01
    62
    0
    0.32
    1.00
    60
    0
    0
    0.00
    TS_AUDIT
    62
    0
    0.48
    1.00
    60
    0
    0
    0.00
    18th Oct
    Tablespace
    Reads
    Av Reads/s
    Av Rd(ms)
    Av Blks/Rd
    Writes
    Av Writes/s
    Buffer Waits
    Av Buf Wt(ms)
    INDUS_TRN_DATA01
    980,283
    91
    1.40
    4.74

    The AWR reports for two days  with same sqlID with different  execution plan  and  Elapsed Time (s), Executions time please help me to find out what is  reason for this change.
    Please find the below detail 17th  day my process are very slow as compare to 18th
    You wrote with different  execution plan, I  think, you saw plans. It is very difficult, you get old plan.
    I think Execution plans is not changed in  different days, if you not added index  or ...
    What say ADDM report about this script?
    As you know, It is normally, different Elapsed Time for same statement in different  day.
    It is depend your database workload.
    It think you must use SQL Access and SQl Tuning advisor for this script.
    You can get solution for slow running problem.
    Regards
    Mahir M. Quluzade

  • Execution time from explain plan

    Hi
    How can i get the execution time of a query from explain plan (not tkprof). I don't see the execution time in the plan table output.
    Thanks

    Explain plan won't give execution time of a query because:
    - it does not execute the query
    - it only evaluates the execution plan and gives estimated costs
    I dont't know if it is possible to deduce execution time from estimated cost.
    Message was edited by:
    Pierre Forstmann

  • Execution Time & Explain Plan Variations

    I have a scenario here. I have 2 schemas; schema1 & schema2. I executed a lengthy SELECT statement of 5 TABLE JOIN in these 2 schemas. I am getting totally different execution time (one runs at 0.3 seconds & the other at 4 seconds) and a different Explain Plan. I assume that, since its the same SELECT statement in these schema, I should get the same Explain Plan. What could be the reason for these dissimilarities? Oracle Version: 9.2.0.8.0. I am ready to share the Explain Plan of these 2 schemas. But they are of length around 300 lines.
    Thank you.

    There are many factors come in to play here.
    1.) Size of all tables involved are same
    2.) structures are also same
    3.) Also indexes are same
    4.) Also stats are up to date on both
    5.) Constraints and other factors are also same.
    regards
    PravinAnd a few more.
    6) session environments are the same
    7) bind variable values are the same - or were at first execution
    I'd change 4 to read Optimizer statistics are the same. (not up to date which is a bit vague).
    In short if you are using the CBO and feed in the exact same inputs you will get the exact same plan, however typically you won't get the exact same inputs and so may get a different plan. If your query has a time element and the two queries are hard parsed at different times it may actually be impossible to get the same input - for example the percentage of a table that is returned by a predicate like
    timestamp_col > sysdate - 1 will be estimated differently depending on the time of parsing for the same data.
    That all said looking at the plans might reveal some obvious differences, though perhaps it might be better to point at a URL that holds the plans given the length you say they are.
    Niall Litchfield
    http://www.orawin.info/
    null

  • Tuning : Inconsistent result between Explain plan VS Execution Time

    Dear Experts,
    Need your suggestions belongs to contrary result between Explain plan VS Execution Time
    Environment :_
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit
    PL/SQL Release 10.2.0.4.0 - Production
    CORE     10.2.0.4.0     Production
    TNS for Linux: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    Red Hat Enterprise Linux 5.4
    There's same query but : 1st query access Loan_Account, 2nd query access Loan_Account_Han
    *1st.*
    Query Access Via : Loan_account (Partition Type : Hash (5) with column Contract_Number)
    Explain Plan : cost: 4,432, bytes: 716, cardinality: 2
    Execution Time : 13 seconds
    *2nd.*
    Query Access Via : Loan_Account_Han (Partition Type : List(5) with column Loan_Status)
    Explain Plan : cost:188,447 bytes: 1,661,088, cardinality: 4,719
    Execution Time : 10 seconds
    Note :_
    all tables and all indexes belong to the table which included in query has been analyzed.
    my question :
    1. why it could become like this ? I even confusing with Jonathan Lewis Theory : Cost-Based Fundamental Book.
    with this result, I even not believed with the result from Explain Plan anymore.
    2. If analyze tables and indexes to update statistics which help CBO to choose the best path as part of Daily Performance Tuning,
    is there a way that could do in enviroment 24x7 ?
    Note : if original query is needed, I'll posting it here.
    Any help is very appreciated and thanks very much.
    Regards,
    Sigcle

    The DBMS_XPLAN.DISPLAY_CURSOR output
    Query no 1
    PLAN_TABLE_OUTPUT
    SQL_ID  bq7avs72xvmkv, child number 0
    SELECT /*+ gather_plan_statistics */ la.office_code, la.currency_code AS currency, mf.NAME multifinance_id,        la.contract_number, mc.customer_name,       
    dco.os_principal_on_schedule AS os_principal_on_schedule,        f_get_param_value (la.financing_type,                           'FinancingType'                  
           ) AS financing_type,        CASE la.financing_type           WHEN 11                    -- Asset Purchase              THEN NVL (tp.os_principal_cust,     
                      la.os_principal_cust                       )           WHEN 12                                            -- JF Channelling              THEN
    NVL (tp.os_principal_mf, la.os_principal)        END AS os_principal_actual,        CASE           WHEN dco.bi_collectibility_with_gp >= 3              THEN 0    
          ELSE CASE           WHEN la.financing_type = '12'              THEN   NVL (ia.accrue_interest_pl, 0)                   + NVL (ia.accrue_interest_npl, 0)    
          ELSE   NVL (ia.accrue_
    Plan hash value: 4011856754
    | Id  | Operation                                  | Name                           | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |  OMem |  1Mem | Used-Mem |
    |   1 |  TABLE ACCESS BY INDEX ROWID               | COLLECTIBILITY_CODE            |      3 |      1 |      3 |00:00:00.01 |       9 |      2 |       |       |          |
    |*  2 |   INDEX SKIP SCAN                          | UNQ_COLLECTIBILITY_CODE        |      3 |      1 |      3 |00:00:00.01 |       6 |      1 |       |       |          |
    |   3 |  TABLE ACCESS BY GLOBAL INDEX ROWID        | MF_SCH_INSTALLMENT             |    501 |      1 |    501 |00:00:00.03 |    2004 |    796 |       |       |          |
    |*  4 |   INDEX UNIQUE SCAN                        | UNQ_MF_SCH_INSTALLMENT1        |    501 |      1 |    501 |00:00:00.02 |    1503 |    377 |       |       |          |
    |   5 |  TABLE ACCESS BY GLOBAL INDEX ROWID        | MF_SCH_INSTALLMENT             |    333 |      1 |    333 |00:00:00.10 |    3220 |   1074 |       |       |          |
    |*  6 |   INDEX UNIQUE SCAN                        | UNQ_MF_SCH_INSTALLMENT1        |    333 |      1 |    333 |00:00:00.09 |    2887 |   1074 |       |       |          |
    |   7 |   TABLE ACCESS BY GLOBAL INDEX ROWID       | CUST_SCH_INSTALLMENT           |    168 |      1 |    167 |00:00:00.05 |    1464 |    495 |       |       |          |
    |*  8 |    INDEX UNIQUE SCAN                       | UNQ_CUST_SCH_INSTALLMENT1      |    168 |      1 |    167 |00:00:00.05 |    1297 |    495 |       |       |          |
    |   9 |  TABLE ACCESS BY GLOBAL INDEX ROWID        | MF_SCH_INSTALLMENT             |    333 |      1 |    333 |00:00:00.06 |    3167 |      0 |       |       |          |
    |* 10 |   INDEX UNIQUE SCAN                        | UNQ_MF_SCH_INSTALLMENT1        |    333 |      1 |    333 |00:00:00.06 |    2834 |      0 |       |       |          |
    |  11 |   TABLE ACCESS BY GLOBAL INDEX ROWID       | CUST_SCH_INSTALLMENT           |    168 |      1 |    167 |00:00:00.03 |    1447 |      0 |       |       |          |
    |* 12 |    INDEX UNIQUE SCAN                       | UNQ_CUST_SCH_INSTALLMENT1      |    168 |      1 |    167 |00:00:00.03 |    1280 |      0 |       |       |          |
    |  13 |  TABLE ACCESS BY GLOBAL INDEX ROWID        | MF_SCH_INSTALLMENT             |    333 |      1 |    333 |00:00:00.06 |    3167 |      0 |       |       |          |
    |* 14 |   INDEX UNIQUE SCAN                        | UNQ_MF_SCH_INSTALLMENT1        |    333 |      1 |    333 |00:00:00.06 |    2834 |      0 |       |       |          |
    |  15 |   TABLE ACCESS BY GLOBAL INDEX ROWID       | CUST_SCH_INSTALLMENT           |    168 |      1 |    167 |00:00:00.03 |    1447 |      0 |       |       |          |
    |* 16 |    INDEX UNIQUE SCAN                       | UNQ_CUST_SCH_INSTALLMENT1      |    168 |      1 |    167 |00:00:00.03 |    1280 |      0 |       |       |          |
    |  17 |  TABLE ACCESS BY GLOBAL INDEX ROWID        | MF_SCH_INSTALLMENT             |    333 |      1 |    333 |00:00:00.06 |    3167 |      0 |       |       |          |
    |* 18 |   INDEX UNIQUE SCAN                        | UNQ_MF_SCH_INSTALLMENT1        |    333 |      1 |    333 |00:00:00.06 |    2834 |      0 |       |       |          |
    |  19 |   TABLE ACCESS BY GLOBAL INDEX ROWID       | CUST_SCH_INSTALLMENT           |    168 |      1 |    167 |00:00:00.03 |    1447 |      0 |       |       |          |
    |* 20 |    INDEX UNIQUE SCAN                       | UNQ_CUST_SCH_INSTALLMENT1      |    168 |      1 |    167 |00:00:00.03 |    1280 |      0 |       |       |          |
    |* 21 |  TABLE ACCESS FULL                         | COLLECTIBILITY_CODE            |      3 |      1 |      3 |00:00:00.01 |      12 |      1 |       |       |          |
    |  22 |  NESTED LOOPS OUTER                        |                                |      1 |      2 |    501 |00:00:01.02 |   96112 |  20091 |       |       |          |
    |  23 |   NESTED LOOPS                             |                                |      1 |      2 |    501 |00:00:00.28 |   13445 |   5358 |       |       |          |
    |  24 |    NESTED LOOPS                            |                                |      1 |      2 |    501 |00:00:00.26 |   11441 |   5071 |       |       |          |
    |  25 |     NESTED LOOPS OUTER                     |                                |      1 |      2 |    501 |00:00:00.24 |    9433 |   5014 |       |       |          |
    |* 26 |      HASH JOIN                             |                                |      1 |      2 |    501 |00:00:00.03 |     329 |    325 |  1206K|  1206K|  341K (0)|
    |* 27 |       TABLE ACCESS FULL                    | CURRENCY                       |      1 |      1 |      1 |00:00:00.01 |       3 |      2 |       |       |          |
    |* 28 |       HASH JOIN                            |                                |      1 |     61 |    501 |00:00:00.02 |     326 |    323 |   868K|   868K|  947K (0)|
    |* 29 |        HASH JOIN                           |                                |      1 |     10 |     13 |00:00:00.01 |       7 |      6 |   947K|   947K| 1030K (0)|
    |  30 |         TABLE ACCESS BY INDEX ROWID        | MULTIFINANCE                   |      1 |      5 |      9 |00:00:00.01 |       2 |      2 |       |       |          |
    |* 31 |          INDEX RANGE SCAN                  | IDX_STATUS_MF                  |      1 |      5 |      9 |00:00:00.01 |       1 |      1 |       |       |          |
    |* 32 |         TABLE ACCESS FULL                  | AGREEMENT                      |      1 |     18 |     13 |00:00:00.01 |       5 |      4 |       |       |          |
    |  33 |        VIEW                                |                                |      1 |    110 |    501 |00:00:00.02 |     319 |    317 |       |       |          |
    |* 34 |         HASH JOIN RIGHT OUTER              |                                |      1 |    110 |    501 |00:00:00.02 |     319 |    317 |  1011K|  1011K|  317K (0)|
    |  35 |          TABLE ACCESS BY INDEX ROWID       | TENANT_PARAMETER               |      1 |      1 |      1 |00:00:00.01 |       2 |      2 |       |       |          |
    |* 36 |           INDEX UNIQUE SCAN                | PK_TENANT_PARAMETER            |      1 |      1 |      1 |00:00:00.01 |       1 |      1 |       |       |          |
    |* 37 |          TABLE ACCESS BY GLOBAL INDEX ROWID| LOAN_ACCOUNT                   |      1 |    110 |    501 |00:00:00.02 |     317 |    315 |       |       |          |
    |* 38 |           INDEX RANGE SCAN                 | IDX_STATUS_LA1                 |      1 |   4394 |   3025 |00:00:00.01 |      15 |     14 |       |       |          |
    |* 39 |      TABLE ACCESS BY INDEX ROWID           | TX_PAYMENT                     |    501 |      1 |      0 |00:00:00.16 |    9104 |   4689 |       |       |          |
    |* 40 |       INDEX RANGE SCAN                     | FK_TX_PAY_LOAN_ACCT            |    501 |     12 |   8799 |00:00:00.02 |    1038 |    207 |       |       |          |
    |  41 |     TABLE ACCESS BY INDEX ROWID            | DL_CL_OUTSTANDING              |    501 |      1 |    501 |00:00:00.02 |    2008 |     57 |       |       |          |
    |* 42 |      INDEX RANGE SCAN                      | IDXLO_CNUM                     |    501 |      1 |    501 |00:00:00.01 |    1507 |     37 |       |       |          |
    |* 43 |    TABLE ACCESS BY INDEX ROWID             | MF_CUSTOMER                    |    501 |      1 |    501 |00:00:00.02 |    2004 |    287 |       |       |          |
    |* 44 |     INDEX UNIQUE SCAN                      | MF_CUSTOMER_PK                 |    501 |      1 |    501 |00:00:00.01 |    1503 |     24 |       |       |          |
    |* 45 |   TABLE ACCESS BY INDEX ROWID              | TX_INTEREST_ACCRUE             |    501 |      1 |      0 |00:00:00.73 |   82667 |  14733 |       |       |          |
    |* 46 |    INDEX RANGE SCAN                        | FK_TX_INTEREST_ACCRUE_LOAN_ACC |    501 |     67 |  40581 |00:00:00.14 |   42084 |    451 |       |       |          |
    Predicate Information (identified by operation id):
       2 - access("XX"."COLLECTIBILITY_CODE"=:B1)
           filter("XX"."COLLECTIBILITY_CODE"=:B1)
       4 - access("LOAN_ACCOUNT_ID"=:B1 AND "INSTALLMENT_NUMBER"=1)
       6 - access("MFSCH"."LOAN_ACCOUNT_ID"=:B1 AND "MFSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE(' 2013-02-18 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'),:B3))
       8 - access("CUSTSCH"."LOAN_ACCOUNT_ID"=:B1 AND "CUSTSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE(' 2013-02-18 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'),:B3))
      10 - access("MFSCH"."LOAN_ACCOUNT_ID"=:B1 AND "MFSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE(' 2013-02-18 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'),:B3))
      12 - access("CUSTSCH"."LOAN_ACCOUNT_ID"=:B1 AND "CUSTSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE(' 2013-02-18 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'),:B3))
      14 - access("MFSCH"."LOAN_ACCOUNT_ID"=:B1 AND "MFSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE(' 2013-02-18 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'),:B3))
      16 - access("CUSTSCH"."LOAN_ACCOUNT_ID"=:B1 AND "CUSTSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE(' 2013-02-18 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'),:B3))
      18 - access("MFSCH"."LOAN_ACCOUNT_ID"=:B1 AND "MFSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE(' 2013-02-18 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'),:B3))
      20 - access("CUSTSCH"."LOAN_ACCOUNT_ID"=:B1 AND "CUSTSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE(' 2013-02-18 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'),:B3))
      21 - filter(TO_NUMBER("COL"."COLLECTIBILITY_CODE")=:B1)
      26 - access("from$_subquery$_016"."CURRENCY_CODE"="CURR"."CURRENCY_CODE")
      27 - filter(UPPER("CURR"."STATUS")='A')
      28 - access("from$_subquery$_016"."AGREEMENT_ID"="A"."AGREEMENT_ID")
      29 - access("A"."MULTIFINANCE_ID"="MF"."MULTIFINANCE_ID")
      31 - access("MF"."SYS_NC00052$"='A')
      32 - filter(UPPER("A"."STATUS")='A')
      34 - access("LA"."TENANT_ID"="TENANT_ID")
      36 - access("TENANT_PARAMETER_ID"=23)
      37 - filter((UPPER("LA"."LOAN_STATUS")='AC' OR ("LA"."CLOSED_DATE"=TO_DATE(' 2013-02-18 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND
                  UPPER("LA"."LOAN_STATUS")='CN')))
      38 - access("LA"."SYS_NC00118$"='A')
      39 - filter(("TP"."APPROVAL_DATE"=TO_DATE(' 2013-02-18 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "TP"."DATA_SOURCE"=152 AND UPPER("TP"."APPROVAL_STATUS")='A'))
      40 - access("TP"."LOAN_ACCOUNT_ID"="from$_subquery$_016"."LOAN_ACCOUNT_ID")
      42 - access("DCO"."LOAN_CONTRACT_NUMBER"="from$_subquery$_016"."CONTRACT_NUMBER")
      43 - filter(UPPER("MC"."STATUS")='A')
      44 - access("from$_subquery$_016"."MF_CUSTOMER_ID"="MC"."MF_CUSTOMER_ID")
      45 - filter("IA"."ACCRUE_DATE"="XX"."PREV_DATE")
      46 - access("LA"."LOAN_ACCOUNT_ID"="IA"."LOAN_ACCOUNT_ID")
    The DBMS_XPLAN.DISPLAY_CURSOR output after : alter system flush buffer_cache; alter system flush shared_pool;
    Query no 2
    PLAN_TABLE_OUTPUT
    SQL_ID  cxmg4jfvr9pz0, child number 0
    SELECT /*+ gather_plan_statistics */ la.office_code, la.currency_code AS currency, mf.NAME multifinance_id,        la.contract_number, mc.customer_name,       
    dco.os_principal_on_schedule AS os_principal_on_schedule,        f_get_param_value (la.financing_type,                           'FinancingType'                  
           ) AS financing_type,        CASE la.financing_type           WHEN 11                    -- Asset Purchase              THEN NVL (tp.os_principal_cust,     
                      la.os_principal_cust                       )           WHEN 12                                            -- JF Channelling              THEN
    NVL (tp.os_principal_mf, la.os_principal)        END AS os_principal_actual,        CASE           WHEN dco.bi_collectibility_with_gp >= 3              THEN 0    
          ELSE CASE           WHEN la.financing_type = '12'              THEN   NVL (ia.accrue_interest_pl, 0)                   + NVL (ia.accrue_interest_npl, 0)    
          ELSE   NVL (ia.accrue_
    Plan hash value: 2072372033
    | Id  | Operation                            | Name                           | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |
    |   0 | SELECT STATEMENT                     |                                |  4719 |  1622K|   188K (32)| 00:37:42 |       |       |
    |   1 |  TABLE ACCESS BY INDEX ROWID         | COLLECTIBILITY_CODE            |     1 |    12 |     3   (0)| 00:00:01 |       |       |
    |*  2 |   INDEX SKIP SCAN                    | UNQ_COLLECTIBILITY_CODE        |     1 |       |     2   (0)| 00:00:01 |       |       |
    |   3 |  TABLE ACCESS BY GLOBAL INDEX ROWID  | MF_SCH_INSTALLMENT             |     1 |    17 |     3   (0)| 00:00:01 | ROWID | ROWID |
    |*  4 |   INDEX UNIQUE SCAN                  | UNQ_MF_SCH_INSTALLMENT1        |     1 |       |     2   (0)| 00:00:01 |       |       |
    |   5 |  TABLE ACCESS BY GLOBAL INDEX ROWID  | MF_SCH_INSTALLMENT             |     1 |    15 |     3   (0)| 00:00:01 | ROWID | ROWID |
    |*  6 |   INDEX UNIQUE SCAN                  | UNQ_MF_SCH_INSTALLMENT1        |     1 |       |     2   (0)| 00:00:01 |       |       |
    |   7 |   TABLE ACCESS BY GLOBAL INDEX ROWID | CUST_SCH_INSTALLMENT           |     1 |    15 |     3   (0)| 00:00:01 | ROWID | ROWID |
    |*  8 |    INDEX UNIQUE SCAN                 | UNQ_CUST_SCH_INSTALLMENT1      |     1 |       |     2   (0)| 00:00:01 |       |       |
    |   9 |  TABLE ACCESS BY GLOBAL INDEX ROWID  | MF_SCH_INSTALLMENT             |     1 |    15 |     3   (0)| 00:00:01 | ROWID | ROWID |
    |* 10 |   INDEX UNIQUE SCAN                  | UNQ_MF_SCH_INSTALLMENT1        |     1 |       |     2   (0)| 00:00:01 |       |       |
    |  11 |   TABLE ACCESS BY GLOBAL INDEX ROWID | CUST_SCH_INSTALLMENT           |     1 |    15 |     3   (0)| 00:00:01 | ROWID | ROWID |
    |* 12 |    INDEX UNIQUE SCAN                 | UNQ_CUST_SCH_INSTALLMENT1      |     1 |       |     2   (0)| 00:00:01 |       |       |
    |  13 |  TABLE ACCESS BY GLOBAL INDEX ROWID  | MF_SCH_INSTALLMENT             |     1 |    17 |     3   (0)| 00:00:01 | ROWID | ROWID |
    |* 14 |   INDEX UNIQUE SCAN                  | UNQ_MF_SCH_INSTALLMENT1        |     1 |       |     2   (0)| 00:00:01 |       |       |
    |  15 |   TABLE ACCESS BY GLOBAL INDEX ROWID | CUST_SCH_INSTALLMENT           |     1 |    17 |     3   (0)| 00:00:01 | ROWID | ROWID |
    |* 16 |    INDEX UNIQUE SCAN                 | UNQ_CUST_SCH_INSTALLMENT1      |     1 |       |     2   (0)| 00:00:01 |       |       |
    |  17 |  TABLE ACCESS BY GLOBAL INDEX ROWID  | MF_SCH_INSTALLMENT             |     1 |    17 |     3   (0)| 00:00:01 | ROWID | ROWID |
    |* 18 |   INDEX UNIQUE SCAN                  | UNQ_MF_SCH_INSTALLMENT1        |     1 |       |     2   (0)| 00:00:01 |       |       |
    |  19 |   TABLE ACCESS BY GLOBAL INDEX ROWID | CUST_SCH_INSTALLMENT           |     1 |    17 |     3   (0)| 00:00:01 | ROWID | ROWID |
    |* 20 |    INDEX UNIQUE SCAN                 | UNQ_CUST_SCH_INSTALLMENT1      |     1 |       |     2   (0)| 00:00:01 |       |       |
    |* 21 |  TABLE ACCESS FULL                   | COLLECTIBILITY_CODE            |     1 |    12 |     3   (0)| 00:00:01 |       |       |
    |  22 |  NESTED LOOPS                        |                                |  4719 |  1622K|   188K (32)| 00:37:42 |       |       |
    |  23 |   NESTED LOOPS                       |                                |  4719 |  1460K|   183K (33)| 00:36:45 |       |       |
    |  24 |    NESTED LOOPS OUTER                |                                |  4719 |  1354K|   180K (33)| 00:36:07 |       |       |
    |  25 |     NESTED LOOPS OUTER               |                                |  4719 |  1225K|   130K (46)| 00:26:01 |       |       |
    |* 26 |      HASH JOIN                       |                                |  4719 |  1106K| 23591   (2)| 00:04:44 |       |       |
    |  27 |       TABLE ACCESS BY INDEX ROWID    | MULTIFINANCE                   |     5 |   130 |     2   (0)| 00:00:01 |       |       |
    |* 28 |        INDEX RANGE SCAN              | IDX_STATUS_MF                  |     5 |       |     1   (0)| 00:00:01 |       |       |
    |* 29 |       HASH JOIN                      |                                |  8494 |  1775K| 23589   (2)| 00:04:44 |       |       |
    |* 30 |        TABLE ACCESS FULL             | AGREEMENT                      |    18 |   360 |     3   (0)| 00:00:01 |       |       |
    |* 31 |        HASH JOIN                     |                                |  8494 |  1609K| 23585   (2)| 00:04:44 |       |       |
    |* 32 |         TABLE ACCESS FULL            | CURRENCY                       |     1 |     4 |     3   (0)| 00:00:01 |       |       |
    |  33 |         VIEW                         |                                |   212K|    38M| 23579   (2)| 00:04:43 |       |       |
    |* 34 |          HASH JOIN RIGHT OUTER       |                                |   212K|    32M| 23579   (2)| 00:04:43 |       |       |
    |  35 |           TABLE ACCESS BY INDEX ROWID| TENANT_PARAMETER               |     1 |    74 |     1   (0)| 00:00:01 |       |       |
    |* 36 |            INDEX UNIQUE SCAN         | PK_TENANT_PARAMETER            |     1 |       |     0   (0)| 00:00:01 |       |       |
    |  37 |           PARTITION LIST ALL         |                                |   212K|    17M| 23575   (2)| 00:04:43 |     1 |     5 |
    |* 38 |            TABLE ACCESS FULL         | LOAN_ACCOUNT_HAN               |   212K|    17M| 23575   (2)| 00:04:43 |     1 |     5 |
    |  39 |      TABLE ACCESS BY INDEX ROWID     | TX_INTEREST_ACCRUE             |     1 |    26 |   130K (46)| 00:26:01 |       |       |
    |  40 |       BITMAP CONVERSION TO ROWIDS    |                                |       |       |            |          |       |       |
    |  41 |        BITMAP AND                    |                                |       |       |            |          |       |       |
    |  42 |         BITMAP CONVERSION FROM ROWIDS|                                |       |       |            |          |       |       |
    |* 43 |          INDEX RANGE SCAN            | FK_TX_INTEREST_ACCRUE_LOAN_ACC |    67 |       |     0   (0)| 00:00:01 |       |       |
    |  44 |         BITMAP CONVERSION FROM ROWIDS|                                |       |       |            |          |       |       |
    |* 45 |          INDEX RANGE SCAN            | IDX_TX_INTEREST_ACCRUE         |    67 |       |    12 (100)| 00:00:01 |       |       |
    |* 46 |     TABLE ACCESS BY INDEX ROWID      | TX_PAYMENT                     |     1 |    28 |    11   (0)| 00:00:01 |       |       |
    |* 47 |      INDEX RANGE SCAN                | FK_TX_PAY_LOAN_ACCT            |    12 |       |     0   (0)| 00:00:01 |       |       |
    |  48 |    TABLE ACCESS BY INDEX ROWID       | DL_CL_OUTSTANDING              |     1 |    23 |     1   (0)| 00:00:01 |       |       |
    |* 49 |     INDEX RANGE SCAN                 | IDXLO_CNUM                     |     1 |       |     0   (0)| 00:00:01 |       |       |
    |* 50 |   TABLE ACCESS BY INDEX ROWID        | MF_CUSTOMER                    |     1 |    35 |     1   (0)| 00:00:01 |       |       |
    |* 51 |    INDEX UNIQUE SCAN                 | MF_CUSTOMER_PK                 |     1 |       |     0   (0)| 00:00:01 |       |       |
    Predicate Information (identified by operation id):
       2 - access("XX"."COLLECTIBILITY_CODE"=:B1)
           filter("XX"."COLLECTIBILITY_CODE"=:B1)
       4 - access("LOAN_ACCOUNT_ID"=:B1 AND "INSTALLMENT_NUMBER"=1)
       6 - access("MFSCH"."LOAN_ACCOUNT_ID"=:B1 AND "MFSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE('
                  2013-02-18 00:00:00', 'syyyy-mm-dd hh24:mi:ss'),:B3))
       8 - access("CUSTSCH"."LOAN_ACCOUNT_ID"=:B1 AND "CUSTSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE('
                  2013-02-18 00:00:00', 'syyyy-mm-dd hh24:mi:ss'),:B3))
      10 - access("MFSCH"."LOAN_ACCOUNT_ID"=:B1 AND "MFSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE('
                  2013-02-18 00:00:00', 'syyyy-mm-dd hh24:mi:ss'),:B3))
      12 - access("CUSTSCH"."LOAN_ACCOUNT_ID"=:B1 AND "CUSTSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE('
                  2013-02-18 00:00:00', 'syyyy-mm-dd hh24:mi:ss'),:B3))
      14 - access("MFSCH"."LOAN_ACCOUNT_ID"=:B1 AND "MFSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE('
                  2013-02-18 00:00:00', 'syyyy-mm-dd hh24:mi:ss'),:B3))
      16 - access("CUSTSCH"."LOAN_ACCOUNT_ID"=:B1 AND "CUSTSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE('
                  2013-02-18 00:00:00', 'syyyy-mm-dd hh24:mi:ss'),:B3))
      18 - access("MFSCH"."LOAN_ACCOUNT_ID"=:B1 AND "MFSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE('
                  2013-02-18 00:00:00', 'syyyy-mm-dd hh24:mi:ss'),:B3))
      20 - access("CUSTSCH"."LOAN_ACCOUNT_ID"=:B1 AND "CUSTSCH"."INSTALLMENT_NUMBER"="F_NEXT_INSTALLMENT_NUMBER"(:B2,TO_DATE('
                  2013-02-18 00:00:00', 'syyyy-mm-dd hh24:mi:ss'),:B3))
      21 - filter(TO_NUMBER("COL"."COLLECTIBILITY_CODE")=:B1)
      26 - access("A"."MULTIFINANCE_ID"="MF"."MULTIFINANCE_ID")
      28 - access(UPPER("STATUS")='A')
      29 - access("from$_subquery$_016"."AGREEMENT_ID"="A"."AGREEMENT_ID")
      30 - filter(UPPER("A"."STATUS")='A')
      31 - access("from$_subquery$_016"."CURRENCY_CODE"="CURR"."CURRENCY_CODE")
      32 - filter(UPPER("CURR"."STATUS")='A')
      34 - access("LA"."TENANT_ID"="TENANT_ID"(+))
      36 - access("TENANT_PARAMETER_ID"(+)=23)
      38 - filter((UPPER("LA"."LOAN_STATUS")='AC' OR "LA"."CLOSED_DATE"=TO_DATE(' 2013-02-18 00:00:00', 'syyyy-mm-dd hh24:mi:ss')
                  AND UPPER("LA"."LOAN_STATUS")='CN') AND UPPER("LA"."STATUS")='A')
      43 - access("LA"."LOAN_ACCOUNT_ID"="IA"."LOAN_ACCOUNT_ID"(+))
      45 - access("IA"."ACCRUE_DATE"(+)="XX"."PREV_DATE")
      46 - filter("TP"."APPROVAL_DATE"(+)=TO_DATE(' 2013-02-18 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "TP"."DATA_SOURCE"(+)=152
                  AND UPPER("TP"."APPROVAL_STATUS"(+))='A')
      47 - access("TP"."LOAN_ACCOUNT_ID"(+)="from$_subquery$_016"."LOAN_ACCOUNT_ID")
      49 - access("DCO"."LOAN_CONTRACT_NUMBER"="from$_subquery$_016"."CONTRACT_NUMBER")
      50 - filter(UPPER("MC"."STATUS")='A')
      51 - access("from$_subquery$_016"."MF_CUSTOMER_ID"="MC"."MF_CUSTOMER_ID")Typically both query running on 10-12 seconds (or same execution time).
    And I can't provide autotrace and tkprof output cause I cannot access via sqlplus.
    Thanks very much for the link HOW TO: Post a SQL statement tuning request - template posting
    Regards,
    Sigcle
    Edited by: SigCle on Feb 25, 2013 4:22 AM

  • Limit on a emthod's execution time

    Hi,
    I'm trying to limit the execution time of a "slow" method, for example read of InputStream. I tried to set the following system proeprties:
    System.setProperty("sun.net.client.defaultConnectTimeout", "3000");
    System.setProperty("sun.net.client.defaultReadTimeout", "3000");but still, execution time lasts more than 3 seconds. Any idea what can be done?
    Thanks in advance,
    Alon.

    Thanks you both.
    Ths might turn out to be a really dummy question, but
    how can I get access to the Socket? Here's a snippet
    form my code:
    URLConnection urlConnection = url.openConnection();
    urlConnection.connect();
    InputStream in = urlConnection.getInputStream(); How can I setSoTimeout of the Socket?
    Thanks,
    Alon.You can't. The socket is not exposed for you to fiddle with, in that API. The lack of a timeout feature is an unfortunate omission from the API you're using, as you've probably observed it can lockup indefinitely. I've heard that Java 1.5 may have fixed that class/those classes.

  • DBMS Resource plan in 11.1

    Hello,
    I am using 11.1.0.7.0 2-node RAC on RHEL 5 (64 bit). I have enabled MIXED_WORKLOAD_PLAN in both the instances, with a modification to the threshold parameter for interactive group.
    I set the action to 'cancel the SQL' for the interactive group if the execution time exceeds 90 seconds. This is working perfect.
    My question is - Is there a way to capture the SQL ID that got cancelled along with session ID which was affected by the same? Does this information gets logged anywhere? Please can you help me on this?
    Regards,
    SK

    I cannot help with the exact answer of your question, but I can give you a broader solution that might be of help.
    We know that all SQLs that were canceled by the resource plan ran for more than 80 seconds, but less than 100 seconds. We can find all SQLs that run between 80 and 100 seconds and try to figure out which ones were terminated by the resource plan. We can use the resource plan definition, application logs and other application dependant sources to do the filtering. This method is not exact and could be quite labor intensive.
    Assuming you are licensed to use ASH, you can use this queries to get all sessions that ran between 75 and 105 seconds:
    During the recent past (minutes):
    select session_id , session_serial# , sql_id , min_tm , max( exec_time) , count(*)
    FROM
    ( select session_id , session_serial# , sql_id , min_tm , ( max_tm - min_tm ) exec_time
    FROM
    select session_id , session_serial# , sql_id , sample_time ,
    max(sample_time) over (partition by session_id , session_serial# , sql_id ) max_tm,
    min(sample_time) over (partition by session_id , session_serial# , sql_id ) min_tm
    from v$active_session_history
    where sample_time between <begin time > and <end time >
    and sql_id is not null) )
    where exec_time > interval '75' SECOND 
    and exec_time <   interval '105' SECOND  group by session_id, session_serial#, sql_id, min_tm
    having count(*) > 70Historically – depending on your ASH settings:
    select session_id , session_serial# , sql_id , min_tm , max( exec_time) , count(*)
    FROM
    ( select session_id , session_serial# , sql_id , min_tm , ( max_tm - min_tm ) exec_time
    FROM
    select session_id , session_serial# , sql_id , sample_time ,
    max(sample_time) over (partition by session_id , session_serial# , sql_id ) max_tm,
    min(sample_time) over (partition by session_id , session_serial# , sql_id ) min_tm
    from dba_hist_active_sess_history
    where sample_time between <begin time > and <end time >
    and sql_id is not null) )
    where exec_time > interval '75' SECOND 
    and exec_time <   interval '105' SECOND  group by session_id, session_serial#, sql_id, min_tm
    having count(*) > 7

  • Select - execution time strange behaviour

    hi all,
    when i executed an SQL - select (with joins and so on) - I have observed the following behaviour:
    Query execution times are like: -
    for 1000 records - 4 sec
    5000 records - 10 sec
    10000 records - 7 sec
    25000 records - 16 sec
    50000 records - 33 sec
    I tested this behaviour with different sets of sqls on different sets of data. But in each of the cases, the behaviour is more or less the same.
    Can any one explain - why Oracle takes more time to result 5000 records than that it takes to 10000. (In some cases, this behaviour can be observed at ~2000 to ~5000 )
    Please note that this has not something to do with the SQLs as - i tested this with different sets of sql on different sets of data.
    Can there be any Oracle`s internal reason - which can explain this behaviour?
    regards
    at

    at,
    Things you need to check before you go further -
    1) Are you using OPTIMIZER_MODE=CHOOSE or OPTIMIZER_MODE=RULE?
    2) If you are using RULE then rewrite the queries or use some hints to help it along. If you're using a 3rd party application, then consider going to CHOOSE for the optimizer_mode.
    3) If you're using CHOOSE (Cost Based Optimizer) then:
    a) update your statistics. You can do this by creating a .cmd (or shell) file that logs into sqlplus or svrmgrl (better get use to sqlplus qs it isn't around qnymore in 9i), then call a sql file you will create(@c:\users\oracledba\analyze.sql for example). The analyze.sql file might look something like this:
    #create a file to call in just a moment
    spool c:\users\oracledba\anaylzed.sql
    select 'analyze table' ||table_name|| 'compute statistics;' from dba_tables where owner NOT IN ('SYS', 'SYSTEM', 'DBA_USER', 'EXP_USER', 'QUEST', 'any_other_user_who_is_not_a_normal_user') and type <> 'TEMPORARY';
    #execute the file you just created
    @c:\users\oracledba\anaylzed.sql
    spool off
    b) This should give you an easy to use point-and-click way to anayle your tables. You can make a similar one for indexes as well. Don't run this thing every five minutes or you'll end up with crap. If possible, run it at a busy time of day but at a time when the performance impact caused by the script (which actually isn't much but does have an effect) won't be too drastic.
    You also need to take a look at some additional OPTIMIZER_MODE accompanying parameters that will effect the time given to the CBO. Important ones are
    a)optimizer_max_permutations (set to 1000 to limit the number of plans the optimizer examines before choosing the best plan. It can be as hig as 80000 but that is too many and research indicates that setting it to 1000 to start is good because the optimizer considers the fact that it only has 1000 shots at finding the best plan and derives the most likely first)
    b)optimizer_index_caching (set to 95 which tells the optimizer that 95% of the time it will find the index in the cache and to use the index - typically this is set equal to your hit ratio)
    c)optimizer_index_cost_adj is a bit more complicated (set it to a value that will tell Oracle how much cheaper it is to access the data via index vs. accessing it through full table scan. I'd start with 5 as a value and monitor it from there).
    There are several other things you can do also - like creating bitmap indexes (assuming you've created indexes in the correct columns already).
    If you send some more details about your environment etc we can provide more info.
    Hope this helps,
    The Infamous
    Eric Cartman

  • TO REDUCE THE EXECUTION TIME OF REPORT

    HI,
         CAN ANYONE TELL ME THAT, HOW CAN I REDUCE THE EXECUTION TIME OF THE REPORT. IS THERE ANY IDEA TO IMPROVE THE PERFORMANCE OF THE REPORT.

    Hi Santosh,
    Good check out the following documentation
    <b>Performance tuning</b>
    For all entries
    Nested selects
    Select using JOINS
    Use the selection criteria
    Use the aggregated functions
    Select with view
    Select with index support
    Select … Into table
    Select with selection list
    Key access to multiple lines
    Copying internal tables
    Modifying a set of lines
    Deleting a sequence of lines
    Linear search vs. binary
    Comparison of internal tables
    Modify selected components
    Appending two internal tables
    Deleting a set of lines
    Tools available in SAP to pin-point a performance problem
    <b>Optimizing the load of the database</b>
    For all entries
    The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause.
    The plus
    Large amount of data
    Mixing processing and reading of data
    Fast internal reprocessing of data
    Fast
    The Minus
    Difficult to program/understand
    Memory could be critical (use FREE or PACKAGE size)
    Some steps that might make FOR ALL ENTRIES more efficient:
    Removing duplicates from the the driver table
    Sorting the driver table
    If possible, convert the data in the driver table to ranges so a BETWEEN statement is used instead of and OR statement:
    FOR ALL ENTRIES IN i_tab
      WHERE mykey >= i_tab-low and
            mykey <= i_tab-high.
    Nested selects
    The plus:
    Small amount of data
    Mixing processing and reading of data
    Easy to code - and understand
    The minus:
    Large amount of data
    when mixed processing isn’t needed
    Performance killer no. 1
    Select using JOINS
    The plus
    Very large amount of data
    Similar to Nested selects - when the accesses are planned by the programmer
    In some cases the fastest
    Not so memory critical
    The minus
    Very difficult to program/understand
    Mixing processing and reading of data not possible
    Use the selection criteria
    SELECT * FROM SBOOK.                   
      CHECK: SBOOK-CARRID = 'LH' AND       
                      SBOOK-CONNID = '0400'.        
    ENDSELECT.                             
    SELECT * FROM SBOOK                     
      WHERE CARRID = 'LH' AND               
            CONNID = '0400'.                
    ENDSELECT.                              
    Use the aggregated functions
    C4A = '000'.              
    SELECT * FROM T100        
      WHERE SPRSL = 'D' AND   
            ARBGB = '00'.     
      CHECK: T100-MSGNR > C4A.
      C4A = T100-MSGNR.       
    ENDSELECT.                
    SELECT MAX( MSGNR ) FROM T100 INTO C4A 
    WHERE SPRSL = 'D' AND                
           ARBGB = '00'.                  
    Select with view
    SELECT * FROM DD01L                    
      WHERE DOMNAME LIKE 'CHAR%'           
            AND AS4LOCAL = 'A'.            
      SELECT SINGLE * FROM DD01T           
        WHERE   DOMNAME    = DD01L-DOMNAME 
            AND AS4LOCAL   = 'A'           
            AND AS4VERS    = DD01L-AS4VERS 
            AND DDLANGUAGE = SY-LANGU.     
    ENDSELECT.                             
    SELECT * FROM DD01V                    
    WHERE DOMNAME LIKE 'CHAR%'           
           AND DDLANGUAGE = SY-LANGU.     
    ENDSELECT.                             
    Select with index support
    SELECT * FROM T100            
    WHERE     ARBGB = '00'      
           AND MSGNR = '999'.    
    ENDSELECT.                    
    SELECT * FROM T002.             
      SELECT * FROM T100            
        WHERE     SPRSL = T002-SPRAS
              AND ARBGB = '00'      
              AND MSGNR = '999'.    
      ENDSELECT.                    
    ENDSELECT.                      
    Select … Into table
    REFRESH X006.                 
    SELECT * FROM T006 INTO X006. 
      APPEND X006.                
    ENDSELECT
    SELECT * FROM T006 INTO TABLE X006.
    Select with selection list
    SELECT * FROM DD01L              
      WHERE DOMNAME LIKE 'CHAR%'     
            AND AS4LOCAL = 'A'.      
    ENDSELECT
    SELECT DOMNAME FROM DD01L    
    INTO DD01L-DOMNAME         
    WHERE DOMNAME LIKE 'CHAR%' 
           AND AS4LOCAL = 'A'.  
    ENDSELECT
    Key access to multiple lines
    LOOP AT TAB.          
    CHECK TAB-K = KVAL. 
    ENDLOOP.              
    LOOP AT TAB WHERE K = KVAL.     
    ENDLOOP.                        
    Copying internal tables
    REFRESH TAB_DEST.              
    LOOP AT TAB_SRC INTO TAB_DEST. 
      APPEND TAB_DEST.             
    ENDLOOP.                       
    TAB_DEST[] = TAB_SRC[].
    Modifying a set of lines
    LOOP AT TAB.             
      IF TAB-FLAG IS INITIAL.
        TAB-FLAG = 'X'.      
      ENDIF.                 
      MODIFY TAB.            
    ENDLOOP.                 
    TAB-FLAG = 'X'.                  
    MODIFY TAB TRANSPORTING FLAG     
               WHERE FLAG IS INITIAL.
    Deleting a sequence of lines
    DO 101 TIMES.               
      DELETE TAB_DEST INDEX 450.
    ENDDO.                      
    DELETE TAB_DEST FROM 450 TO 550.
    Linear search vs. binary
    READ TABLE TAB WITH KEY K = 'X'.
    READ TABLE TAB WITH KEY K = 'X' BINARY SEARCH.
    Comparison of internal tables
    DESCRIBE TABLE: TAB1 LINES L1,      
                    TAB2 LINES L2.      
    IF L1 <> L2.                        
      TAB_DIFFERENT = 'X'.              
    ELSE.                               
      TAB_DIFFERENT = SPACE.            
      LOOP AT TAB1.                     
        READ TABLE TAB2 INDEX SY-TABIX. 
        IF TAB1 <> TAB2.                
          TAB_DIFFERENT = 'X'. EXIT.    
        ENDIF.                          
      ENDLOOP.                          
    ENDIF.                              
    IF TAB_DIFFERENT = SPACE.           
    ENDIF.                              
    IF TAB1[] = TAB2[].  
    ENDIF.               
    Modify selected components
    LOOP AT TAB.           
    TAB-DATE = SY-DATUM. 
    MODIFY TAB.          
    ENDLOOP.               
    WA-DATE = SY-DATUM.                    
    LOOP AT TAB.                           
    MODIFY TAB FROM WA TRANSPORTING DATE.
    ENDLOOP.                               
    Appending two internal tables
    LOOP AT TAB_SRC.              
      APPEND TAB_SRC TO TAB_DEST. 
    ENDLOOP
    APPEND LINES OF TAB_SRC TO TAB_DEST.
    Deleting a set of lines
    LOOP AT TAB_DEST WHERE K = KVAL. 
      DELETE TAB_DEST.               
    ENDLOOP
    DELETE TAB_DEST WHERE K = KVAL.
    Tools available in SAP to pin-point a performance problem
    The runtime analysis (SE30)
    SQL Trace (ST05)
    Tips and Tricks tool
    The performance database
    Optimizing the load of the database
    Using table buffering
    Using buffered tables improves the performance considerably. Note that in some cases a stament can not be used with a buffered table, so when using these staments the buffer will be bypassed. These staments are:
    Select DISTINCT
    ORDER BY / GROUP BY / HAVING clause
    Any WHERE clasuse that contains a subquery or IS NULL expression
    JOIN s
    A SELECT... FOR UPDATE
    If you wnat to explicitly bypass the bufer, use the BYPASS BUFFER addition to the SELECR clause.
    Use the ABAP SORT Clause Instead of ORDER BY
    The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed on the application server. The datbase server will usually be the bottleneck, so sometimes it is better to move thje sort from the datsbase server to the application server.
    If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to use the ABAP SORT stament to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution and you would want to let the datbase server sort it.
    Avoid ther SELECT DISTINCT Statement
    As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplciate rows.
    Good Luck and thanks
    AK

  • Data Driven Subscriptions Error - the query processor could not start the necessary thread resources for parallel query execution

    Hi,
    We are getting the following error when certain data driven subscriptions are fired off: "the query processor could not start the necessary thread resources for parallel query execution".  I've read other posts that have the same error, and
    the solution usually involves adjusting MaxDOP to limit the number of queries that are fired off in parallel.  
    Unfortunately, we cannot change this setting on our server for performance reasons (outside of data driven subscriptions, it negatively impacts our ETL processing times).  We tried putting query hints like "OPTION (MAXDOP 2);" in the reports
    that are causing the error, but it did not resolve the problem.
    Are there any settings within Reporting Services that can be adjusted to limit the number of subscriptions that get fired off in parallel?
    Any help is appreciated - thanks!

    Yes, that is correct.  It's a painful problem, because you don't know which specific subscription failed. For example, we have a data driven subscription that sends out about 800 emails. Lately, we've been having a handful of them fail. You don't know
    which ones out of the 800 failed though, even from the RS log files - all it tells you is that "the
    query processor could not start the necessary thread resources for parallel query execution".
    Thanks, I'll try changing <MaxQueueThreads> and will let you know if it works.
    On a side note: I've noticed that it is only reports with cascading parameters (ex. where parameter 2 is dependent on the selection from parameter 1) that get this error message...

  • How to get the total execution time from a tkprof file

    Hi,
    I have a tkprof file. How can I get the total execution time. Going through the file i guess the sum of "Total Waited" would give the total time in the section "Elapsed times include waiting on following events:"
    . The sample of tkprof is given below.
    SQL ID: gg52tq1ajzy7t Plan Hash: 3406052038
    SELECT POSTED_FLAG
    FROM
    AP_INVOICE_PAYMENTS WHERE CHECK_ID = :B1 UNION ALL SELECT POSTED_FLAG FROM
      AP_PAYMENT_HISTORY APH, AP_SYSTEM_PARAMETERS ASP WHERE CHECK_ID = :B1 AND
      NVL(APH.ORG_ID, -99) = NVL(ASP.ORG_ID, -99) AND
      (NVL(ASP.WHEN_TO_ACCOUNT_PMT, 'ALWAYS') = 'ALWAYS' OR
      (NVL(ASP.WHEN_TO_ACCOUNT_PMT, 'ALWAYS') = 'CLEARING ONLY' AND
      APH.TRANSACTION_TYPE IN ('PAYMENT CLEARING', 'PAYMENT UNCLEARING')))
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute    442      0.08       0.13          0          0          0           0
    Fetch      963      0.22       4.72        350      16955          0         521
    total     1406      0.31       4.85        350      16955          0         521
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 173     (recursive depth: 1)
    Number of plan statistics captured: 1
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
             1          1          1  UNION-ALL  (cr=38 pr=3 pw=0 time=139 us)
             1          1          1   TABLE ACCESS BY INDEX ROWID AP_INVOICE_PAYMENTS_ALL (cr=5 pr=0 pw=0 time=124 us cost=6 size=12 card=1)
             1          1          1    INDEX RANGE SCAN AP_INVOICE_PAYMENTS_N2 (cr=4 pr=0 pw=0 time=92 us cost=3 size=0 card=70)(object id 27741)
             0          0          0   NESTED LOOPS  (cr=33 pr=3 pw=0 time=20897 us)
             0          0          0    NESTED LOOPS  (cr=33 pr=3 pw=0 time=20891 us cost=12 size=41 card=1)
             1          1          1     TABLE ACCESS FULL AP_SYSTEM_PARAMETERS_ALL (cr=30 pr=0 pw=0 time=313 us cost=9 size=11 card=1)
             0          0          0     INDEX RANGE SCAN AP_PAYMENT_HISTORY_N1 (cr=3 pr=3 pw=0 time=20568 us cost=2 size=0 card=1)(object id 27834)
             0          0          0    TABLE ACCESS BY INDEX ROWID AP_PAYMENT_HISTORY_ALL (cr=0 pr=0 pw=0 time=0 us cost=3 size=30 card=1)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                       350        0.15          4.33
      Disk file operations I/O                        3        0.00          0.00
      latch: shared pool                              1        0.17          0.17
    ********************************************************************************

    user13019948 wrote:
    Hi,
    I have a tkprof file. How can I get the total execution time.
    call count cpu elapsed disk query current rows
    total 1406 0.31 4.85 350 16955 0 521TOTAL ELAPSED TIME is 4.85 seconds from line above

  • How to find out the execution time of a sql inside a function

    Hi All,
    I am writing one function. There is only one IN parameter. In that parameter, i will pass one SQL select statement. And I want the function to return the exact execution time of that SQL statement.
    CREATE OR REPLACE FUNCTION function_name (p_sql IN VARCHAR2)
    RETURN NUMBER
    IS
    exec_time NUMBER;
    BEGIN
    --Calculate the execution time for the incoming sql statement.
    RETURN exec_time;
    END function_name;
    /

    Please note that wrapping query in a "SELECT COUNT(*) FROM (<query>)" doesn't necessarily reflect the execution time of the stand-alone query because the optimizer is smart and might choose a completely different execution plan for that query.
    A simple test case shows the potential difference of work performed by the database:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    Session altered.
    SQL>
    SQL> drop table count_test purge;
    Table dropped.
    Elapsed: 00:00:00.17
    SQL>
    SQL> create table count_test as select * from all_objects;
    Table created.
    Elapsed: 00:00:02.56
    SQL>
    SQL> alter table count_test add constraint pk_count_test primary key (object_id)
    Table altered.
    Elapsed: 00:00:00.04
    SQL>
    SQL> exec dbms_stats.gather_table_stats(ownname=>null, tabname=>'COUNT_TEST')
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.29
    SQL>
    SQL> set autotrace traceonly
    SQL>
    SQL> select * from count_test;
    5326 rows selected.
    Elapsed: 00:00:00.10
    Execution Plan
    Plan hash value: 3690877688
    | Id  | Operation         | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |            |  5326 |   431K|    23   (5)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| COUNT_TEST |  5326 |   431K|    23   (5)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
            419  consistent gets
              0  physical reads
              0  redo size
         242637  bytes sent via SQL*Net to client
           4285  bytes received via SQL*Net from client
            357  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
           5326  rows processed
    SQL>
    SQL> select count(*) from (select * from count_test);
    Elapsed: 00:00:00.00
    Execution Plan
    Plan hash value: 572193338
    | Id  | Operation             | Name          | Rows  | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |               |     1 |     5   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE       |               |     1 |            |          |
    |   2 |   INDEX FAST FULL SCAN| PK_COUNT_TEST |  5326 |     5   (0)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
             16  consistent gets
              0  physical reads
              0  redo size
            412  bytes sent via SQL*Net to client
            380  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL>As you can see the number of blocks processed (consistent gets) is quite different. You need to actually fetch all records, e.g. using a PL/SQL block on the server to find out how long it takes to process the query, but that's not that easy if you want to have an arbitrary query string as input.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle:
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

Maybe you are looking for

  • SCVMM 2012 agent install fails on standalone 2008 R2 host

    I am attempting to install SCVMM 2012 agent and getting this error: Error (421) Agent installation failed on exhpv01.denverwater.org because of a WS-Management configuration error. Recommended Action Ensure that the Windows Remote Management service

  • Newest standard HDMI cable. No video, hear audio

    I have an AppleTV and purchased a new (current standard) HDMI Cable. For some reason, I can get video (tv says no signal) but I hear audio when using the remote (the beeps). Anyone else experience this issue?

  • Cant install iOS 8.2 because I don't know my code

    Haven't updated in ages, now have enough storage to do so and keeps asking for 4 digit code? my restrictions were off, I turned them on and put in a 4 digit code then tried it, still not working. I've tried 3 times now and not sure how many times I c

  • Convert document into string with unicode

    I want to convert my document into string with all <,>,& to be converted into <, >, and &. When I am doing transformation, I am getting <,> etc. Can anybody suggest me how to do that. regards, Ranjan

  • How to install oracle http server in the windows

    Hi, Can any one mention how to install oracle HTTP server in windows 2003 server machine? regards, suresh G.