Performance issue with the Select query

Hi,
I have an issue with the performance with a seclet query.
In table AFRU - AUFNR is not a key field.
So i had selected the low and high values into s_reuck and used it in Where condition.
Still i have an issue with the Performance.
SELECT SINGLE RUECK
RMZHL
IEDD
AUFNR
STOKZ
STZHL
FROM AFRU INTO table t_AFRU
FOR ALL ENTRIES IN T_ZSCPRT100
WHERE RUECK IN S_RUECK AND
AUFNR = T_ZSCPRT100-AUFNR AND
STOKZ = SPACE AND
STZHL = 0.
I had also cheked by createing an index for AUFNR in the table AFRU...it does not help.
Is there anyway that we can declare Key field while declaring the Internal table....?
ANy suggestions to fix the performance issue is apprecaited!
Regards,
Kittu

Hi,
Thank you for your quick response!
Rui dantas, i have lill confusion...this is my code below :
data : t_zscprt type standard table of ty_zscprt,
       wa_zscprt type ty_zscprt.
types : BEGIN OF ty_zscprt100,
        aufnr type zscprt100-aufnr,
        posnr  type zscprt100-posnr,
        ezclose type zscprt100-ezclose,
        serialnr type zscprt100-serialnr,
        lgort type zscprt100-lgort,
      END OF ty_zscprt100.
data : t_zscprt100 type standard table of ty_zscprt100,
       wa_zscprt100 type ty_zscprt100.
Types: begin of ty_afru,
            rueck type CO_RUECK,
            rmzhl type CO_RMZHL,
            iedd  type RU_IEDD,
            aufnr type AUFNR,
            stokz type CO_STOKZ,
            stzhl type CO_STZHL,
         end of ty_afru.
data : t_afru type STANDARD TABLE OF ty_afru,
        WA_AFRU TYPE TY_AFRU.
SELECT AUFNR
        POSNR
        EZCLOSE
        SERIALNR
        LGORT
        FROM ZSCPRT100 INTO TABLE T_ZSCPRT100
        FOR ALL ENTRIES IN T_ZSCPRT
        WHERE   AUFNR = T_ZSCPRT-PRTNUM
        AND   SERIALNR IN S_SERIAL
        AND    LGORT   IN S_LGORT.
    IF sy-subrc <> 0.
       MESSAGE ID 'Z2' TYPE 'I' NUMBER '41'. "BDCG87
       stop."BDCG87
    ENDIF.
  ENDIF.
SELECT    RUECK
              RMZHL
              IEDD
              AUFNR
              STOKZ
              STZHL
              FROM AFRU INTO TABLE T_AFRU
              FOR ALL ENTRIES IN T_ZSCPRT100
              WHERE RUECK IN S_RUECK     AND
                    AUFNR = T_ZSCPRT100-AUFNR AND
                    STOKZ = SPACE AND
                    STZHL = 0.
Using AUFNR, get AUFPL from AFKO
Using AUFPL, get RUECK from AFVC
Using RUEKC, read AFRU
In other words, one select joining AFKO <-> AFVC <-> AFRU should get what you want.
This is my select query, would you want me to write another select query to meet this criteria..
From AUFNR> I will get AUFPL from AFKO> BAsed on AUFPL I will get RUECK, based on RUEKC i need to read AFRU..but i need to select few field from AFRu based on AUFNR....
ANy suggestions wil be appreciated!
Regards
Kittu

Similar Messages

  • Issue with the select query

    Hi,
    DATA: BEGIN OF IT_MATERIAL OCCURS 0,
          IDNRK  LIKE  STPO-IDNRK,
          MATNR  LIKE  MAST-MATNR,
          END OF IT_MATERIAL.
    FORM CHECK_SALESDATA_EXISTENCE .
      IF NOT IT_MATERIAL[] IS INITIAL.
        LOOP AT IT_MATERIAL.
          CLEAR VBAP.
          SELECT SINGLE * FROM VBAP WHERE MATNR EQ IT_MATERIAL-MATNR.
          IF SY-SUBRC NE 0.
            DELETE IT_MATERIAL WHERE IDNRK EQ IT_MATERIAL-IDNRK
                                 AND MATNR EQ IT_MATERIAL-MATNR.
          ENDIF.
          CLEAR IT_MATERIAL.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " CHECK_SALESDATA_EXISTENCE
    The above is the subroutine in the program which check whether sales data exists for a material or not. But the problem is the select statement which is written in the loop is taking so much of time because of this the program is going into short dump "Time Exceed Limit".
    Please suggest how can i modifiy the above statemnt so that the performance of the program increases.
    <REMOVED BY MODERATOR>
    Thanks.
    Edited by: Alvaro Tejada Galindo on Mar 4, 2008 10:37 AM

    The program deletes multiple records inside a loop. This isn't good practice. The following should work:
    REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.
    TABLES: vapma.
    DATA: BEGIN OF it_material OCCURS 0,
      matnr LIKE mast-matnr,
      idnrk LIKE stpo-idnrk,
    END OF it_material.
    PERFORM check_salesdata_existence.
    *&      Form  CHECK_SALESDATA_EXISTENCE
    *       text
    FORM check_salesdata_existence .
      DATA: delete.
      SORT it_material BY matnr.
      LOOP AT it_material.
        AT NEW matnr.
          SELECT SINGLE * FROM vapma
            WHERE matnr EQ it_material-matnr.
          IF sy-subrc <> 0.
            delete = 'X'.
          ELSE.
            CLEAR delete.
          ENDIF.
        ENDAT.
        IF delete = 'X'.
          DELETE it_material.
        ENDIF.
      ENDLOOP.
    ENDFORM. " CHECK_SALESDATA_EXISTENCE
    Note that I have changed the filed order in it_material so that AT NEW will work correctly.
    Rob

  • Need some help with the Select query.

    Need some help with the Select query.
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    select single vkorg abgru from ZADS into it_rej.
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
            VKORG TYPE VBAK-VKORG,
            ABGRU TYPE VBAP-ABGRU,
           END OF IT_REJ.
    This is causing performance issue. They are asking me to include the where condition for this select query.
    What should be my select query here?
    Please suggest....
    Any suggestion will be apprecaiated!
    Regards,
    Developer

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • Performance issue with the ABAP statements

    Hello,
    Please can some help me with the below statements where I am getting performance problem.
    SELECT * FROM /BIC/ASALHDR0100 into Table CHDATE.
    SORT CHDATE by DOC_NUMBER.
    SORT SOURCE_PACKAGE by DOC_NUMBER.
    LOOP AT CHDATE INTO WA_CHDATE.
       READ TABLE SOURCE_PACKAGE INTO WA_CIDATE WITH KEY DOC_NUMBER =
       WA_CHDATE-DOC_NUMBER BINARY SEARCH.
       MOVE WA_CHDATE-CREATEDON  to WA_CIDATE-CREATEDON.
    APPEND WA_CIDATE to CIDATE.
    ENDLOOP.
    I wrote an above code for the follwing requirement.
    1. I have 2 tables from where i am getting the data
    2.I have common fields in both the table names CREATEDON date. In both the tables I hve the values.
    3. While accessing the 2 table and copying to thrid table i have to modify the field.
    I am getting performance issues with the above statements.
    Than
    Edited by: Rob Burbank on Jul 29, 2010 10:06 AM

    Hello,
    try a select like the following one instead of you code.
    SELECT field field2 ...
    INTO TABLE it_table
    FROM table1 AS T1 INNER JOIN table2 AS T2
    ON t1-doc_number = t2-doc_number

  • Is there a recommended limit on the number of custom sections and the cells per table so that there are no performance issues with the UI?

    Is there a recommended limit on the number of custom sections and the cells per table so that there are no performance issues with the UI?

    Thanks Kelly,
    The answers would be the following:
    1200 cells per custom section (NEW COUNT), and up to 30 custom sections per spec.
    Assuming all will be populated, and this would apply to all final material specs in the system which could be ~25% of all material specs.
    The cells will be numeric, free text, drop downs, and some calculated numeric.
    Are we reaching the limits for UI performance?
    Thanks

  • Performance issues with the Vouchers index build in SES

    Hi All,
    We are currently performing an upgrade for: PS FSCM 9.1 to PS FSCM 9.2.
    As a part of the upgrade, Client wants Oracle SES to be deployed for some modules including, Purchasing, Payables (Vouchers)
    We are facing severe performance issues with the Vouchers index build. (Volume of data = approx. 8.5 million rows of data)
    The index creation process runs for over 5 days.
    Can you please share any information or issues that you may have faced on your project and how they were addressed?

    Check the following logs for errors:
    1.  The message log from the process scheduler
    2.  search_server1-diagnostic.log  in /search_server1/logs directory
    If the build is getting stuck while crawling then we typically have to increase the Java Heap size for the Weblogic instance for SES>

  • Performance issues with the Tuxedo MQ Adapter

    We are experimenting some performance issues with the MQ Adapter. For example, we are seeing that the MQ Adapter takes from 10 to 100 ms in reading a single message from the queue and sending to the Tuxedo service. The Tuxedo service takes 80 ms in its execution so there is a considerable waste of time in the MQ adapter that we cannot explain.
    Also, we have looked a lot of rollback transactions on the MQ adapter, for example we got 980 rollback transactions for 15736 transactions sent and only the MQ adapter is involved in the rollback. However, the operations are executed properly. The error we got is
    135027.122.hqtux101!MQI_QMTESX01.7636.1.0: gtrid x0 x4ec1491f x25b59: LIBTUX_CAT:376: ERROR: tpabort: xa_rollback returned XA_RBROLLBACK.
    I am looking for information at Oracle site, but I have not found nothing. Could you or someone from your team help me?

    Hi Todd,
    We have 6 MQI adapters reading from 5 different queues, but in this case we are writing in only one queue.
    Someone from Oracle told us that the XA_RBROLLBACK occurs because we have 6 MQ adapters that are reading from the same queues and when one adapter finds a message and try to get that message, it can occurs that other MQ Adapter gets it before. In this case, the MQ adapter rollbacks the transaction. Even when we got some XA_RBROLLBACK errors, we don´t lose message. Also, I read something about that when XA sends a xa_end call to MQ adapter, it actually does the rollback, so when the MQ adapter receives the xa_rollback call, it answers with XA_RBROLLBACK. Is that true?
    However, I am more worried about the performance. We are putting a request message in a MQ queue and waiting for the reply. In some cases, it takes 150ms and in other cases it takes much more longer (more than 400ms). The average is 300ms. MQ adapter calls a service (txgralms0) which lasts 110ms in average.
    This is our configuration:
    "MQI_QMTESX01" SRVGRP="g03000" SRVID=3000
    CLOPT="-- -C /tuxedo/qt/txqgral00/control/src/MQI_QMTESX01.cfg"
    RQPERM=0600 REPLYQ=N RPPERM=0600 MIN=6 MAX=6 CONV=N
    SYSTEM_ACCESS=FASTPATH
    MAXGEN=1 GRACE=86400 RESTART=N
    MINDISPATCHTHREADS=0 MAXDISPATCHTHREADS=1 THREADSTACKSIZE=0
    SICACHEENTRIESMAX="500"
    /tuxedo/qt/txqgral00/control/src/MQI_QMTESX01.cfg:
    *SERVER
    MINMSGLEVEL=0
    MAXMSGLEVEL=0
    DEFMAXMSGLEN=4096
    TPESVCFAILDATA=Y
    *QUEUE_MANAGER
    LQMID=QMTESX01
    NAME=QMTESX01
    *SERVICE
    NAME=txgralms0
    FORMAT=MQSTR
    TRAN=N
    *QUEUE
    LQMID=QMTESX01
    MQNAME=QAT.Q.NACAR.TO.TUX.KGCRQ01
    *QUEUE
    LQMID=QMTESX01
    MQNAME=QAT.Q.NACAR.TO.TUX.KGCPQ01
    *QUEUE
    LQMID=QMTESX01
    MQNAME=QAT.Q.NACAR.TO.TUX.KPSAQ01
    *QUEUE
    LQMID=QMTESX01
    MQNAME=QAT.Q.NACAR.TO.TUX.KPINQ01
    *QUEUE
    LQMID=QMTESX01
    MQNAME=QAT.Q.NACAR.TO.TUX.KDECQ01
    Thanks in advance,
    Marling

  • Performance issue with view selection after migration from oracle to MaxDb

    Hello,
    After the migration from oracle to MaxDb we have serious performance issues with a lot of our tableview selections.
    Does anybody know about this problem and how to solve it ??
    Best regards !!!
    Gert-Jan

    Hello Gert-Jan,
    most probably you need additional indexes to get better performance.
    Using the command monitor you can identify the long running SQL statements and check the optimizer access strategy. Then you can decide which indexes might help.
    If this is about an SAP system, you can find additional information about performance analysis in SAP notes 725489 and 819641.
    SAP Hosting provides the so-called service 'MaxDB Migration Support' to help you in such cases. The service description can be found here:
    http://www.saphosting.de/mediacenter/pdfs/solutionbriefs/MaxDB_de.pdf
    http://www.saphosting.com/mediacenter/pdfs/solutionbriefs/maxDB-migration-support_en.pdf.
    Best regards,
    Melanie Handreck

  • How can i use index in select query.. facing problem with the select query.

    Hi Friends,
    I am facing a serious problem in one of the select query. It is taking a lot of time to fetch data in Production Scenario.
    Here is the query:
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelat LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelatrprctr
        WHERE rldnr  = c_telstra_accounting
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          And rzzlstar in r_lstar                            
          AND rpmax  = c_max_period.
    There are 5 indices present for Table ZTFTELAT.
    Indices of ZTFTELAT:
      Name   Description                                               
      0        Primary key( RCLNT,RLDNR,RRCTY,RVERS,RYEAR,ROBJNR,SOBJNR,RTCUR,RUNIT,DRCRK,RPMAX)                                          
      005    Profit (RCLNT,RPRCTR)
      1        Ledger, company code, account (RLDNR,RBUKRS, RACCT)                                
      2        Ledger, company code, cost center (RLDNR, RBUKRS,RCNTR)                           
      3        Account, cost center (RACCT,RCNTR)                                        
      4        RCLNT/RLDNR/RRCTY/RVERS/RYEAR/RZZAUFNR                        
      Z01    Activity Type, Account (RZZLSTAR,RACCT)                                        
      Z02    RYEAR-RBUKRS- RZZZBER-RLDNR       
    Can anyone help me out why it is taking so much time and how we can reduce it ? and also tell me if I want to use index number 1 then how can I use?
    Thanks in advance.

    Hi Shiva,
    I am using two more select queries with the same manner ....
    here are the other two select query :
    ***************1************************
    SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelpt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelptrprctr
        WHERE rldnr  = c_telstra_projects
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar             
          AND rpmax  = c_max_period.
    and the second one is
    *************************2************************
      SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
        FROM ztftelnt LEFT JOIN ztfzberep
         ON  ztfzberep~gjahr = st_input-gjahr
         AND ztfzberep~poper = st_input-poper
         AND ztfzberepcntr  = ztftelntrprctr
        WHERE rldnr  = c_telstra_networks
          AND rrcty  = c_actual
          AND rvers  = c_ver_001
          AND rbukrs = st_input-bukrs
          AND racct  = st_input-saknr
          AND ryear  = st_input-gjahr
          and rzzlstar in r_lstar                              
          AND rpmax  = c_max_period.
    for both the above table program is taking very less time .... although both the table used in above queries have similar amount of data. And i can not remove the APPENDING CORRESPONDING. because i have to append the data after fetching from the tables.  if i will not use it will delete all the data fetched earlier.
    Thanks on advanced......
    Sourabh

  • Issue with one Select Query in  PBS Archive Translation Tool

    Hi All,
    Iam having X mark symbol against the select query from EKET table
    This is the select query in my actual program and when i convert this using PBS Archive Translation Tool i have a X mark against this select query
    SELECT SINGLE BANFN FROM EKET INTO V_BANFN WHERE EBELN = BSEG-EBELN AND
                                                      EBELP = BSEG-EBELP AND
                                                      ETENR = '0001'.
    I guess i have to modify this select query because EKET table has transaction data and we cannot ignore this X mark.
    Let me know if iam wrong
    ALso , iam confused whether a select query with X needs to fixed or can be ignored
    Thanks

    Hi ,
    Any Suggestions
    Thanks

  • Performance Issue with the query

    Hi Experts,
    While working on peoplesoft, today I was stuck with a problem when one of the Query is performing really bad. With all the statistics updates, query is not performing good. On one of the table, query is spending time doing lot of IO. (db file sequential read wait). And if I delete the stats for the table and let dynamic sampling to take place, query just works good and there is no IO wait on the table.
    Here is the query
    SELECT A.BUSINESS_UNIT_PC, A.PROJECT_ID,  E.DESCR,  A.EMPLID,  D.NAME,  C.DESCR,  A.TRC,
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD'), 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 1, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 2, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 3, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 4, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 5, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 6, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 7, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 8, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 9, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 10, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 11, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 12, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 13, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 14, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 15, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 16, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 17, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 18, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 19, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 20, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 21, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 22, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 23, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 24, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 25, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 26, 'DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 6, 5), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 27, 'MM-DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 6, 5), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 28, 'MM-DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 6, 5), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 29, 'MM-DD'), A.TL_QUANTITY, 0)),
      SUM( DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 6, 5), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 30, 'MM-DD'), A.TL_QUANTITY, 0)),
      SUM( A.EST_GROSS),
      DECODE( A.TRC, 'ROVA1', 0, 'ROVA2', 0, ( SUM( A.EST_GROSS)/100) * 9.75),
      '2012-07-01',
      '2012-07-31',
      SUM(     DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD'), 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 1, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 2, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 3, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 4, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 5, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 6, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 7, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 8, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 9, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 10, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 11, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 12, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 13, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 14, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 15, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 16, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 17, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 18, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 19, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 20, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 21, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 22, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 23, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 24, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 25, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 9, 2), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 26, 'DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 6, 5), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 27, 'MM-DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 6, 5), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 28, 'MM-DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 6, 5), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 29, 'MM-DD'), A.TL_QUANTITY, 0) +
         DECODE(SUBSTR( TO_CHAR(A.DUR,'YYYY-MM-DD'), 6, 5), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD') + 30, 'MM-DD'), A.TL_QUANTITY, 0)
      DECODE( A.CURRENCY_CD, 'USD', '$', 'GBP', '£', 'EUR', '€', 'AED', 'D', 'NGN', 'N', ' '),
      DECODE(SUBSTR( F.GP_PAYGROUP, 1, 2), 'NG', 'NG', F.PER_ORG),
      DECODE(TO_CHAR(to_date('2012-07-31', 'YYYY-MM-DD'), 'MM'),
          TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD'), 'MM'),
          TO_CHAR(to_date('2012-07-31', 'YYYY-MM-DD'), 'Mon ')
      || TO_CHAR(to_date('2012-07-31', 'YYYY-MM-DD'), 'YYYY'), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD'), 'Mon ')
      || TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD'), 'YYYY')  || ' / '  || TO_CHAR(to_date('2012-07-31', 'YYYY-MM-DD'), 'Mon ')
      || TO_CHAR(to_date('2012-07-31', 'YYYY-MM-DD'), 'YYYY')),
      C.TRC,  TO_CHAR(C.EFFDT,'YYYY-MM-DD'),
      E.BUSINESS_UNIT, 
      E.PROJECT_ID
    FROM
         PS_TL_PAYABLE_TIME A, 
         PS_TL_TRC_TBL C,
         PS_PROJECT E, 
         PS_PERSONAL_DATA D,
           PS_PERALL_SEC_QRY D1, 
         PS_JOB F, 
         PS_EMPLMT_SRCH_QRY F1
    WHERE
         D.EMPLID = D1.EMPLID
    AND      D1.OPRID   = 'TMANI'
    AND      F.EMPLID   = F1.EMPLID
    AND      F.EMPL_RCD = F1.EMPL_RCD
    AND      F1.OPRID   = 'TMANI'
    AND      A.DUR BETWEEN TO_DATE('2012-07-01','YYYY-MM-DD') AND TO_DATE('2012-07-31','YYYY-MM-DD')
    AND      C.TRC   = A.TRC
    AND      C.EFFDT =  (SELECT
                   MAX(C_ED.EFFDT) 
                  FROM
                   PS_TL_TRC_TBL C_ED
                     WHERE
                   C.TRC = C_ED.TRC 
                  AND C_ED.EFFDT <= SYSDATE 
    AND      E.BUSINESS_UNIT = A.BUSINESS_UNIT_PC
    AND      E.PROJECT_ID    = A.PROJECT_ID
    AND      A.EMPLID        = D.EMPLID
    AND      A.EMPLID        = F.EMPLID
    AND      A.EMPL_RCD      = F.EMPL_RCD
    AND      F.EFFDT         =  (SELECT
                        MAX(F_ED.EFFDT) 
                      FROM
                        PS_JOB F_ED
                        WHERE
                        F.EMPLID = F_ED.EMPLID 
                      AND      F.EMPL_RCD = F_ED.EMPL_RCD
                        AND      F_ED.EFFDT <= SYSDATE 
    AND      F.EFFSEQ =  (SELECT
                   MAX(F_ES.EFFSEQ) 
                   FROM
                   PS_JOB F_ES
                     WHERE
                   F.EMPLID = F_ES.EMPLID 
                   AND F.EMPL_RCD = F_ES.EMPL_RCD
                     AND F.EFFDT  = F_ES.EFFDT 
    AND      F.GP_PAYGROUP  = DECODE(' ', ' ', F.GP_PAYGROUP, ' ')
    AND      A.CURRENCY_CD  = DECODE(' ', ' ', A.CURRENCY_CD, ' ')
    AND      DECODE(SUBSTR( F.GP_PAYGROUP, 1, 2), 'NG', 'L', DECODE( F.PER_ORG, 'CWR', 'L', 'E')) = DECODE(' ', ' ', DECODE(SUBSTR( F.GP_PAYGROUP, 1, 2), 'NG', 'L', DECODE( F.PER_ORG, 'CWR', 'L', 'E')), 'L', 'L', 'E', 'E', 'A', DECODE(SUBSTR( F.GP_PAYGROUP, 1, 2), 'NG', 'L', DECODE( F.PER_ORG, 'CWR', 'L', 'E')))
    AND ( A.EMPLID, A.EMPL_RCD) IN  (SELECT
                             B.EMPLID,
                             B.EMPL_RCD 
                        FROM
                             PS_TL_GROUP_DTL B
                                    WHERE
                             B.TL_GROUP_ID = DECODE('ER012', ' ', B.TL_GROUP_ID, 'ER012') 
    AND      E.PROJECT_USER1   = DECODE(' ', ' ', E.PROJECT_USER1, ' ')
    AND      A.PROJECT_ID      = DECODE(' ', ' ', A.PROJECT_ID, ' ')
    AND      A.PAYABLE_STATUS <>
      CASE
        WHEN to_number(TO_CHAR(sysdate, 'DD')) < 15
        THEN
          CASE
            WHEN A.DUR > last_day(add_months(sysdate, -2))
            THEN ' '
            ELSE 'NA'
          END
        ELSE
          CASE
            WHEN A.DUR > last_day(add_months(sysdate, -1))
            THEN ' '
            ELSE 'NA'
          END
      END
    AND      A.EMPLID = DECODE(' ', ' ', A.EMPLID, ' ')
    GROUP BY A.BUSINESS_UNIT_PC,
           A.PROJECT_ID,
           E.DESCR,
         A.EMPLID,
           D.NAME,
           C.DESCR,
           A.TRC,
           '2012-07-01',
           '2012-07-31',
           DECODE( A.CURRENCY_CD, 'USD', '$', 'GBP', '£', 'EUR', '€', 'AED', 'D', 'NGN', 'N', ' '),
           DECODE(SUBSTR( F.GP_PAYGROUP, 1, 2), 'NG', 'NG', F.PER_ORG),
           DECODE(TO_CHAR(to_date('2012-07-31', 'YYYY-MM-DD'), 'MM'), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD'), 'MM'), TO_CHAR(to_date('2012-07-31',      'YYYY-MM-DD'), 'Mon ')
           || TO_CHAR(to_date('2012-07-31', 'YYYY-MM-DD'), 'YYYY'), TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD'), 'Mon ')
           || TO_CHAR(to_date('2012-07-01', 'YYYY-MM-DD'), 'YYYY')  || ' / '
           || TO_CHAR(to_date('2012-07-31', 'YYYY-MM-DD'), 'Mon ')  || TO_CHAR(to_date('2012-07-31', 'YYYY-MM-DD'), 'YYYY')),
           C.TRC,  TO_CHAR(C.EFFDT,'YYYY-MM-DD'),
           E.BUSINESS_UNIT,  E.PROJECT_ID
    HAVING SUM( A.EST_GROSS) <> 0
    ORDER BY 1,
            2,
             5,
             6 ;Here is the screenshot for IO wait
    [https://lh4.googleusercontent.com/-6PFW2FSK3yE/UCrwUbZ0pvI/AAAAAAAAAPA/eHM48AOC0Uo]
    Edited by: Oceaner on Aug 14, 2012 5:38 PM

    Here is the execution plan with all the statistics present
    PLAN_TABLE_OUTPUT
    Plan hash value: 1575300420
    | Id  | Operation                                   | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                            |                    |     1 |   237 |  2703   (1)| 00:00:33 |
    |*  1 |  FILTER                                     |                    |       |       |            |          |
    |   2 |   SORT GROUP BY                             |                    |     1 |   237 |            |          |
    |   3 |    CONCATENATION                            |                    |       |       |            |          |
    |*  4 |     FILTER                                  |                    |       |       |            |          |
    |*  5 |      FILTER                                 |                    |       |       |            |          |
    |*  6 |       HASH JOIN                             |                    |     1 |   237 |  1695   (1)| 00:00:21 |
    |*  7 |        HASH JOIN                            |                    |     1 |   204 |  1689   (1)| 00:00:21 |
    |*  8 |         HASH JOIN SEMI                      |                    |     1 |   193 |  1352   (1)| 00:00:17 |
    |   9 |          NESTED LOOPS                       |                    |       |       |            |          |
    |  10 |           NESTED LOOPS                      |                    |     1 |   175 |  1305   (1)| 00:00:16 |
    |* 11 |            HASH JOIN                        |                    |     1 |   148 |  1304   (1)| 00:00:16 |
    |  12 |             JOIN FILTER CREATE              | :BF0000            |       |       |            |          |
    |  13 |              NESTED LOOPS                   |                    |       |       |            |          |
    |  14 |               NESTED LOOPS                  |                    |     1 |   134 |   967   (1)| 00:00:12 |
    |  15 |                NESTED LOOPS                 |                    |     1 |   103 |   964   (1)| 00:00:12 |
    |* 16 |                 TABLE ACCESS FULL           | PS_PROJECT         |   197 |  9062 |   278   (1)| 00:00:04 |
    |* 17 |                 TABLE ACCESS BY INDEX ROWID | PS_TL_PAYABLE_TIME |     1 |    57 |     7   (0)| 00:00:01 |
    |* 18 |                  INDEX RANGE SCAN           | IDX$$_C44D0007     |    16 |       |     3   (0)| 00:00:01 |
    |* 19 |                INDEX RANGE SCAN             | IDX$$_3F450003     |     1 |       |     2   (0)| 00:00:01 |
    |* 20 |               TABLE ACCESS BY INDEX ROWID   | PS_JOB             |     1 |    31 |     3   (0)| 00:00:01 |
    |  21 |             VIEW                            | PS_EMPLMT_SRCH_QRY |  5428 | 75992 |   336   (2)| 00:00:05 |
    PLAN_TABLE_OUTPUT
    |  22 |              SORT UNIQUE                    |                    |  5428 |   275K|   336   (2)| 00:00:05 |
    |* 23 |               FILTER                        |                    |       |       |            |          |
    |  24 |                JOIN FILTER USE              | :BF0000            | 55671 |  2827K|   335   (1)| 00:00:05 |
    |  25 |                 NESTED LOOPS                |                    | 55671 |  2827K|   335   (1)| 00:00:05 |
    |  26 |                  TABLE ACCESS BY INDEX ROWID| PSOPRDEFN          |     1 |    20 |     2   (0)| 00:00:01 |
    |* 27 |                   INDEX UNIQUE SCAN         | PS_PSOPRDEFN       |     1 |       |     1   (0)| 00:00:01 |
    |* 28 |                  TABLE ACCESS FULL          | PS_SJT_PERSON      | 55671 |  1739K|   333   (1)| 00:00:04 |
    |  29 |                CONCATENATION                |                    |       |       |            |          |
    |  30 |                 NESTED LOOPS                |                    |     1 |    63 |     2   (0)| 00:00:01 |
    |* 31 |                  INDEX FAST FULL SCAN       | PSASJT_OPR_CLS     |     1 |    24 |     2   (0)| 00:00:01 |
    |* 32 |                  INDEX UNIQUE SCAN          | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    |  33 |                 NESTED LOOPS                |                    |     1 |    63 |     1   (0)| 00:00:01 |
    |* 34 |                  INDEX UNIQUE SCAN          | PSASJT_OPR_CLS     |     1 |    24 |     1   (0)| 00:00:01 |
    |* 35 |                  INDEX UNIQUE SCAN          | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    |  36 |                NESTED LOOPS                 |                    |     1 |    63 |     1   (0)| 00:00:01 |
    |* 37 |                 INDEX UNIQUE SCAN           | PSASJT_OPR_CLS     |     1 |    24 |     1   (0)| 00:00:01 |
    |* 38 |                 INDEX UNIQUE SCAN           | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    |* 39 |            INDEX UNIQUE SCAN                | PS_PERSONAL_DATA   |     1 |       |     0   (0)| 00:00:01 |
    |  40 |           TABLE ACCESS BY INDEX ROWID       | PS_PERSONAL_DATA   |     1 |    27 |     1   (0)| 00:00:01 |
    |* 41 |          INDEX FAST FULL SCAN               | PS_TL_GROUP_DTL    |   323 |  5814 |    47   (3)| 00:00:01 |
    |  42 |         VIEW                                | PS_PERALL_SEC_QRY  |  7940 | 87340 |   336   (2)| 00:00:05 |
    |  43 |          SORT UNIQUE                        |                    |  7940 |   379K|   336   (2)| 00:00:05 |
    |* 44 |           FILTER                            |                    |       |       |            |          |
    |* 45 |            FILTER                           |                    |       |       |            |          |
    |  46 |             NESTED LOOPS                    |                    | 55671 |  2663K|   335   (1)| 00:00:05 |
    |  47 |              TABLE ACCESS BY INDEX ROWID    | PSOPRDEFN          |     1 |    20 |     2   (0)| 00:00:01 |
    |* 48 |               INDEX UNIQUE SCAN             | PS_PSOPRDEFN       |     1 |       |     1   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |* 49 |              TABLE ACCESS FULL              | PS_SJT_PERSON      | 55671 |  1576K|   333   (1)| 00:00:04 |
    |  50 |            CONCATENATION                    |                    |       |       |            |          |
    |  51 |             NESTED LOOPS                    |                    |     1 |    63 |     2   (0)| 00:00:01 |
    |* 52 |              INDEX FAST FULL SCAN           | PSASJT_OPR_CLS     |     1 |    24 |     2   (0)| 00:00:01 |
    |* 53 |              INDEX UNIQUE SCAN              | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    |  54 |             NESTED LOOPS                    |                    |     1 |    63 |     1   (0)| 00:00:01 |
    |* 55 |              INDEX UNIQUE SCAN              | PSASJT_OPR_CLS     |     1 |    24 |     1   (0)| 00:00:01 |
    |* 56 |              INDEX UNIQUE SCAN              | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    |  57 |            CONCATENATION                    |                    |       |       |            |          |
    |  58 |             NESTED LOOPS                    |                    |     1 |    63 |     1   (0)| 00:00:01 |
    |* 59 |              INDEX UNIQUE SCAN              | PSASJT_OPR_CLS     |     1 |    24 |     1   (0)| 00:00:01 |
    |* 60 |              INDEX UNIQUE SCAN              | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    |  61 |             NESTED LOOPS                    |                    |     1 |    63 |     1   (0)| 00:00:01 |
    |* 62 |              INDEX UNIQUE SCAN              | PSASJT_OPR_CLS     |     1 |    24 |     1   (0)| 00:00:01 |
    |* 63 |              INDEX UNIQUE SCAN              | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    |  64 |            NESTED LOOPS                     |                    |     1 |    63 |     3   (0)| 00:00:01 |
    |  65 |             INLIST ITERATOR                 |                    |       |       |            |          |
    |* 66 |              INDEX RANGE SCAN               | PSASJT_CLASS_ALL   |     1 |    39 |     2   (0)| 00:00:01 |
    |* 67 |             INDEX RANGE SCAN                | PSASJT_OPR_CLS     |     1 |    24 |     1   (0)| 00:00:01 |
    |  68 |        TABLE ACCESS FULL                    | PS_TL_TRC_TBL      |   922 | 30426 |     6   (0)| 00:00:01 |
    |  69 |      SORT AGGREGATE                         |                    |     1 |    20 |            |          |
    |* 70 |       INDEX RANGE SCAN                      | PSAJOB             |     1 |    20 |     3   (0)| 00:00:01 |
    |  71 |      SORT AGGREGATE                         |                    |     1 |    14 |            |          |
    |* 72 |       INDEX RANGE SCAN                      | PS_TL_TRC_TBL      |     2 |    28 |     2   (0)| 00:00:01 |
    |  73 |      SORT AGGREGATE                         |                    |     1 |    23 |            |          |
    |* 74 |       INDEX RANGE SCAN                      | PSAJOB             |     1 |    23 |     3   (0)| 00:00:01 |
    |* 75 |     FILTER                                  |                    |       |       |            |          |
    PLAN_TABLE_OUTPUT
    |* 76 |      FILTER                                 |                    |       |       |            |          |
    |* 77 |       HASH JOIN                             |                    |     1 |   237 |   974   (2)| 00:00:12 |
    |* 78 |        HASH JOIN                            |                    |     1 |   226 |   637   (1)| 00:00:08 |
    |* 79 |         HASH JOIN                           |                    |     1 |   193 |   631   (1)| 00:00:08 |
    |  80 |          NESTED LOOPS                       |                    |       |       |            |          |
    |  81 |           NESTED LOOPS                      |                    |     1 |   179 |   294   (1)| 00:00:04 |
    |  82 |            NESTED LOOPS                     |                    |     1 |   152 |   293   (1)| 00:00:04 |
    |  83 |             NESTED LOOPS                    |                    |     1 |   121 |   290   (1)| 00:00:04 |
    |* 84 |              HASH JOIN SEMI                 |                    |     1 |    75 |   289   (1)| 00:00:04 |
    |* 85 |               TABLE ACCESS BY INDEX ROWID   | PS_TL_PAYABLE_TIME |     1 |    57 |   242   (0)| 00:00:03 |
    |* 86 |                INDEX SKIP SCAN              | IDX$$_C44D0007     |   587 |       |   110   (0)| 00:00:02 |
    |* 87 |               INDEX FAST FULL SCAN          | PS_TL_GROUP_DTL    |   323 |  5814 |    47   (3)| 00:00:01 |
    |* 88 |              TABLE ACCESS BY INDEX ROWID    | PS_PROJECT         |     1 |    46 |     1   (0)| 00:00:01 |
    |* 89 |               INDEX UNIQUE SCAN             | PS_PROJECT         |     1 |       |     0   (0)| 00:00:01 |
    |* 90 |             TABLE ACCESS BY INDEX ROWID     | PS_JOB             |     1 |    31 |     3   (0)| 00:00:01 |
    |* 91 |              INDEX RANGE SCAN               | IDX$$_3F450003     |     1 |       |     2   (0)| 00:00:01 |
    |* 92 |            INDEX UNIQUE SCAN                | PS_PERSONAL_DATA   |     1 |       |     0   (0)| 00:00:01 |
    |  93 |           TABLE ACCESS BY INDEX ROWID       | PS_PERSONAL_DATA   |     1 |    27 |     1   (0)| 00:00:01 |
    |  94 |          VIEW                               | PS_EMPLMT_SRCH_QRY |  5428 | 75992 |   336   (2)| 00:00:05 |
    |  95 |           SORT UNIQUE                       |                    |  5428 |   275K|   336   (2)| 00:00:05 |
    |* 96 |            FILTER                           |                    |       |       |            |          |
    |  97 |             NESTED LOOPS                    |                    | 55671 |  2827K|   335   (1)| 00:00:05 |
    |  98 |              TABLE ACCESS BY INDEX ROWID    | PSOPRDEFN          |     1 |    20 |     2   (0)| 00:00:01 |
    |* 99 |               INDEX UNIQUE SCAN             | PS_PSOPRDEFN       |     1 |       |     1   (0)| 00:00:01 |
    |*100 |              TABLE ACCESS FULL              | PS_SJT_PERSON      | 55671 |  1739K|   333   (1)| 00:00:04 |
    | 101 |             CONCATENATION                   |                    |       |       |            |          |
    | 102 |              NESTED LOOPS                   |                    |     1 |    63 |     2   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |*103 |               INDEX FAST FULL SCAN          | PSASJT_OPR_CLS     |     1 |    24 |     2   (0)| 00:00:01 |
    |*104 |               INDEX UNIQUE SCAN             | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    | 105 |              NESTED LOOPS                   |                    |     1 |    63 |     1   (0)| 00:00:01 |
    |*106 |               INDEX UNIQUE SCAN             | PSASJT_OPR_CLS     |     1 |    24 |     1   (0)| 00:00:01 |
    |*107 |               INDEX UNIQUE SCAN             | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    | 108 |             NESTED LOOPS                    |                    |     1 |    63 |     1   (0)| 00:00:01 |
    |*109 |              INDEX UNIQUE SCAN              | PSASJT_OPR_CLS     |     1 |    24 |     1   (0)| 00:00:01 |
    |*110 |              INDEX UNIQUE SCAN              | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    | 111 |         TABLE ACCESS FULL                   | PS_TL_TRC_TBL      |   922 | 30426 |     6   (0)| 00:00:01 |
    | 112 |        VIEW                                 | PS_PERALL_SEC_QRY  |  7940 | 87340 |   336   (2)| 00:00:05 |
    | 113 |         SORT UNIQUE                         |                    |  7940 |   379K|   336   (2)| 00:00:05 |
    |*114 |          FILTER                             |                    |       |       |            |          |
    |*115 |           FILTER                            |                    |       |       |            |          |
    | 116 |            NESTED LOOPS                     |                    | 55671 |  2663K|   335   (1)| 00:00:05 |
    | 117 |             TABLE ACCESS BY INDEX ROWID     | PSOPRDEFN          |     1 |    20 |     2   (0)| 00:00:01 |
    |*118 |              INDEX UNIQUE SCAN              | PS_PSOPRDEFN       |     1 |       |     1   (0)| 00:00:01 |
    |*119 |             TABLE ACCESS FULL               | PS_SJT_PERSON      | 55671 |  1576K|   333   (1)| 00:00:04 |
    | 120 |           CONCATENATION                     |                    |       |       |            |          |
    | 121 |            NESTED LOOPS                     |                    |     1 |    63 |     2   (0)| 00:00:01 |
    |*122 |             INDEX FAST FULL SCAN            | PSASJT_OPR_CLS     |     1 |    24 |     2   (0)| 00:00:01 |
    |*123 |             INDEX UNIQUE SCAN               | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    | 124 |            NESTED LOOPS                     |                    |     1 |    63 |     1   (0)| 00:00:01 |
    |*125 |             INDEX UNIQUE SCAN               | PSASJT_OPR_CLS     |     1 |    24 |     1   (0)| 00:00:01 |
    |*126 |             INDEX UNIQUE SCAN               | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    | 127 |           CONCATENATION                     |                    |       |       |            |          |
    | 128 |            NESTED LOOPS                     |                    |     1 |    63 |     1   (0)| 00:00:01 |
    |*129 |             INDEX UNIQUE SCAN               | PSASJT_OPR_CLS     |     1 |    24 |     1   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    |*130 |             INDEX UNIQUE SCAN               | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    | 131 |            NESTED LOOPS                     |                    |     1 |    63 |     1   (0)| 00:00:01 |
    |*132 |             INDEX UNIQUE SCAN               | PSASJT_OPR_CLS     |     1 |    24 |     1   (0)| 00:00:01 |
    |*133 |             INDEX UNIQUE SCAN               | PSASJT_CLASS_ALL   |     1 |    39 |     0   (0)| 00:00:01 |
    | 134 |           NESTED LOOPS                      |                    |     1 |    63 |     3   (0)| 00:00:01 |
    | 135 |            INLIST ITERATOR                  |                    |       |       |            |          |
    |*136 |             INDEX RANGE SCAN                | PSASJT_CLASS_ALL   |     1 |    39 |     2   (0)| 00:00:01 |
    |*137 |            INDEX RANGE SCAN                 | PSASJT_OPR_CLS     |     1 |    24 |     1   (0)| 00:00:01 |
    | 138 |      SORT AGGREGATE                         |                    |     1 |    20 |            |          |
    |*139 |       INDEX RANGE SCAN                      | PSAJOB             |     1 |    20 |     3   (0)| 00:00:01 |
    | 140 |      SORT AGGREGATE                         |                    |     1 |    14 |            |          |
    |*141 |       INDEX RANGE SCAN                      | PS_TL_TRC_TBL      |     2 |    28 |     2   (0)| 00:00:01 |
    | 142 |      SORT AGGREGATE                         |                    |     1 |    23 |            |          |
    |*143 |       INDEX RANGE SCAN                      | PSAJOB             |     1 |    23 |     3   (0)| 00:00:01 |
    | 144 |      SORT AGGREGATE                         |                    |     1 |    14 |            |          |
    |*145 |       INDEX RANGE SCAN                      | PS_TL_TRC_TBL      |     2 |    28 |     2   (0)| 00:00:01 |
    | 146 |      SORT AGGREGATE                         |                    |     1 |    20 |            |          |
    |*147 |       INDEX RANGE SCAN                      | PSAJOB             |     1 |    20 |     3   (0)| 00:00:01 |
    | 148 |      SORT AGGREGATE                         |                    |     1 |    23 |            |          |
    |*149 |       INDEX RANGE SCAN                      | PSAJOB             |     1 |    23 |     3   (0)| 00:00:01 |
    ------------------------------------------------------------------------------------------------------------------Most of the IO wait occur at step 17. Though exlain plan simply doesnot show this thing..But when we run this query from Peoplesoft application (online page), this is visible through Grid control SQL Monitoring
    Second part of the Question continues....

  • Performance issue with this complex query

    Please ignore this thread(post)
    This query fetches a lot of data and takes more than 4 t0 5 hrs to retrieve them.
    I have tried to get the explain plan the display cursor and the TKPROF for the same but then the query utilizes more than 100GB temp space and it fails to generate any.
    What I have is the spool file which is pasted below along with the query.
    Database version: 11g
    I'm looking forward for suggestions how to improve the performance of this statement
    Please ignore this thread(post)
    Edited by: user13319084 on May 30, 2011 12:34 AM

    You provide no information that can be used in answering your question on how to improve the query.
    In absence of technical information, all that we can discuss is conceptual issues. Like why is the query that complex? A common answer is that the underlying data model lacks the intelligence and this now requires the intelligence to be build into the query.
    You need to look at the data model and the query in order to address this performance problem - and make sure that the actual business requirements is clearly identified and understood.

  • Performance issue with the table use vrkpa

    Hi.
    here is the selection criteria that i am using and the table use vrkpa i only used to map the table kna1 and vbrk.vbrk and kna1 doesnot have the direct primary key relationship.
    please check and let me know wht this vrkpa is taking time and how can i improve the performance as from kna1,i am fetching data very easily while fetching nothing from vrkpa and fetching fkdat from vbrk.
    the idea behind using these tables is just for one kunnr (from kna1)getting the relevant entries based on the fkdat(selection screen input field),please suggest.
        SELECT kunnr
               name1
               land1
               regio
               ktokd
               FROM kna1
               INTO TABLE it_kna1
               FOR ALL ENTRIES IN it_knb1
               WHERE kunnr = it_knb1-kunnr
               AND ktokd = '0003'.
        IF sy-subrc = 0.
          SORT it_kna1 BY kunnr.
          DELETE ADJACENT DUPLICATES FROM it_kna1 COMPARING kunnr.
        ENDIF.
      ENDIF.
      IF NOT it_kna1[] IS INITIAL.
        SELECT kunnr
               vbeln
               FROM vrkpa
               INTO TABLE it_vrkpa
               FOR ALL ENTRIES IN it_kna1
               WHERE kunnr = it_kna1-kunnr.
        IF sy-subrc = 0.
          SORT it_vrkpa BY kunnr vbeln.
        ENDIF.
      ENDIF.
      IF NOT it_vrkpa[] IS INITIAL.
        SELECT vbeln
               kunrg
               fkdat
              kkber
               bukrs
               FROM vbrk
               INTO TABLE it_vbrk
               FOR ALL ENTRIES IN it_vrkpa
               WHERE vbeln = it_vrkpa-vbeln.
        IF sy-subrc = 0.
          DELETE it_vbrk WHERE fkdat NOT IN s_indate.
          DELETE it_vbrk WHERE fkdat NOT IN s_chdate.
          DELETE it_vbrk WHERE bukrs NOT IN s_ccode.
          SORT it_vbrk DESCENDING BY vbeln fkdat.
        ENDIF.
      ENDIF.

    Hi,
    Transaction SE11
    Table VRKPA => Display (not Change)
    Click on "Indexes"
    Click on "Create" (if your system is Basis 7.00, then click on the "Create" drop-down icon and choose "Create extension index")
    Choose a name (up to 3 characterss, start with Z)
    Enter a description for the index
    Enter the field names of the index
    Choose "Save" (prompts for transport request)
    Choose "Activate"
    If after "Activate' the status shows "Index exists in database system <...>", then you have nothing more to dotable is very large the activation will not create the index in the database and the status remains "Index does nor exist". In that case:
    - Transaction SE14
    - Table VRKPA -> Edit
    - Choose "Indexes" and select your new index
    - Choose "Create database index"; mark the option "Background"
    - Wait until the job is finished and check in SE11 that the index now exists in the DB
    You don't have to do anyhting to your program because Oracle should choose the new index automatically. Run a SQL Trace to make sure.
    Rgds,
    Mark

  • Animated GIF files, anyone had issues with the selected animation delay not saving as specified?

    I am working on PSE 9 for Mac and have created my psd file with the layers.
    Selected 'Save for Web' and chose GIF as the file format.
    Ticked 'Animation', then from the bottom right hand corner under 'Animation' I have ticked 'loop' and in the 'delay' drop down selected 2.0 (so 2 seconds).
    When I check the file in 'preview in' web it shows the file flashing faster than 2 seconds a frame. I also checked it by uploading it onto my website and it is flashing faster than 2 seconds.
    I have saved the file several times to check. It appears that even though you are given a choice that is automatically saves the delay at the auto-populated delay speed of 0.2 seconds.
    Thoughts anyone?

    As far as i know, the frame delay has been broken
    for several versions on the mac pse.
    Since version 4 maybe?
    You can comment on this post and hopefully adobe will fix it in pse 10.
    http://feedback.photoshop.com/photoshop_family/topics/photoshop_elements_9_mac_frame_delay _in_save_for_web
    MTSTUNER

  • Performance issue with a particular query

    Hi Experts,
    OS version : Sun solaris 5.10
    DB version : 10.1.0.4
    We have a report designed in SAP BO and for which we have below SQL query written
    SELECT
    SNOW_DIM.SERV_REP_INCIDENT.INCIDENT_NUMBER,
    ISAC_GL_APPL_HIERARCHY_SERVIMP.SOL_NAME
    ISAC_GL_APPL_HIERARCHY_SERVIMP.SOL_DOMAIN_NAME
    Count(DISTINCT SNOW_DIM.SERV_REP_INCIDENT.INCIDENT_NUMBER),
    Count(DISTINCT case when SNOW_DIM.SERV_REP_INCIDENT.STATE_ID=3 then SNOW_DIM.SERV_REP_INCIDENT.INCIDENT_NUMBER end),
    SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_GROUP,
    case when SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL=1 then 'Level 1' when SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL=2 then 'Level 2' when SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL=3 then 'Level 3' else to_char(SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL) end,
    SNOW_DIM.SERV_REP_INCIDENT.SHORT_DESCRIPTION,
    SNOW_DIM.SERV_REP_INCIDENT.PRIORITY,
    SNOW_DIM.SERV_REP_INCIDENT.STATE,
    SNOW_DIM.SERV_REP_INCIDENT.OPENED_AT,
    BU_EMPLOYEES_INC_AS.BUSINESS_NAME,
    TO_CHAR(SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT,'Month'),
    TO_CHAR(SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT,'MM'),
    TO_CHAR(SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT,'SYYYY'),
    SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT
    FROM
    SNOW_DIM.SERV_REP_INCIDENT,
    SNOW_DIM.ISAC_GL_APPL_HIERARCHY ISAC_GL_APPL_HIERARCHY_SERVIMP,
    SNOW_DIM.BU_EMPLOYEES BU_EMPLOYEES_INC_AS,
    SNOW_DIM.SERV_REP_CONTRACT_SLA,
    SNOW_DIM.SERV_REP_TASK_SLA
    WHERE
    ( SNOW_DIM.SERV_REP_INCIDENT.ASSIGNEE_GPN=BU_EMPLOYEES_INC_AS.GPN(+) )
    AND ( SNOW_DIM.SERV_REP_INCIDENT.INCIDENT_SYS_ID=SNOW_DIM.SERV_REP_TASK_SLA.TASK(+) )
    AND ( SNOW_DIM.SERV_REP_TASK_SLA.SLA=SNOW_DIM.SERV_REP_CONTRACT_SLA.SYS_ID(+) )
    AND ( ISAC_GL_APPL_HIERARCHY_SERVIMP.APPL_ID(+)=SNOW_DIM.SERV_REP_INCIDENT.SERVICE_ID )
    AND
    ISAC_GL_APPL_HIERARCHY_SERVIMP.APPL_ENVIRONMENT
    = 'PROD'
    AND
    SNOW_DIM.SERV_REP_INCIDENT.TYPE_X = 'Incident'
    AND
    case
    WHEN SNOW_DIM.SERV_REP_INCIDENT.DUPLICATE_INCIDENT = 1 then 'Yes'
    WHEN SNOW_DIM.SERV_REP_INCIDENT.DUPLICATE_INCIDENT = 0 then 'No'
    end = 'No'
    AND
    SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_GROUP IN ( 'WMSB_IT_CH_Business_Support_1_L2','WMSB_IT_CH_Business_Support_2_HW_L2','WMSB_IT_CH_Business_Support_2_L2','WMSB_IT_CH_Business_Support_3_L2','WMSB_IT_CH_Business_Support_4_CEFS_L2','WMSB_IT_CH_Business_Support_4_L2','WMSB_IT_CH_Business_Support_5_L2','WMSB_IT_APAC_Production_Support_L2','WMSB_IT_EMEA_ESS_CLAS_Team_L2','WMSB_IT_US_Production_Support_L2','WMSB_IT_CH_AoC_Decentral_L2','WMSB_IT_CH_AoC_Mainframe_L2','WMSB_IT_GLOB_AoC_Decentral_L2' )
    OR
    SNOW_DIM.SERV_REP_CONTRACT_SLA.TYPE_X = 'SLA'
    AND
    SNOW_DIM.SERV_REP_TASK_SLA.STAGE IN ( 'in_progress','achieved','breached','completed','paused' )
    OR
    SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_GROUP NOT IN ( 'WMSB_IT_CH_Business_Support_1_L2','WMSB_IT_CH_Business_Support_2_HW_L2','WMSB_IT_CH_Business_Support_2_L2','WMSB_IT_CH_Business_Support_3_L2','WMSB_IT_CH_Business_Support_4_CEFS_L2','WMSB_IT_CH_Business_Support_4_L2','WMSB_IT_CH_Business_Support_5_L2','WMSB_IT_APAC_Production_Support_L2','WMSB_IT_EMEA_ESS_CLAS_Team_L2','WMSB_IT_US_Production_Support_L2','WMSB_IT_CH_AoC_Decentral_L2','WMSB_IT_CH_AoC_Mainframe_L2','WMSB_IT_GLOB_AoC_Decentral_L2','WMSB_IT_GLOB_Service_Desk_L1','WMSB_IT_EMEA_ESS_CLAS_Team_L1' )
    AND
    SNOW_DIM.SERV_REP_TASK_SLA.ASSIGNMENT_GROUP_NAME IN ( 'WMSB_IT_CH_Business_Support_1_L2','WMSB_IT_CH_Business_Support_2_HW_L2','WMSB_IT_CH_Business_Support_2_L2','WMSB_IT_CH_Business_Support_3_L2','WMSB_IT_CH_Business_Support_4_CEFS_L2','WMSB_IT_CH_Business_Support_4_L2','WMSB_IT_CH_Business_Support_5_L2','WMSB_IT_APAC_Production_Support_L2','WMSB_IT_EMEA_ESS_CLAS_Team_L2','WMSB_IT_US_Production_Support_L2','WMSB_IT_CH_AoC_Decentral_L2','WMSB_IT_CH_AoC_Mainframe_L2','WMSB_IT_GLOB_AoC_Decentral_L2' )
    AND
    SNOW_DIM.SERV_REP_TASK_SLA.STAGE IN ( 'in_progress','achieved','breached','completed','paused' )
    AND
    ISAC_GL_APPL_HIERARCHY_SERVIMP.SOL_DOMAIN_NAME
    IN ('Partner, Product & Contract Management')
    AND
    SNOW_DIM.SERV_REP_INCIDENT.STATE IN ( 'Assigned','Closed','In Progress','New','On Hold','Resolved' )
    AND
    ( ( SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT ) between (ADD_MONTHS(trunc(sysdate,'MM'),-6)) AND (trunc(sysdate,'MM')-0.0002/24)
    GROUP BY
    SNOW_DIM.SERV_REP_INCIDENT.INCIDENT_NUMBER,
    ISAC_GL_APPL_HIERARCHY_SERVIMP.SOL_NAME
    ISAC_GL_APPL_HIERARCHY_SERVIMP.SOL_DOMAIN_NAME
    SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_GROUP,
    case when SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL=1 then 'Level 1' when SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL=2 then 'Level 2' when SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL=3 then 'Level 3' else to_char(SNOW_DIM.SERV_REP_INCIDENT.ASSIGNED_SUPPORT_GROUP_LEVEL) end,
    SNOW_DIM.SERV_REP_INCIDENT.SHORT_DESCRIPTION,
    SNOW_DIM.SERV_REP_INCIDENT.PRIORITY,
    SNOW_DIM.SERV_REP_INCIDENT.STATE,
    SNOW_DIM.SERV_REP_INCIDENT.OPENED_AT,
    BU_EMPLOYEES_INC_AS.BUSINESS_NAME,
    TO_CHAR(SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT,'Month'),
    TO_CHAR(SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT,'MM'),
    TO_CHAR(SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT,'SYYYY'),
    SNOW_DIM.SERV_REP_INCIDENT.CLOSED_AT;
    Users reporting that the report is running slow and I have generated explain plan for the same and it is as below
    PLAN_TABLE_OUTPUT
    Plan hash value: 2068297582
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 13216 | 38M| | 245K (1)| 00:13:02 |
    | 1 | SORT GROUP BY | | 13216 | 38M| 103M| 245K (1)| 00:13:02 |
    |* 2 | FILTER | | | | | | |
    | 3 | NESTED LOOPS OUTER | | 13216 | 38M| | 232K (1)| 00:12:21 |
    |* 4 | FILTER | | | | | | |
    | 5 | NESTED LOOPS OUTER | | 508 | 1495K| | 232K (1)| 00:12:21 |
    |* 6 | FILTER | | | | | | |
    | 7 | NESTED LOOPS OUTER | | 508 | 1477K| | 232K (1)| 00:12:21 |
    |* 8 | HASH JOIN | | 96 | 270K| | 232K (1)| 00:12:21 |
    |* 9 | MAT_VIEW ACCESS FULL | ISAC_GL_APPL_HIERARCHY | 6 | 4230 | | 3884 (1)| 00:00:13 |
    |* 10 | TABLE ACCESS BY INDEX ROWID| SERV_REP_INCIDENT | 802K| 1669M| | 228K (1)| 00:12:08 |
    |* 11 | INDEX RANGE SCAN | I7_SERV_REP_INCIDENT_N | 1368K| | | 3437 (3)| 00:00:11 |
    | 12 | TABLE ACCESS BY INDEX ROWID | SERV_REP_TASK_SLA | 5 | 455 | | 1 (0)| 00:00:01 |
    |* 13 | INDEX RANGE SCAN | I6_SERV_REP_TASK_SLA | 5 | | | 0 (0)| 00:00:01 |
    | 14 | TABLE ACCESS BY INDEX ROWID | SERV_REP_CONTRACT_SLA | 1 | 37 | | 1 (0)| 00:00:01 |
    |* 15 | INDEX RANGE SCAN | I1_SERV_REP_CONTRACT_SLA | 1 | | | 0 (0)| 00:00:01 |
    | 16 | TABLE ACCESS BY INDEX ROWID | BU_EMPLOYEES | 26 | 858 | | 1 (0)| 00:00:01 |
    |* 17 | INDEX RANGE SCAN | I01_BU_EMPLOYEES | 26 | | | 0 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - filter(ADD_MONTHS(TRUNC(SYSDATE@!,'fmmm'),-6)<=TRUNC(SYSDATE@!,'fmmm')-.000011574074074074074074074074074
    07407407407)
    4 - filter("SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_APAC_Production_Support_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_AoC_Decentral_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_AoC_Mainframe_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_1_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_2_HW_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_2_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_3_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_4_CEFS_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_4_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_CH_Business_Support_5_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_EMEA_ESS_CLAS_Team_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_GLOB_AoC_Decentral_L2' OR
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"='WMSB_IT_US_Production_Support_L2' OR "T"."TYPE_X"='SLA' AND
    ("SERV_REP_TASK_SLA"."STAGE"='achieved' OR "SERV_REP_TASK_SLA"."STAGE"='breached' OR
    "SERV_REP_TASK_SLA"."STAGE"='completed' OR "SERV_REP_TASK_SLA"."STAGE"='in_progress' OR
    "SERV_REP_TASK_SLA"."STAGE"='paused') OR ("SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_APAC_Production_S
    upport_L2' OR "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_AoC_Decentral_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_AoC_Mainframe_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_1_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_2_HW_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_2_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_3_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_4_CEFS_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_4_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_CH_Business_Support_5_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_EMEA_ESS_CLAS_Team_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_GLOB_AoC_Decentral_L2' OR
    "SERV_REP_TASK_SLA"."ASSIGNMENT_GROUP_NAME"='WMSB_IT_US_Production_Support_L2') AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_1_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_2_HW_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_2_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_3_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_4_CEFS_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_4_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_Business_Support_5_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_APAC_Production_Support_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_EMEA_ESS_CLAS_Team_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_US_Production_Support_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_AoC_Decentral_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_CH_AoC_Mainframe_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_GLOB_AoC_Decentral_L2' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_GLOB_Service_Desk_L1' AND
    "SERV_REP_INCIDENT"."ASSIGNED_GROUP"<>'WMSB_IT_EMEA_ESS_CLAS_Team_L1')
    6 - filter("SERV_REP_TASK_SLA"."STAGE"='achieved' OR "SERV_REP_TASK_SLA"."STAGE"='breached' OR
    "SERV_REP_TASK_SLA"."STAGE"='completed' OR "SERV_REP_TASK_SLA"."STAGE"='in_progress' OR
    "SERV_REP_TASK_SLA"."STAGE"='paused')
    8 - access("ISAC_GL_APPL_HIERARCHY_SERVIMP"."APPL_ID"="SERV_REP_INCIDENT"."SERVICE_ID")
    9 - filter("ISAC_GL_APPL_HIERARCHY_SERVIMP"."APPL_ENVIRONMENT"='PROD' AND
    "ISAC_GL_APPL_HIERARCHY_SERVIMP"."SOL_DOMAIN_NAME"='Partner, Product & Contract Management')
    10 - filter("SERV_REP_INCIDENT"."TYPE_X"='Incident' AND ("SERV_REP_INCIDENT"."STATE"='Assigned' OR
    "SERV_REP_INCIDENT"."STATE"='Closed' OR "SERV_REP_INCIDENT"."STATE"='In Progress' OR
    "SERV_REP_INCIDENT"."STATE"='New' OR "SERV_REP_INCIDENT"."STATE"='On Hold' OR
    "SERV_REP_INCIDENT"."STATE"='Resolved') AND CASE "SERV_REP_INCIDENT"."DUPLICATE_INCIDENT" WHEN 1 THEN 'Yes'
    WHEN 0 THEN 'No' END ='No')
    11 - access("SERV_REP_INCIDENT"."CLOSED_AT">=ADD_MONTHS(TRUNC(SYSDATE@!,'fmmm'),-6) AND
    "SERV_REP_INCIDENT"."CLOSED_AT"<=TRUNC(SYSDATE@!,'fmmm')-.00001157407407407407407407407407407407407407)
    13 - access("SERV_REP_INCIDENT"."INCIDENT_SYS_ID"="SERV_REP_TASK_SLA"."TASK"(+))
    15 - access("SERV_REP_TASK_SLA"."SLA"="T"."SYS_ID"(+))
    17 - access("SERV_REP_INCIDENT"."ASSIGNEE_GPN"="T"."GPN"(+))
    From above plan I could analyze that indexes on table SERV_REP_INCIDENT are not being used on columns ASSIGNED_GROUP, STATE, STAGE etc as they are using IN and NOT IN clauses in where condition and because of this reason cost at id 10 increased to 228k.
    now, i would like to know the advise from you people what can be done to make it better. also I read that IN clause can use indexes if data is more. In my case is there any way that I can force those IN and NOT IN clauses to use index? (we have indexes created on all those columns used by SERV_REP_INCIDENT table)
    Thanks in advance.

    From above plan I could analyze that indexes on table SERV_REP_INCIDENT are not being used on columns ASSIGNED_GROUP, STATE, STAGE etc as they are using IN and NOT IN clauses in where condition and >because of this reason cost at id 10 increased to 228k.Good job isolating the (estimated) spike in resources by high estimates! You can try to minimize the work for this step in several ways, some simple and some extreme:
    Try a composite function-based index on SERV_REP_INCIDENT for the IN clauses.
    Another long-term possiblity is to partition the SERV_REP_INCIDENT table by the IN values if you have the license. This may not be the best partionining option; partitioning needs to be conisdered carefully before implementation.
    How long does the query take to execute? Another possiblity is to to create a materialized view on the query you posted, using the automated query rewrite to automatically use it (possibly indexed).

Maybe you are looking for

  • How can i erase an iTunes Account ?

    Hi, my man have logged in with with his username of  the iTunes store so I switched to mine as I wanted to download some apps and it wasn't a problem  but when I click on the iTunes store icon to either update or download apps I get a window with my

  • Cannot Login... Help !

    Hi, I am an experimented Mac user, but quite new with Snow Leopard Server. I've just purchased the brand new MacMini Server. I have configured my server with the name server.local and installed OpenDirectory as Master. I wanted to try the network log

  • Ichat on mac

    whenever i close my top to my macbook i get signed off ichat even when my away message is on. how do i make it so i dont get signed off? thanks so much in advance.

  • How to define SQL that contains "in" where clause in VO?

    I don't want to define "in" caluse in a programatical way in VO like below. I want to use a declariable way to define in clause using varaible bindings. Can it be implemented?     private String getInClauseWithParamNames(List termCodes) {           

  • Right click not working in sap gui for html in transactions

    Dear experts, i m using sap gui for html in transations iview but when i go to trasaction and click on some field automatically blank window comes(no any trasaction or no any field view) it not happen on all the field but on some field for eg;- when