ODS activation due to new field taking long time

Hi,
I have created transport request to transport
DATA MART
ODS (Because i have added two new fields to this ODS which i have to populate by data mart)
Update rule for Data Mart and ODS
Activate dependent object for this ODS
From my Testing server to Production Server
Now after transporting it to my Production server  it has some 8 million records on Production server and request is still activating ODS DATA (Readjusting table structure for this new fields and data records).I have down time scheduled in couple of hours
Now my question is
What happens if request is not activated in Production server before down time?
Will i loose entire data on production server?
if yes What can i do to prevent this?
Please inform as it is urgent.
Regards,
Rahul.

hi pabloj,
Can you please inform me what can be solution in case it happens?
Can reinit in that case solve the problem or do you have some other idea?
Please inform
Regards,
Rahul.

Similar Messages

  • The ODS activation is taking long time

    Hi,
    We are on SAP NetWeaver BI 701 (Support Package 5).
    We create a Z ODS, it will contain a lot of data (180.000.000 month-end) and we want to generate specific reports about it.
    The activation is taking long time, I assume is because we checked the flag "SIDs Generation upon Activation". I am confused about this check. I really need it? is this check the only problem.
    Thanks for you help.
    Victoria

    Hi Victoria:
       If your Z DSO is used only for staging purposes (you don't have queries based on this DSO and you send the data to another DSO or to an InfoCube) then you don't need to check the "SIDs Generation Upon Activation" box.
    Even more, to achieve better performance during data loads in this scenario, you might consider using a Write Optimized DSO instead of a Standard DSO, but if you decide to take this alternative don't forget to select the "Do Not check Uniqueness of Data" box if you need to write several records with the same Semantic Key.
    Regards,
    Francisco Milán.

  • Report Taking long time in QA system

    Gurus,
    I have developed a report which works fine in dev.Though in QA system its performance is not okay.Please go through th ecode and help me through.
    TABLES: REGUH,BSAK,BSIS,LFA1,LFB1,BSAS.
    ****    Internal table declaration starts.
    ***    To Store Vendor clearing Document.
    ***    Internal table for credit card sub total.
    DATA : BEGIN OF I_BSAK OCCURS 0,
           XBLNR LIKE BSAK-XBLNR,
           LIFNR LIKE REGUH-LIFNR,
           PRCTR LIKE BSEG-PRCTR,
           NAME1 LIKE LFA1-NAME1,
           AUGDT LIKE BSAK-AUGDT,
           AUGBL LIKE BSAK-AUGBL,
           XBLNR1 LIKE BSAK-XBLNR,
           GJAHR LIKE BSAK-GJAHR,
           BELNR LIKE BSAK-BELNR,
           BLDAT LIKE BSAK-BLDAT,
           BLART LIKE BSAK-BLART,
           SHKZG LIKE BSAK-SHKZG,
           DMBTR LIKE BSAK-DMBTR,
           AUGGJ LIKE BSAK-AUGGJ,
           CPUDT LIKE BSAK-CPUDT,
           LAUFD LIKE REGUH-LAUFD,
           KTOKK LIKE LFA1-KTOKK,
           RWBTR LIKE REGUH-RWBTR,
           VBLNR LIKE REGUH-VBLNR,
           HKONT LIKE BSEG-HKONT,
           END OF I_BSAK.
    ***    Internal table for Vendor sub total.
    DATA : BEGIN OF I_BSAK_LIFNR OCCURS 0,
           LIFNR LIKE REGUH-LIFNR,
           XBLNR LIKE BSAK-XBLNR,
           PRCTR LIKE BSEG-PRCTR,
           NAME1 LIKE LFA1-NAME1,
           AUGDT LIKE BSAK-AUGDT,
           AUGBL LIKE BSAK-AUGBL,
           XBLNR1 LIKE BSAK-XBLNR,
           GJAHR LIKE BSAK-GJAHR,
           BELNR LIKE BSAK-BELNR,
           BLDAT LIKE BSAK-BLDAT,
           BLART LIKE BSAK-BLART,
           SHKZG LIKE BSAK-SHKZG,
           DMBTR LIKE BSAK-DMBTR,
           AUGGJ LIKE BSAK-AUGGJ,
           CPUDT LIKE BSAK-CPUDT,
           LAUFD LIKE REGUH-LAUFD,
           KTOKK LIKE LFA1-KTOKK,
           RWBTR LIKE REGUH-RWBTR,
           VBLNR LIKE REGUH-VBLNR,
           HKONT LIKE BSEG-HKONT,
           END OF I_BSAK_LIFNR.
    ***    Internal table for Profit center sub total.
    DATA : BEGIN OF I_BSAK_PRCTR OCCURS 0,
           PRCTR LIKE BSEG-PRCTR,
           BELNR LIKE BSAK-BELNR,
           GJAHR LIKE BSAK-GJAHR,
           LIFNR LIKE REGUH-LIFNR,
           XBLNR LIKE BSAK-XBLNR,
           HKONT LIKE BSEG-HKONT,
           NAME1 LIKE LFA1-NAME1,
           AUGDT LIKE BSAK-AUGDT,
           AUGBL LIKE BSAK-AUGBL,
           XBLNR1 LIKE BSAK-XBLNR,
           BLDAT LIKE BSAK-BLDAT,
           BLART LIKE BSAK-BLART,
           SHKZG LIKE BSAK-SHKZG,
           DMBTR LIKE BSAK-DMBTR,
           AUGGJ LIKE BSAK-AUGGJ,
           CPUDT LIKE BSAK-CPUDT,
           LAUFD LIKE REGUH-LAUFD,
           KTOKK LIKE LFA1-KTOKK,
           RWBTR LIKE REGUH-RWBTR,
           VBLNR LIKE REGUH-VBLNR,
           END OF I_BSAK_PRCTR.
    ***  Work area for sub totals.
    DATA: WA LIKE I_BSAK.
    DATA : I_BSAK_INIT LIKE I_BSAK OCCURS 0 WITH HEADER LINE.
    ***    To store line item.
    DATA : BEGIN OF I_BSEG OCCURS 0,
           BELNR LIKE BSEG-BELNR,
           GJAHR LIKE BSEG-GJAHR,
           BUZEI LIKE BSEG-BUZEI,
           HKONT LIKE BSEG-HKONT,
           SHKZG LIKE BSEG-SHKZG,
           DMBTR LIKE BSEG-DMBTR,
           PRCTR LIKE BSEG-PRCTR,
           LIFNR LIKE REGUH-LIFNR,
           AUGDT LIKE BSAK-AUGDT,
           AUGBL LIKE BSAK-AUGBL,
           XBLNR LIKE BSAK-XBLNR,
           XBLNR1 LIKE BSAK-XBLNR,
           BLDAT LIKE BSAK-BLDAT,
           BLART LIKE BSAK-BLART,
           NAME1 LIKE LFA1-NAME1,
           END OF I_BSEG.
    DATA : BEGIN OF I_BSEG_COPY OCCURS 0,
          PRCTR LIKE BSEG-PRCTR,
          BELNR LIKE BSEG-BELNR,
          GJAHR LIKE BSEG-GJAHR,
          BUZEI LIKE BSEG-BUZEI,
          HKONT LIKE BSEG-HKONT,
          SHKZG LIKE BSEG-SHKZG,
          DMBTR LIKE BSEG-DMBTR,
          LIFNR LIKE REGUH-LIFNR,
          AUGDT LIKE BSAK-AUGDT,
          AUGBL LIKE BSAK-AUGBL,
          XBLNR LIKE BSAK-XBLNR,
          XBLNR1 LIKE BSAK-XBLNR,
          BLDAT LIKE BSAK-BLDAT,
          BLART LIKE BSAK-BLART,
          NAME1 LIKE LFA1-NAME1,
          END OF I_BSEG_COPY.
    ***    To store GL account name
    DATA: BEGIN OF I_SKAT OCCURS 0,
          SAKNR LIKE SKAT-SAKNR,
          TXT50 LIKE SKAT-TXT50,
          END OF I_SKAT.
    ***   To store Vendor detail
    DATA: BEGIN OF I_LFA1 OCCURS 0,
          LIFNR LIKE LFA1-LIFNR,
          NAME1 LIKE LFA1-NAME1,
          KTOKK LIKE LFA1-KTOKK,
          END OF I_LFA1.
    DATA: I_INACT TYPE TABLE OF SY-UCOMM.
    ***  End of Internal table declaration.
    ***  Constant for company code
    CONSTANTS : C_BUKRS(4) VALUE '0010'.
    ***  Data declaration.
    DATA: FR_LAUFDT LIKE REGUH-LAUFD,
          TO_LAUFDT LIKE REGUH-LAUFD,
          COL,
          HEADING(80),
          HEADING1(10),
          HEADING2(80),
          AUTH_RESTRICT,
          G_DETAIL,
          G_SORTV,
          G_SORTP,
          G_SORTC,
          G_FLAG,
          V_XBLNR LIKE BSAK-XBLNR,
          V_UCOMM LIKE SY-UCOMM,
          V_AUGBL LIKE BSAS-AUGBL,
          V_BELNR LIKE BSAS-BELNR.
    DATA : BEGIN OF I_SEL OCCURS 0 ,
           AUGBL LIKE BSAK-AUGBL,
           END OF I_SEL.
    DATA: PROGNAME TYPE SY-REPID,
          DYNNUM   TYPE SY-DYNNR,
          DYNPRO_VALUES TYPE TABLE OF DYNPREAD,
          FIELD_VALUE LIKE LINE OF DYNPRO_VALUES,
          VALUES_TAB LIKE I_SEL OCCURS 0 WITH HEADER LINE.
    DATA : RETURN_TAB LIKE  DDSHRETVAL OCCURS 0 WITH HEADER LINE.
    ***  Selection screen.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(30) TXT_PD FOR FIELD P_LAUFDF.
    SELECTION-SCREEN POSITION POS_LOW.
    PARAMETERS P_LAUFDF LIKE REGUH-LAUFD OBLIGATORY.
    SELECTION-SCREEN COMMENT 52(5) TXT_TO FOR FIELD P_LAUFDT.
    SELECTION-SCREEN POSITION POS_HIGH.
    PARAMETERS P_LAUFDT LIKE REGUH-LAUFD.
    SELECTION-SCREEN END OF LINE.
    SELECT-OPTIONS: S_KTOKK FOR LFA1-KTOKK.
    PARAMETERS: P_RWBTR LIKE REGUH-RWBTR.
    SELECT-OPTIONS: S_LIFNR FOR REGUH-LIFNR.
    * S_XBLNR FOR BSAK-XBLNR MATCHCODE OBJECT ZXBLNR.
    **** Added By Rajesh On 17 OCT 08 (DEVK914797) ****
    SELECT-OPTIONS: S_BELNR  FOR BSAK-BELNR.
    **** End of Addition By Rajesh *****
    *** Added By Samir On 04 Sep 08 (DEVK914623) ***
    SELECTION-SCREEN SKIP.
    PARAMETERS: CHK_REC AS CHECKBOX.
    *** End Of Addition By Samir ***
    SELECTION-SCREEN END OF BLOCK B1.
    ***  Initialization.
    INITIALIZATION.
      TXT_PD = 'Payment Date'.
      TXT_TO = 'to' .
      G_SORTC = 'X'.
    ***  At selection-screen.
    AT SELECTION-SCREEN.
      FR_LAUFDT =  P_LAUFDF.
      IF P_LAUFDT IS INITIAL.
        TO_LAUFDT = FR_LAUFDT.
      ELSE.
        IF P_LAUFDT LT P_LAUFDF.
          MESSAGE E000(ZMSG) WITH 'To Date is less than From date'.
        ENDIF.
        TO_LAUFDT = P_LAUFDT.
      ENDIF.
    ***  Heading.
      WRITE FR_LAUFDT TO HEADING1.
      WRITE TO_LAUFDT TO HEADING2.
      IF HEADING1 <> HEADING2.
        CONCATENATE 'Vendor Credit Card(s) Report for the Payment Date'
        HEADING1 'To' HEADING2 INTO HEADING2 SEPARATED BY SPACE.
      ELSE.
        CONCATENATE 'Vendor Credit Card(s) Report for the Payment Date'
        HEADING1 INTO HEADING2 SEPARATED BY SPACE.
      ENDIF.
    ***  Start of selection.
    START-OF-SELECTION.
      G_DETAIL = 'X'.
      PERFORM GET_DATA.
      PERFORM MODIFY_ITAB.                          "Process and for authority check.
    *** Added By Samir On 04 Sep 08 (DEVK914623) ***
    **** Changed By Rajesh On 17 OCT 08 (DEVK914797) ****
      IF CHK_REC = 'X'.
        LOOP AT I_BSAK.
          SELECT SINGLE BELNR
          INTO   V_BELNR
          FROM   BSAS
          WHERE  BUKRS = C_BUKRS
            AND  HKONT = '0000002012'
            AND  BELNR = I_BSAK-AUGBL
            AND  BUDAT = I_BSAK-AUGDT
            AND  BELNR IN S_BELNR.               " For displaying only reconciled items.
    **** End of Addition By Rajesh *****
          IF SY-SUBRC <> 0.
            DELETE I_BSAK.
          ENDIF.
        ENDLOOP.
      ENDIF.
    *** End Of Addition By Samir ***
      LOOP AT I_BSAK.
        MOVE-CORRESPONDING I_BSAK TO: I_BSAK_LIFNR.
        APPEND: I_BSAK_LIFNR.
        CLEAR:  I_BSAK_LIFNR.
      ENDLOOP.
      LOOP AT I_BSAK.
        MOVE-CORRESPONDING I_BSAK TO: I_BSAK_PRCTR.
        READ TABLE I_BSEG WITH KEY BELNR = I_BSAK-BELNR.
        I_BSAK_PRCTR-HKONT = I_BSEG-HKONT.
        APPEND: I_BSAK_PRCTR.
        CLEAR:  I_BSAK_PRCTR.
      ENDLOOP.
    *loop at i_bseg.
    *   MOVE-CORRESPONDING I_BSAK TO: I_BSAK_PRCTR.
    *endloop.
    *perform write_data.
      PERFORM DISPLAY_OUTPUT.
    AT USER-COMMAND.
      CASE SY-UCOMM.
        WHEN 'EXPA'.
          G_DETAIL = 'X'.
        WHEN 'COLL'.
          CLEAR G_DETAIL.
        WHEN 'SORTV'.
          CLEAR: V_UCOMM.
          V_UCOMM = 'SORTV'.
          G_SORTV = 'X'.
          CLEAR G_SORTP.
          CLEAR G_SORTC.
        WHEN 'SORTC'.
          CLEAR: V_UCOMM.
          V_UCOMM = 'SORTC'.
          CLEAR G_SORTV.
          CLEAR G_SORTP.
          G_SORTC = 'X'.
        WHEN 'SORTP'.
          CLEAR: V_UCOMM.
          V_UCOMM = 'SORTP'.
          CLEAR G_SORTV.
          CLEAR G_SORTC.
          G_SORTP = 'X'.
      ENDCASE.
      PERFORM DISPLAY_OUTPUT.
    *perform write_data.
    ***  To get the header text in the output.
    TOP-OF-PAGE.
      PERFORM TOP_OF_PAGE.
    TOP-OF-PAGE DURING LINE-SELECTION.
      PERFORM TOP_OF_PAGE.
    *&      Form  GET_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_DATA .
      SY-LSIND = 0.
      P_RWBTR = P_RWBTR * -1.
      REFRESH I_BSAK_INIT.
      CLEAR I_BSAK_INIT.
      SELECT A~LIFNR A~LAUFD A~VBLNR A~RWBTR
              B~KTOKK B~NAME1
                FROM REGUH AS A INNER JOIN LFA1 AS B
                ON   A~LIFNR = B~LIFNR
                INTO CORRESPONDING FIELDS OF TABLE I_BSAK_INIT
                WHERE A~LAUFD BETWEEN FR_LAUFDT AND TO_LAUFDT AND
                      A~XVORL <> 'X' AND
                      A~ZBUKR = C_BUKRS  AND
                      A~LIFNR IN S_LIFNR AND
                      A~RZAWE = 'X' AND
                      A~RWBTR LE P_RWBTR AND
                      B~KTOKK IN S_KTOKK.
      IF SY-SUBRC <> 0.
        MESSAGE 'Records Not Found' TYPE 'I'.
        LEAVE LIST-PROCESSING.
      ENDIF.
    *---------------------PERFORMANCE ISSUE--------------------------
    delete adjacent duplicates from i_bsak_init.
      IF NOT I_BSAK_INIT[] IS INITIAL.
       SELECT LIFNR AUGDT AUGBL GJAHR BELNR CPUDT BLDAT XBLNR
               BLART SHKZG DMBTR AUGGJ
                  FROM BSAK
                  INTO CORRESPONDING FIELDS OF TABLE I_BSAK
                  FOR ALL ENTRIES IN I_BSAK_INIT
                  WHERE BUKRS = C_BUKRS  AND
                  AUGBL = I_BSAK_INIT-VBLNR AND
                  XZAHL <> 'X'.
      ENDIF.
    ***  Selecting all line item records from BSEG table.
      IF I_BSAK[] IS NOT INITIAL.
        SELECT BELNR GJAHR BUZEI HKONT SHKZG DMBTR PRCTR
               FROM BSEG
               INTO CORRESPONDING FIELDS OF TABLE I_BSEG
               FOR ALL ENTRIES IN I_BSAK
               WHERE BUKRS = C_BUKRS      AND
                     BELNR = I_BSAK-BELNR AND
                     GJAHR = I_BSAK-GJAHR AND
                     BELNR <> I_BSAK-AUGBL AND
                     KOART <> 'K'.
      ENDIF.
    ***  Selecting gl account name from SKAT table.
      IF I_BSEG[] IS NOT INITIAL.
        SELECT SAKNR TXT50
               FROM SKAT
               INTO CORRESPONDING FIELDS OF TABLE I_SKAT
               FOR ALL ENTRIES IN I_BSEG
               WHERE SPRAS = 'E'     AND
                     KTOPL = C_BUKRS AND
                     SAKNR = I_BSEG-HKONT.
      ENDIF.
      SORT I_BSAK BY BELNR.
      SORT I_BSAK_INIT BY VBLNR.
      SORT I_BSEG BY BELNR GJAHR.
    *** Selecting Credit Card No. into I_XBLNR table.
      LOOP AT I_BSAK.
        I_BSAK-XBLNR1 = I_BSAK-XBLNR.
        CLEAR: V_XBLNR.
        SELECT SINGLE XBLNR FROM BKPF INTO V_XBLNR
                              WHERE BUKRS = C_BUKRS  AND
                              BELNR = I_BSAK-AUGBL.
        IF SY-SUBRC EQ 0.
          I_BSAK-XBLNR = V_XBLNR.
        ENDIF.
        READ TABLE I_BSEG WITH KEY BELNR = I_BSAK-BELNR
                                   GJAHR = I_BSAK-GJAHR
                                   BINARY SEARCH.
        IF SY-SUBRC EQ 0.
          I_BSAK-PRCTR = I_BSEG-PRCTR.
        ENDIF.
        READ TABLE I_BSAK_INIT WITH KEY VBLNR = I_BSAK-AUGBL BINARY SEARCH.
        IF SY-SUBRC EQ 0.
          I_BSAK-NAME1 = I_BSAK_INIT-NAME1.
          I_BSAK-LAUFD = I_BSAK_INIT-LAUFD.
          I_BSAK-KTOKK = I_BSAK_INIT-KTOKK.
        ENDIF.
        MODIFY I_BSAK TRANSPORTING XBLNR XBLNR1 PRCTR NAME1 LAUFD KTOKK.
      ENDLOOP.
    ENDFORM.                    " GET_DATA
    *&      Form  MODIFY_ITAB
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM MODIFY_ITAB .
    ***  Process on internal table
      LOOP AT I_BSAK.
        AUTHORITY-CHECK OBJECT 'F_LFA1_GRP'
                             ID 'KTOKK'
                          FIELD I_BSAK-KTOKK.
        IF SY-SUBRC NE 0.
          DELETE I_BSAK WHERE KTOKK EQ I_BSAK-KTOKK.
          AUTH_RESTRICT = 'X'.
          CONTINUE.
        ENDIF.
      ENDLOOP.
      IF AUTH_RESTRICT EQ 'X'.
        MESSAGE S005(ZMSG).
      ENDIF.
      LOOP AT I_BSAK.
        IF I_BSAK-SHKZG = 'S'.
          I_BSAK-DMBTR = I_BSAK-DMBTR * -1.
          MODIFY I_BSAK .
        ENDIF.
      ENDLOOP.
      LOOP AT I_BSEG.
        IF I_BSEG-SHKZG = 'H'.
          I_BSEG-DMBTR = I_BSEG-DMBTR * -1.
          MODIFY I_BSEG .
        ENDIF.
      ENDLOOP.
    ***  Default Sorting on internal table .
      SORT I_BSAK BY XBLNR LIFNR BELNR.
      SORT I_BSEG BY BELNR HKONT.
      SORT I_SKAT BY SAKNR.
    ENDFORM.                    " MODIFY_ITAB
    *&      Form  DISPLAY_OUTPUT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY_OUTPUT .
    ***  Coding for detail output starts
      CLEAR SY-LSIND.
      REFRESH I_INACT.
      IF G_DETAIL EQ 'X'.
        APPEND 'EXPA' TO I_INACT.
      ELSE.
        APPEND 'COLL' TO I_INACT.
      ENDIF.
      IF G_SORTV EQ 'X'.
        APPEND 'SORTV' TO I_INACT.
        SORT I_BSAK BY LIFNR.
        SORT I_BSAK_LIFNR BY LIFNR.
      ELSEIF G_SORTP EQ 'X'.
        APPEND 'SORTP' TO I_INACT.
        SORT I_BSAK BY PRCTR.
        SORT I_BSAK_PRCTR BY PRCTR.
      ELSE.
        APPEND 'SORTC' TO I_INACT.
        SORT I_BSAK BY XBLNR.
      ENDIF.
      SET PF-STATUS 'STAT' EXCLUDING I_INACT.
      IF V_UCOMM = 'SORTC'.
        PERFORM WRITE_DATA.
      ELSEIF V_UCOMM = 'SORTV' .     "Subroutine for card sub total.
        PERFORM WRITE_DATA_VENDOR.   "Subroutine for vendor sub total.
      ELSEIF V_UCOMM = 'SORTP'.      "Subroutine for profit center sub total.
    *    PERFORM WRITE_DATA_PROFIT.
        PERFORM WRITE_DATA_PROFIT_NEW.  " New subroutine for profit center.
      ELSE.
        PERFORM WRITE_DATA.
      ENDIF.
    ENDFORM.                    " DISPLAY_OUTPUT
    *&      Form  F_COLOR
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM F_COLOR .
      IF COL = 'X'.
        FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
        CLEAR COL.
      ELSE.
        FORMAT COLOR COL_NORMAL INTENSIFIED ON.
        COL = 'X'.
      ENDIF.
    ENDFORM.                    " F_COLOR
    *&      Form  TOP_OF_PAGE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM TOP_OF_PAGE .
    ***  Top-of-page is Common for summary and detail report.
    ***  To display top of page only on first page.
      IF SY-PAGNO = 1 .
        CALL FUNCTION 'Z_NPL_HEADING'
          EXPORTING
            LINE_SIZE = SY-LINSZ
            HEADING1  = HEADING
            HEADING2  = HEADING2.
        FORMAT COLOR COL_HEADING INTENSIFIED ON.
    ****  To get output columns text descprition
        ULINE.
        WRITE:/ SY-VLINE NO-GAP, (10) 'Vendor' NO-GAP,
                SY-VLINE NO-GAP, (35) 'Name of Payee' NO-GAP,
                SY-VLINE NO-GAP, (10) 'G/L Num' NO-GAP,
                SY-VLINE NO-GAP, (42) 'G/L Name' NO-GAP,
                SY-VLINE NO-GAP, (07) 'Profit Center' NO-GAP,
                SY-VLINE NO-GAP, (16) 'Credit Card NO.' NO-GAP,
                SY-VLINE NO-GAP, (10) 'Pmnt Date' NO-GAP,
                SY-VLINE NO-GAP, (08) 'Doc.Type' NO-GAP,
                SY-VLINE NO-GAP, (10) 'Inv.Date' NO-GAP,
                SY-VLINE NO-GAP, (16) 'Invoice' NO-GAP,
                SY-VLINE NO-GAP, (14) 'Amount Paid' NO-GAP,
                SY-VLINE.
        ULINE.
      ENDIF.
    ENDFORM.                    " TOP_OF_PAGE
    *&      Form  WRITE_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM WRITE_DATA .
      LOOP AT I_BSAK.
        CLEAR WA.
        MOVE-CORRESPONDING I_BSAK TO WA.
        PERFORM WRITE.
        AT END OF XBLNR.                             "Card sub total
          IF G_SORTC EQ 'X'.
            SUM.
            IF G_DETAIL EQ 'X'. ULINE. ENDIF.
            FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
            WRITE:/ SY-VLINE NO-GAP, (25) 'Credit Card Total:', I_BSAK-XBLNR ,
                    (35) I_BSAK-NAME1 NO-GAP.
            WRITE: 110 SY-VLINE NO-GAP,(79) I_BSAK-DMBTR NO-GAP
                                             CURRENCY 'USD',SY-VLINE.
            ULINE.
          ENDIF.
        ENDAT.                                     "End of Credit card Detail
    ****  Grand total
        AT LAST.                                   "Grand total
          SUM.
          FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
          WRITE:/ SY-VLINE NO-GAP,(107) 'Grand Total:',
                  SY-VLINE NO-GAP,(79) I_BSAK-DMBTR NO-GAP
                                         CURRENCY 'USD', SY-VLINE.
          ULINE.
        ENDAT.
      ENDLOOP.                                     "End for I_BSAK loop
    ENDFORM.                    " WRITE_DATA
    *&      Form  WRITE_DATA_VENDOR
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM WRITE_DATA_VENDOR .
      LOOP AT I_BSAK_LIFNR.
        CLEAR WA.
        MOVE-CORRESPONDING I_BSAK_LIFNR TO WA.
        PERFORM WRITE.
        AT END OF LIFNR.                           "Vendor sub Total
          IF G_SORTV EQ 'X'.
            SUM.
            IF G_DETAIL EQ 'X'. ULINE. ENDIF.
            FORMAT COLOR COL_TOTAL INTENSIFIED ON.
            WRITE:/ SY-VLINE NO-GAP,(15) 'Vendor Total:', I_BSAK_LIFNR-LIFNR.
            WRITE: 110 SY-VLINE NO-GAP,(79) I_BSAK_LIFNR-DMBTR NO-GAP
                                             CURRENCY 'USD',SY-VLINE.
            ULINE.
          ENDIF.
        ENDAT.                                     "End of Vendor Total
    ****  Grand total
        AT LAST.                                   "Grand total
          SUM.
          FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
          WRITE:/ SY-VLINE NO-GAP,(107) 'Grand Total:',
                  SY-VLINE NO-GAP,(79) I_BSAK_LIFNR-DMBTR NO-GAP
                                         CURRENCY 'USD', SY-VLINE.
          ULINE.
        ENDAT.
      ENDLOOP.                                     "End for I_BSAK_LIFNR loop
    ENDFORM.                    " WRITE_DATA_VENDOR
    *&      Form  WRITE_DATA_PROFIT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM WRITE_DATA_PROFIT .
    *** Changed By Samir On 18 Sep 08 (DEVK914685) ***
      LOOP AT I_BSAK_PRCTR.
        READ TABLE I_BSAK WITH KEY BELNR = I_BSAK_PRCTR-BELNR
                                   GJAHR = I_BSAK_PRCTR-GJAHR.
        IF SY-SUBRC = 0.
          I_BSAK_PRCTR-LIFNR  = I_BSAK-LIFNR.
          I_BSAK_PRCTR-NAME1  = I_BSAK-NAME1.
          I_BSAK_PRCTR-XBLNR  = I_BSAK-XBLNR.
          I_BSAK_PRCTR-LAUFD  = I_BSAK-LAUFD.
          I_BSAK_PRCTR-BLART  = I_BSAK-BLART.
          I_BSAK_PRCTR-BLDAT  = I_BSAK-BLDAT.
          I_BSAK_PRCTR-XBLNR1 = I_BSAK-XBLNR1.
          MODIFY I_BSAK_PRCTR TRANSPORTING LIFNR NAME1 XBLNR LAUFD BLART BLDAT XBLNR1.
        ENDIF.
      ENDLOOP.
    *** End Of Changes By Samir On 18 Sep 08 ***
      SORT I_BSAK_PRCTR BY PRCTR.
      LOOP AT I_BSAK_PRCTR.
        PERFORM F_COLOR.
        IF G_DETAIL = 'X'.
    *** Changed By Samir On 18 Sep 08 (DEVK914685) ***
          READ TABLE I_SKAT WITH KEY SAKNR = I_BSAK_PRCTR-HKONT BINARY SEARCH.
          WRITE:/ SY-VLINE NO-GAP, (10) I_BSAK_PRCTR-LIFNR NO-GAP,
                  SY-VLINE NO-GAP, (35) I_BSAK_PRCTR-NAME1 NO-GAP,
                  SY-VLINE NO-GAP, (10) I_BSAK_PRCTR-HKONT NO-GAP,
                  SY-VLINE NO-GAP, (42) I_SKAT-TXT50 NO-GAP,
                  SY-VLINE NO-GAP, (07) I_BSAK_PRCTR-PRCTR NO-GAP,
                  SY-VLINE NO-GAP, (16) I_BSAK_PRCTR-XBLNR NO-GAP,     " CREDIT CARD NO.
                  SY-VLINE NO-GAP, (10) I_BSAK_PRCTR-LAUFD NO-GAP,
                  SY-VLINE NO-GAP, (08) I_BSAK_PRCTR-BLART NO-GAP,
                  SY-VLINE NO-GAP, (10) I_BSAK_PRCTR-BLDAT NO-GAP,
                  SY-VLINE NO-GAP, (16) I_BSAK_PRCTR-XBLNR1 NO-GAP.
          WRITE:  SY-VLINE NO-GAP, (14) I_BSAK_PRCTR-DMBTR NO-GAP.
          WRITE:  SY-VLINE.
        ENDIF.
    *** End Of Changes By Samir On 18 Sep 08 ***
        AT END OF PRCTR.                           "Profit Center sub Total
          IF G_SORTP EQ 'X'.
            SUM.
            IF G_DETAIL EQ 'X'. ULINE. ENDIF.
            FORMAT COLOR COL_TOTAL INTENSIFIED ON.
            WRITE:/ SY-VLINE NO-GAP,(07) 'Profit Center Total:', I_BSAK_PRCTR-PRCTR.
            WRITE: 110 SY-VLINE NO-GAP,(79) I_BSAK_PRCTR-DMBTR NO-GAP
                                             CURRENCY 'USD',SY-VLINE.
            ULINE.
          ENDIF.
        ENDAT.                                    "End of Profit Center Total
    ****  Grand total
        AT LAST.                                  "Grand total
          SUM.
          FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
          WRITE:/ SY-VLINE NO-GAP,(107) 'Grand Total:',
                  SY-VLINE NO-GAP,(79) I_BSAK_PRCTR-DMBTR NO-GAP
                                         CURRENCY 'USD', SY-VLINE.
          ULINE.
        ENDAT.
      ENDLOOP.                                     "End for I_BSAK_PRCTR loop
    ENDFORM.                    " WRITE_DATA_PROFIT
    *&      Form  WRITE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM WRITE .
      IF G_DETAIL = 'X'.
        IF WA-KTOKK = 'Z001'.                   " For HR Vendors
          PERFORM F_COLOR.
          READ TABLE I_BSEG WITH KEY BELNR = WA-BELNR GJAHR = WA-GJAHR BINARY SEARCH .
          READ TABLE I_SKAT WITH KEY SAKNR = I_BSEG-HKONT BINARY SEARCH.
          WRITE:/ SY-VLINE NO-GAP, (10) WA-LIFNR NO-GAP,
                  SY-VLINE NO-GAP, (35) WA-NAME1 NO-GAP,
                  SY-VLINE NO-GAP, (10) I_BSEG-HKONT NO-GAP,
                  SY-VLINE NO-GAP, (42) I_SKAT-TXT50 NO-GAP,
    *** Changed By Samir On 18 Sep 08 (DEVK914685) ***
    *             SY-VLINE NO-GAP, (07) WA-PRCTR NO-GAP,
                  SY-VLINE NO-GAP, (07) I_BSEG-PRCTR NO-GAP,
    *** End Of Changes By Samir On 18 Sep 08 ***
                  SY-VLINE NO-GAP, (16) WA-XBLNR NO-GAP,        " CREDIT CARD NO.
                  SY-VLINE NO-GAP, (10) WA-LAUFD NO-GAP,
                  SY-VLINE NO-GAP, (08) WA-BLART NO-GAP,
                  SY-VLINE NO-GAP, (10) WA-BLDAT NO-GAP,
                  SY-VLINE NO-GAP, (16) WA-XBLNR1 NO-GAP.
          WRITE: SY-VLINE NO-GAP, (14) WA-DMBTR NO-GAP.
          WRITE: SY-VLINE.
        ELSE.
          LOOP AT I_BSEG WHERE BELNR = WA-BELNR AND GJAHR = WA-GJAHR .
            PERFORM F_COLOR.
            READ TABLE I_SKAT WITH KEY SAKNR = I_BSEG-HKONT BINARY SEARCH.
            WRITE:/ SY-VLINE NO-GAP, (10) WA-LIFNR NO-GAP,
                    SY-VLINE NO-GAP, (35) WA-NAME1 NO-GAP,
                    SY-VLINE NO-GAP, (10) I_BSEG-HKONT NO-GAP,
                    SY-VLINE NO-GAP, (42) I_SKAT-TXT50 NO-GAP,
    *** Changed By Samir On 17 Sep 08 (DEVK914671) ***
    *               SY-VLINE NO-GAP, (07) WA-PRCTR NO-GAP,
                    SY-VLINE NO-GAP, (07) I_BSEG-PRCTR NO-GAP,
    *** End Of Changes By Samir On 17 Sep 08 ***
                    SY-VLINE NO-GAP, (16) WA-XBLNR NO-GAP,     " CREDIT CARD NO.
                    SY-VLINE NO-GAP, (10) WA-LAUFD NO-GAP,
                    SY-VLINE NO-GAP, (08) WA-BLART NO-GAP,
                    SY-VLINE NO-GAP, (10) WA-BLDAT NO-GAP,
                    SY-VLINE NO-GAP, (16) WA-XBLNR1 NO-GAP.
            WRITE: SY-VLINE NO-GAP, (14)  I_BSEG-DMBTR NO-GAP.
            WRITE: SY-VLINE.
          ENDLOOP.                                 "End   for I_BSEG loop
        ENDIF.                                     "Endif for I_PAYR-KTOKK = 'Z001'
      ENDIF.                                       "Endif for g_detail = 'X'.
    ENDFORM.                    " WRITE
    *&      Form  WRITE_DATA_PROFIT_NEW
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM WRITE_DATA_PROFIT_NEW .
      REFRESH I_BSEG_COPY.
      CLEAR I_BSEG_COPY.
    *  DATA I_BSEG_COPY LIKE I_BSEG OCCURS 0 WITH HEADER LINE.
    *  I_BSEG_COPY[] = I_BSEG[].
      LOOP AT I_BSEG.
        MOVE-CORRESPONDING I_BSEG TO I_BSEG_COPY.
        APPEND I_BSEG_COPY.
        CLEAR I_BSEG_COPY.
      ENDLOOP.
      LOOP AT I_BSEG_COPY.
        READ TABLE I_BSAK_PRCTR WITH KEY BELNR = I_BSEG_COPY-BELNR GJAHR = I_BSEG_COPY-GJAHR ."HKONT = I_BSEG_COPY-HKONT.
        IF SY-SUBRC = 0.
          I_BSEG_COPY-LIFNR = I_BSAK_PRCTR-LIFNR.
          I_BSEG_COPY-XBLNR = I_BSAK_PRCTR-XBLNR.
          I_BSEG_COPY-NAME1 = I_BSAK_PRCTR-NAME1.
          I_BSEG_COPY-AUGDT = I_BSAK_PRCTR-AUGDT.
          I_BSEG_COPY-AUGBL = I_BSAK_PRCTR-AUGBL.
          I_BSEG_COPY-XBLNR1 = I_BSAK_PRCTR-XBLNR1.
          I_BSEG_COPY-BLDAT = I_BSAK_PRCTR-BLDAT.
          I_BSEG_COPY-BLART = I_BSAK_PRCTR-BLART.
          MODIFY I_BSEG_COPY TRANSPORTING LIFNR XBLNR NAME1 AUGDT AUGBL XBLNR1 BLDAT BLART.
        ENDIF.
      ENDLOOP.
      SORT I_BSAK_PRCTR BY PRCTR BELNR.
      SORT I_BSEG BY BELNR.
      SORT I_BSEG_COPY BY PRCTR.
      DATA COUNT TYPE I.
      DATA G_BELNR LIKE BSAK-BELNR.
      LOOP AT I_BSEG_COPY.
        CLEAR G_BELNR.
        G_BELNR = I_BSEG_COPY-BELNR.
        COUNT = COUNT + 1.
        READ TABLE I_BSAK WITH KEY BELNR = I_BSEG_COPY-BELNR.
        IF SY-SUBRC <> 0.
          DELETE I_BSEG_COPY WHERE BELNR = G_BELNR."INDEX count.
        ENDIF.
      ENDLOOP.
    *  LOOP AT I_BSAK_PRCTR.
      LOOP AT I_BSEG_COPY.
        CLEAR WA.
        MOVE-CORRESPONDING I_BSEG_COPY TO WA.
        PERFORM WRITE_PRCTR.
        AT END OF PRCTR.                           "Profit center sub Total
          IF G_SORTP EQ 'X'.
            SUM.
            IF G_DETAIL EQ 'X'. ULINE. ENDIF.
            FORMAT COLOR COL_TOTAL INTENSIFIED ON.
            WRITE:/ SY-VLINE NO-GAP,(20) 'Profit Center Total:', I_BSEG_COPY-PRCTR.
            WRITE: 110 SY-VLINE NO-GAP,(79) I_BSEG_COPY-DMBTR NO-GAP
                                             CURRENCY 'USD',SY-VLINE.
            ULINE.
          ENDIF.
        ENDAT.                                     "End of Vendor Total
    ****  Grand total
        AT LAST.                                   "Grand total
          SUM.
          FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
          WRITE:/ SY-VLINE NO-GAP,(107) 'Grand Total:',
                  SY-VLINE NO-GAP,(79) I_BSEG_COPY-DMBTR NO-GAP
                                         CURRENCY 'USD', SY-VLINE.
          ULINE.
        ENDAT.
      ENDLOOP.                                     "End for I_BSAK_LIFNR loop
    *ENDFORM.                    " WRITE_DATA_VENDOR
    ENDFORM.                    " WRITE_DATA_PROFIT_NEW
    *&      Form  WRITE_PRCTR
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM WRITE_PRCTR .
      IF G_DETAIL = 'X'.
        IF WA-KTOKK = 'Z001'.                   " For HR Vendors
          PERFORM F_COLOR.
    *      READ TABLE I_BSEG WITH KEY BELNR = WA-BELNR GJAHR = WA-GJAHR PRCTR = WA-PRCTR BINARY SEARCH .
          READ TABLE I_SKAT WITH KEY SAKNR = WA-HKONT BINARY SEARCH.
          WRITE:/ SY-VLINE NO-GAP, (10) WA-LIFNR NO-GAP,
                  SY-VLINE NO-GAP, (35) WA-NAME1 NO-GAP,
                  SY-VLINE NO-GAP, (10) WA-HKONT NO-GAP,
                  SY-VLINE NO-GAP, (42) I_SKAT-TXT50 NO-GAP,
    *** Changed By Samir On 18 Sep 08 (DEVK914685) ***
                  SY-VLINE NO-GAP, (07) WA-PRCTR NO-GAP,
    *             SY-VLINE NO-GAP, (07) I_BSEG-PRCTR NO-GAP,
    *** End Of Changes By Samir On 18 Sep 08 ***
                  SY-VLINE NO-GAP, (16) WA-XBLNR NO-GAP,        " CREDIT CARD NO.
                  SY-VLINE NO-GAP, (10) WA-LAUFD NO-GAP,
                  SY-VLINE NO-GAP, (08) WA-BLART NO-GAP,
                  SY-VLINE NO-GAP, (10) WA-BLDAT NO-GAP,
                  SY-VLINE NO-GAP, (16) WA-XBLNR1 NO-GAP.
          WRITE: SY-VLINE NO-GAP, (14) WA-DMBTR NO-GAP.
          WRITE: SY-VLINE.
        ELSE.
    *      LOOP AT I_BSEG WHERE BELNR = WA-BELNR AND GJAHR = WA-GJAHR AND PRCTR = WA-PRCTR .
          PERFORM F_COLOR.
          READ TABLE I_SKAT WITH KEY SAKNR = WA-HKONT BINARY SEARCH.
          WRITE:/ SY-VLINE NO-GAP, (10) WA-LIFNR NO-GAP,
                  SY-VLINE NO-GAP, (35) WA-NAME1 NO-GAP,
                  SY-VLINE NO-GAP, (10) WA-HKONT NO-GAP,
                  SY-VLINE NO-GAP, (42) I_SKAT-TXT50 NO-GAP,
    *** Changed By Samir On 17 Sep 08 (DEVK914671) ***
                 SY-VLINE NO-GAP, (07) WA-PRCTR NO-GAP,
    *              SY-VLINE NO-GAP, (07) I_BSEG-PRCTR NO-GAP,
    *** End Of Changes By Samir On 17 Sep 08 ***
                  SY-VLINE NO-GAP, (16) WA-XBLNR NO-GAP,     " CREDIT CARD NO.
                  SY-VLINE NO-GAP, (10) WA-LAUFD NO-GAP,
                  SY-VLINE NO-GAP, (08) WA-BLART NO-GAP,
                  SY-VLINE NO-GAP, (10) WA-BLDAT NO-GAP,
                  SY-VLINE NO-GAP, (16) WA-XBLNR1 NO-GAP.
          WRITE: SY-VLINE NO-GAP, (14)  WA-DMBTR NO-GAP.
          WRITE: SY-VLINE.
    *      ENDLOOP.                                 "End   for I_BSEG loop
        ENDIF.                                     "Endif for I_PAYR-KTOKK = 'Z001'
      ENDIF.                                       "Endif for g_detail = 'X'.
    ENDFORM.                    " WRITE_PRCTR
    Thanks in advance
    Raj.

    Ralph,
    Thanks for the reply.
    I have marked the sql statement in the code that is taking long time to run but Its my mistake not explaining the same in the description.
    When I was debugging the code the below sql statement was taking long time.
      IF NOT I_BSAK_INIT[] IS INITIAL.
       SELECT LIFNR AUGDT AUGBL GJAHR BELNR CPUDT BLDAT XBLNR
               BLART SHKZG DMBTR AUGGJ
                  FROM BSAK
                  INTO CORRESPONDING FIELDS OF TABLE I_BSAK
                  FOR ALL ENTRIES IN I_BSAK_INIT
                  WHERE BUKRS = C_BUKRS  AND
                  AUGBL = I_BSAK_INIT-VBLNR AND
                  XZAHL <> 'X'.
      ENDIF.
    Any suggestions on the code?
    Regards,
    Raj.

  • Simple query is taking long time

    Hi Experts,
    The below query is taking long time.
    [code]SELECT   FS.*
      FROM   ORL.FAX_STAGE FS
             INNER JOIN
                   ORL.FAX_SOURCE FSRC
                INNER JOIN
                   GLOBAL_BU_MAPPING GBM
                ON GBM.BU_ID = FSRC.BUID
             ON UPPER (FSRC.FAX_NUMBER) = UPPER (FS.DESTINATION)
    WHERE       FSRC.IS_DELETED = 'N'
             AND GBM.BU_ID IS NOT NULL
             AND UPPER (FS.FAX_STATUS) ='COMPLETED';[/code]
    this query is returning 1645457 records.
    [code]PLAN_TABLE_OUTPUT
    | Id  | Operation           | Name                   | Rows  | Bytes | Cost (%CPU)|
    |   0 | SELECT STATEMENT    |                        |   625K|   341M| 45113   (1)|
    |   1 |  HASH JOIN          |                        |   625K|   341M| 45113   (1)|
    |   2 |   NESTED LOOPS      |                        |   611 | 14664 |    22   (0)|
    |   3 |    TABLE ACCESS FULL| FAX_SOURCE             |  2290 | 48090 |    22   (0)|
    |   4 |    INDEX RANGE SCAN | GLOBAL_BU_MAPPING_BUID |     1 |     3 |     0   (0)|
    |   5 |   TABLE ACCESS FULL | FAX_STAGE              |  2324K|  1214M| 45076   (1)|
    PLAN_TABLE_OUTPUT
    Note
       - 'PLAN_TABLE' is old version
    15 rows selected.[/code]
    The distinct number of records in each table.
    [code]SELECT FAX_STATUS,count(*)
    FROM fax_STAGE
    GROUP BY FAX_STATUS;
    FAX_STATUS    COUNT(*)
    BROKEN          10
    Broken - New    9
    Completed    2324493
    New             20
    SELECT is_deleted,COUNT(*)
    FROM  FAX_SOURCE
    GROUP BY IS_DELETED;
    IS_DELETED COUNT(*)
    N         2290
    Y         78[/code]
    Total number of records in each table.
    [code]SELECT COUNT(*) FROM ORL.FAX_SOURCE FSRC-- 2368
    SELECT COUNT(*) FROM ORL.FAX_STAGE--2324532
    SELECT COUNT(*) FROM APPS_GLOBAL.GLOBAL_BU_MAPPING--9
    [/code]
    To improve the performance of this query I have created the following indexes.
    [code]Functional based index on UPPER (FSRC.FAX_NUMBER) ,UPPER (FS.DESTINATION) and UPPER (FS.FAX_STATUS).
    Bitmap index on FSRC.IS_DELETED.
    Normal Index on GBM.BU_ID and FSRC.BUID.
    [/code]
    But still the performance is bad for this query.
    What can I do apart from this to improve the performance of this query.
    Please help me .
    Thanks in advance.

    <I have created the following indexes.
    CREATE INDEX ORL.IDX_DESTINATION_RAM ON ORL.FAX_STAGE(UPPER("DESTINATION"))
    CREATE INDEX ORL.IDX_FAX_STATUS_RAM ON ORL.FAX_STAGE(LOWER("FAX_STATUS"))
    CREATE INDEX ORL.IDX_UPPER_FAX_STATUS_RAM ON ORL.FAX_STAGE(UPPER("FAX_STATUS"))
    CREATE INDEX ORL.IDX_BUID_RAM ON ORL.FAX_SOURCE(BUID)
    CREATE INDEX ORL.IDX_FAX_NUMBER_RAM ON ORL.FAX_SOURCE(UPPER("FAX_NUMBER"))
    CREATE BITMAP INDEX ORL.IDX_IS_DELETED_RAM ON ORL.FAX_SOURCE(IS_DELETED)
    After creating the following indexes performance got improved.
    But our DBA said that new BITMAP index at FAX_SOURCE table (ORL.IDX_IS_DELETED_RAM) can cause locks
    on multiple rows if IS_DELETED column is in use. Please proceed with detailed tests.
    I am sending the explain plan before creating indexes and after indexes has been created.
    SELECT  FS.*
    FROM  ORL.FAX_STAGE FS
                    INNER JOIN
                    ORL.FAX_SOURCE FSRC
                  INNER JOIN
                      GLOBAL_BU_MAPPING GBM
                    ON GBM.BU_ID = FSRC.BUID
                ON UPPER (FSRC.FAX_NUMBER) = UPPER (FS.DESTINATION)
    WHERE      FSRC.IS_DELETED = 'N'
              AND GBM.BU_ID IS NOT NULL
              AND UPPER (FS.FAX_STATUS) =:B1;
    --OLD without indexes
    PLAN_TABLE_OUTPUT
    Plan hash value: 3076973749
    | Id  | Operation          | Name                  | Rows  | Bytes | Cost (%CPU)| Time    |
    |  0 | SELECT STATEMENT    |                        |  141K|    85M| 45130  (1)| 00:09:02 |
    |*  1 |  HASH JOIN          |                        |  141K|    85M| 45130  (1)| 00:09:02 |
    |  2 |  NESTED LOOPS      |                        |  611 | 18330 |    22  (0)| 00:00:01 |
    |*  3 |    TABLE ACCESS FULL| FAX_SOURCE            |  2290 | 59540 |    22  (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN | GLOBAL_BU_MAPPING_BUID |    1 |    4 |    0  (0)| 00:00:01 |
    |*  5 |  TABLE ACCESS FULL | FAX_STAGE              | 23245 |    13M| 45106  (1)| 00:09:02 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
      1 - access(UPPER("FSRC"."FAX_NUMBER")=UPPER("FS"."DESTINATION"))
      3 - filter("FSRC"."IS_DELETED"='N')
      4 - access("GBM"."BU_ID"="FSRC"."BUID")
          filter("GBM"."BU_ID" IS NOT NULL)
      5 - filter(UPPER("FS"."FAX_STATUS")=SYS_OP_C2C(:B1))
    21 rows selected.
    --NEW with indexes.
    PLAN_TABLE_OUTPUT
    Plan hash value: 665032407
    | Id  | Operation                        | Name                    | Rows  | Bytes | Cost (%CPU)| Time    |
    |  0 | SELECT STATEMENT                |                          |  5995 |  3986K|  3117  (1)| 00:00:38 |
    |*  1 |  HASH JOIN                      |                          |  5995 |  3986K|  3117  (1)| 00:00:38 |
    |  2 |  NESTED LOOPS                  |                          |  611 | 47658 |    20  (5)| 00:00:01 |
    |*  3 |    VIEW                          | index$_join$_002        |  2290 |  165K|    20  (5)| 00:00:01 |
    |*  4 |    HASH JOIN                    |                          |      |      |            |      |
    |*  5 |      HASH JOIN                  |                          |      |      |            |      |
    PLAN_TABLE_OUTPUT
    |  6 |      BITMAP CONVERSION TO ROWIDS|                          |  2290 |  165K|    1  (0)| 00:00:01 |
    |*  7 |        BITMAP INDEX SINGLE VALUE | IDX_IS_DELETED_RAM      |      |      |            |      |
    |  8 |      INDEX FAST FULL SCAN      | IDX_BUID_RAM            |  2290 |  165K|    8  (0)| 00:00:01 |
    |  9 |      INDEX FAST FULL SCAN        | IDX_FAX_NUMBER_RAM      |  2290 |  165K|    14  (0)| 00:00:01 |
    |* 10 |    INDEX RANGE SCAN              | GLOBAL_BU_MAPPING_BUID  |    1 |    4 |    0  (0)| 00:00:01 |
    |  11 |  TABLE ACCESS BY INDEX ROWID    | FAX_STAGE                | 23245 |    13M|  3096  (1)| 00:00:38 |
    |* 12 |    INDEX RANGE SCAN              | IDX_UPPER_FAX_STATUS_RAM |  9298 |      |  2434  (1)| 00:00:30 |
    Predicate Information (identified by operation id):
    PLAN_TABLE_OUTPUT
      1 - access(UPPER("DESTINATION")="FSRC"."SYS_NC00035$")
      3 - filter("FSRC"."IS_DELETED"='N')
      4 - access(ROWID=ROWID)
      5 - access(ROWID=ROWID)
      7 - access("FSRC"."IS_DELETED"='N')
      10 - access("GBM"."BU_ID"="FSRC"."BUID")
          filter("GBM"."BU_ID" IS NOT NULL)
      12 - access(UPPER("FAX_STATUS")=SYS_OP_C2C(:B1))
    31 rows selected
    Please confirm on the DBA comment.Is this bitmap index locks rows in my case.
    Thanks.>

  • This part of query is taking long time to run, its about 40 minutes. Can anyone help wit it.

    ------Load Dataset into Temp table---------------
    SELECT
    z.SYSTEMNAME
    --,Case when ZXC.[Subsystem Name] <> 'NULL' Then zxc.[SubSystem Name]
    --else NULL
    --End AS SubSystemName
    , CASE
    WHEN z.PROV_TAX_ID IN
    (SELECT DISTINCT zxc.TIN
    FROM dbo.SQS_Provider_Tracking zxc
    WHERE zxc.[SubSystem Name] <> 'NULL'
    THEN
    (SELECT DISTINCT [Subsystem Name]
    FROM dbo.SQS_Provider_Tracking zxc
    WHERE z.PROV_TAX_ID = zxc.TIN)
    End As SubSYSTEMNAME
    ,z.PROVIDERNAME
    ,z.STATECODE
    ,z.PROV_TAX_ID
    ,z.SRC_PAR_CD
    ,SUM(z.SEQUEST_AMT) Actual_Sequestered_Amt
    , CASE
    WHEN z.SRC_PAR_CD IN ('E','O','S','W')
    THEN 'Nonpar Waiver'
    --**Amendment Mailed**
    --WHEN z.PROV_TAX_ID IN
    When EXISTS
    (SELECT DISTINCT b.PROV_TIN
    FROM dbo.SQS_Mailed_TINs_010614 b WITH (NOLOCK )
    where not exists (select * from dbo.sqs_objector_TINs t where b.PROV_TIN = t.prov_tin))
    THEN
    (SELECT DISTINCT b.Mailing
    FROM dbo.SQS_Mailed_TINs_010614 b WITH (NOLOCK )
    WHERE z.PROV_TAX_ID = b.PROV_TIN
    -- --**Amendment Mailed Wave 3 and 4**
    --WHEN z.PROV_TAX_ID In
    When EXISTS
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz WITH (NOLOCK )
    where qz.Mailing = 'Amendment Mailed (3rd Wave)'
    and not exists (select * from dbo.sqs_objector_TINs t WITH (NOLOCK ) where qz.PROV_TIN = t.prov_tin))
    THEN 'Amendment Mailed (3rd Wave)'
    WHEN EXISTS
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz WITH (NOLOCK )
    where qz.Mailing = 'Amendment Mailed (4th Wave)'
    and not exists (select * from dbo.sqs_objector_TINs t WITH (NOLOCK ) where qz.PROV_TIN = t.prov_tin))
    THEN 'Amendment Mailed (4th Wave)'
    -- --Is Puerto Rico of Lifesynch
    WHEN EXISTS
    (SELECT DISTINCT a.PROV_TAX_ID
    FROM PACT.dbo.SQS_NonPar_PR_LS_TINs a WITH (NOLOCK )
    WHERE a.Bucket <> 'Nonpar'
    THEN
    (SELECT DISTINCT a.Bucket
    FROM PACT.dbo.SQS_NonPar_PR_LS_TINs a WITH (NOLOCK )
    WHERE a.PROV_TAX_ID = z.PROV_TAX_ID)
    -- --**Top Objecting Systems**
    WHEN z.SYSTEMNAME IN
    ('ADVENTIST HEALTH SYSTEM','ASCENSION HEALTH ALLIANCE','AULTMAN HEALTH FOUNDATION','BANNER HEALTH SYSTEM','BERT FISH MEDICAL CENTER','BETHESDA MEMORIAL HOSPITAL','BJC HEALTHCARE','BLOUNT MEMORIAL HOSPITAL','BOCA RATON REGIONAL HOSPITAL','CAROMONT HEALTH SYSTEM','CATHOLIC HEALTH INITIATIVES','CATHOLIC HEALTHCARE PARTNERS','CHRISTUS HEALTH',/*'CLEVELAND CLINIC HEALTH SYSTEM',*/'COLUMBUS REGIONAL HEALTHCARE SYSTEM','COMMUNITY HEALTH SYSTEMS, INC','COXHEALTH','HCA','HEALTH MANAGEMENT ASSOCIATES','HUNTSVILLE HOSPITAL HEALTH SYSTEM','INTEGRIS HEALTH','JUPITER MEDICAL CENTER','LEE MEMORIAL HEALTH SYSTEM','MARTIN MEMORIAL HEALTH SYSTEM','MERCY','MT SINAI MEDICAL CENTER (MIAMI)','MUNROE REGIONAL MEDICAL CENTER','NORMAN REGIONAL HEALTH SYSTEM','NORTHSIDE HEALTH SYSTEM','SHANDS HEALTHCARE','SISTERS OF MERCY - SPRINGFIELD, MO','SSM HEALTH CARE','ST LUKES HEALTH SYSTEM','SUMMA HEALTH SYSTEM','SUSQUEHANNA HEALTH SYSTEM','TBD -- TRINITY HEALTH - CATHOLIC HEALTH EAST','UNIVERSITY OF MISSOURI HEALTH SYSTEM','UNIVERSITY OF NEW MEXICO HOSPITALS','UNIVERSITY OF UTAH HEALTH CARE')
    THEN 'Top Objecting Systems'
    WHEN EXISTS
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    INNER JOIN SQS_Provider_Tracking obj WITH (NOLOCK )
    ON h.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Top Objector'
    WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
    OR h.SMG_ID IS NOT NULL
    )and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
    THEN 'Top Objecting Systems'
    -- --**Other Objecting Hospitals**
    WHEN EXISTS
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    INNER JOIN SQS_Provider_Tracking obj WITH (NOLOCK )
    ON h.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Objector'
    WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
    OR h.SMG_ID IS NOT NULL
    )and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
    THEN 'Other Objecting Hospitals'
    -- --**Objecting Physicians**
    WHEN EXISTS
    (SELECT z.PROV_TAX_ID
    FROM SQS_EDW_Source z WITH (NOLOCK)
    WHERE EXISTS
    (SELECT DISTINCT
    obj.TIN
    FROM SQS_Provider_Tracking obj WITH (NOLOCK )
    WHERE obj.[Objector?] in ('Objector','Top Objector')
    and z.PROV_TAX_ID = obj.TIN
    and z.LCLM_RSTMT_TREND_CAT_CD not IN ('HO','HI')
    THEN 'Objecting Physicians'
    --****Rejecting Hospitals****
    WHEN EXISTS
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    INNER JOIN SQS_Provider_Tracking obj WITH (NOLOCK )
    ON h.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Rejector'
    WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
    OR h.SMG_ID IS NOT NULL
    )and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
    THEN 'Rejecting Hospitals'
    --****Rejecting Physciains****
    WHEN EXISTS
    (SELECT obj.TIN
    FROM SQS_Provider_Tracking obj WITH (NOLOCK )
    WHERE z.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Rejector')
    and z.LCLM_RSTMT_TREND_CAT_CD NOT IN ('HO','HI')
    THEN 'REjecting Physicians'
    ----**********ALL OBJECTORS SHOULD HAVE BEEN BUCKETED AT THIS POINT IN THE QUERY**********
    -- --**Non-Objecting Hospitals**
    WHEN EXISTS
    (SELECT DISTINCT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h WITH (NOLOCK )
    WHERE
    (z.PROV_TAX_ID = h.PROV_TAX_ID)
    OR h.SMG_ID IS NOT NULL
    )and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
    THEN 'Non-Objecting Hospitals'
    -- **Outstanding Contracts for Review**
    WHEN EXISTS
    (SELECT qz.PROV_TIN
    FROM
    [PACT].[HUMAD\ARS3766].[SQS_Mailed_TINs] qz WITH (NOLOCK )
    where qz.Mailing = 'Non-Objecting Bilateral Physicians'
    AND z.PROV_TAX_ID = qz.PROV_TIN)
    Then 'Non-Objecting Bilateral Physicians'
    When EXISTS
    (select
    p.prov_tax_id
    from dbo.SQS_CoC_Potential_Mail_List p WITH (NOLOCK )
    where p.amendmentrights <> 'Unilateral'
    AND z.prov_tax_id = p.prov_tax_id)
    THEN 'Non-Objecting Bilateral Physicians'
    WHEN EXISTS
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz WITH (NOLOCK )
    where qz.Mailing = 'More Research Needed'
    AND qz.PROV_TIN = z.PROV_TAX_ID)
    THEN 'More Research Needed'
    WHEN EXISTS (SELECT qz.PROV_TIN FROM [SQS_Mailed_TINs] qz WITH (NOLOCK ) where qz.Mailing = 'Objector' AND qz.PROV_TIN = z.PROV_TAX_ID)
    THEN 'ERROR'
    else 'Market Review/Preparing to Mail'
    END AS [Updated Bucket]
    ,COALESCE(q.INDdesc, f.IND_desc) AS INDdesc
    ,f.Time_Period_for_Dispute
    ,f.Renew_Term_Ind
    ,f.Renewal_Date
    ,z.SMG_ID
    ,'' AS OrderedRank
    INTO SQS_Bucketed_Details_SMG_on_SMGXXX
    From #SQS_EDW_SOURCE_WithSMG z
    left join #F f ON f.PROV_TAX_ID = z.PROV_TAX_ID
    AND z.SYSTEMNAME = f.SYSTEM_NAME
    AND z.PROVIDERNAME = f.Provider
    Left join #Q q ON z.PROV_TAX_ID = q.TIN
    GROUP BY z.SYSTEMNAME
    --,Z.[SubsystemName]
    ,z.PROVIDERNAME
    ,z.STATECODE
    ,z.PROV_TAX_ID
    ,z.SRC_PAR_CD
    ,q.INDdesc
    ,f.IND_Desc
    ,f.Time_Period_for_Dispute
    ,f.Renew_Term_Ind
    ,f.Renewal_Date
    ,z.SMG_ID
    ,z.LCLM_RSTMT_TREND_CAT_CD
    As I am a developer I do not have the access to Sql profiler or tuning agent to optimize my query, I have used some joins over the temp table #HIHO which indeed pulling the records from table EDW_Source which has 5 million records, I also added Non clustered
    indexes on prov_ID, SMG_ID and Incurred month for this table, but still it is taking longer time. Need help

    Hi, It needs some more tweaks but pls try this one
    USE
    Go
    --****Create sqs_objector_TINs (Objections and Rejections)****
    --Drop table .dbo.sqs_objector_TINs
    select distinct a.TIN as Prov_TIN
    Into #sqs_objector_TINs
    from .dbo.sqs_provider_tracking as a with (nolock)
    where a.[Objector?] in ('Top Objector','Objector','Rejector')
    /*********** Query for SQS_TINtoSyst***********/
    --DROP TABLE .dbo.SQS_TINtoSystem
    select distinct
    b.SRC_PROV_ID
    --,case
    -- when a.SYSTEM_NAME is null
    -- then
    -- case
    -- when a.CTRCT_GRP_NAME is null
    -- then a.PROV_SMG_NAME
    -- else a.CTRCT_GRP_NAME
    -- end
    -- else a.SYSTEM_NAME
    --end as SYSTEM_NAME
    ,COALESCE(a.SYSTEM_NAME, a.CTRCT_GRP_NAME, a.PROV_SMG_NAME) AS SYSTEM_NAME
    INTO #SQS_TINtoSystem
    from
    PARE.dbo.EDW_PROD_HOSPITAL_MASTER a with (nolock)
    Inner Join PARE.dbo.EDW_PROD_HOSPITAL_ID_XREF b with (nolock)
    on a.SMG_ID = b.SMG_ID
    -- Inner Join .dbo.SQS_EDW_Source q
    --on b.SRC_PROV_ID = q.PROV_TAX_ID
    where b.SRC_PLATFORM_CD = 'TX'
    and exists
    select
    SMG_ID
    from PARE.dbo.EDW_PROD_HOSPITAL_ID_XREF as t1 with (nolock)
    where SRC_PLATFORM_CD = 'TX'
    and exists (select q.PROV_TAX_ID from .dbo.SQS_EDW_Source q with (nolock) where q.PROV_TAX_ID = b.SRC_PROV_ID)
    and a.SMG_ID = t1.SMG_ID
    /************** Query for SQS_Bucketed_Details_SMG*****************/
    DROP TABLE .dbo.SQS_Bucketed_Details_SMG
    --Create temp table
    SELECT z.SYSTEMNAME
    ,Z.PROV_TAX_ID
    ,z.PROVIDERNAME
    ,z.STATECODE
    ,z.SRC_PAR_CD
    ,z.SEQUEST_AMT
    ,case when Z.LCLM_RSTMT_TREND_CAT_CD IN ('HI','HO') Then 'H' else 'P' end as Hosp_Ind
    ,Z.SMG_ID
    INTO #SQS_EDW_SOURCE_WithSMG
    FROM dbo.SQS_EDW_SOURCE_WithSMG z with (nolock)
    WHERE (Z.Incurred_Mth >= convert(datetime,'01/01/2013')) and (Z.Incurred_Mth < convert(datetime, '1/1/2014'))
    --between convert(datetime,'01/01/2013') and convert(datetime, '12/31/2013 23:59:59.996')
    --YEAR(Z.Incurred_Mth)=2013
    -- Create Temp table Q
    select
    x.TIN,
    case when max(x.IND) = 'NYN'
    then 'Standard'
    when max(x.IND) = 'YNN'
    then 'Express'
    when max(x.IND) = 'NNY'
    then 'Non_Standard' else 'Mixed'
    end as INDdesc
    Into #Q
    FROM
    (SELECT
    a.tin,
    MAX(a.express) + MAX(a.StandardInd) + MAX(NonstandardIND) as IND
    from
    (select r.TIN,
    case when MAX(r.Express) like 'Y%' then 'Y' else 'N' end As Express,
    case when MAX(r.Standard) = 'Y' then 'Y' else 'N' end As StandardInd,
    case when MAX(r.[Non-Standard]) = 'Y' then 'Y' else 'N' end AS NonstandardIND
    FROM DBO.SQS_Objectors_01032014 r with (nolock)
    GROUP BY r.TIN) a
    group by a.TIN) x
    group by x.TIN
    --Create Temp table F
    Select *
    INTO #F
    FROM(
    SELECT distinct g.prov_tax_id
    ,g.system_name
    ,g.provider
    ,case when g.reimburse_mixed = 'Y' then 'Mixed'
    when g.reimburse_express = 'Y' then 'Express'
    when g.reimburse_standard = 'Y' then 'Standard'
    when g.reimburse_NonStandard = 'Y' then 'NonStandard'
    end as IND_Desc
    ,g.Time_Period_for_Dispute
    ,case when g.Renewal_Date = 'N' and g.Expiration_Date = 'N'
    then 'Unclear'
    when g.Renewal_Date = 'N' and g.Expiration_Date <> 'N'
    then 'Termination'
    when g.Renewal_Date <> 'N' and g.Expiration_Date = 'N'
    then 'Evergreen'
    when g.Renewal_Date <> 'N' and g.Expiration_Date <> 'N'
    then 'Termination'
    else 'Unknown'
    end as 'Renew_Term_Ind'
    ,g.Renewal_Date
    FROM
    (select distinct
    bb.PROV_TAX_ID1 as prov_tax_id
    ,aa.*
    from
    [dbo].[Top_600_Hospitals3] aa with (nolock)
    left join pare.dbo.EDW_PROD_HOSPITAL_MASTER bb with (nolock)
    on --a.CTRCT_GRP_NAME = b.CTRCT_GRP_NAME
    aa.Provider = bb.PROV_SMG_NAME
    -- and (a.SYSTEM_NAME = b.SMG_SYS_NAME or a.SYSTEM_NAME = b.SYSTEM_NAME)
    --and a.ADDR_LINE1 = b.ADDR_LINE1
    and aa.STATE_CD = bb.STATE_CD
    --and a.ZIP_CD = b.ZIP_CD
    and aa.City1 = bb.CITY_NAME
    where aa.SYSTEM_NAME <> 'SEE ABOVE') g
    where g.system_name <> 'SEE ABOVE') h
    where h.ind_Desc is not null
    SELECT DISTINCT z.PROV_TAX_ID
    , z.SMG_ID
    INTO #HIHO_Records
    FROM SQS_EDW_SOURCE_WithSMG z with (nolock)
    WHERE z.LCLM_RSTMT_TREND_CAT_CD IN ('HO', 'HI')
    AND Z.Incurred_Mth >=convert(datetime, '1/1/2013') and Z.Incurred_Mth <convert(datetime, '1/1/2014')
    --YEAR(Z.Incurred_Mth)=2013
    ---------------------------------Load Dataset into Temp table---------------
    SELECT
    z.SYSTEMNAME
    --,Case when ZXC.[Subsystem Name] <> 'NULL' Then zxc.[SubSystem Name]
    --else NULL
    --End AS SubSystemName
    , CASE
    WHEN z.PROV_TAX_ID IN
    (SELECT zxc.TIN
    FROM dbo.SQS_Provider_Tracking zxc with (nolock)
    WHERE zxc.[SubSystem Name] <> 'NULL'
    THEN
    (SELECT top 1 [Subsystem Name]
    FROM dbo.SQS_Provider_Tracking zxc with (nolock)
    WHERE z.PROV_TAX_ID = zxc.TIN)
    End As SubSYSTEMNAME
    ,z.PROVIDERNAME
    ,z.STATECODE
    ,z.PROV_TAX_ID
    ,z.SRC_PAR_CD
    ,SUM(z.SEQUEST_AMT) Actual_Sequestered_Amt
    , CASE
    WHEN z.SRC_PAR_CD IN ('E','O','S','W')
    THEN 'Nonpar Waiver'
    -- --Is Puerto Rico of Lifesynch
    WHEN z.PROV_TAX_ID IN
    (SELECT a.PROV_TAX_ID
    FROM .dbo.SQS_NonPar_PR_LS_TINs a with (nolock)
    WHERE a.Bucket <> 'Nonpar'
    THEN
    (SELECT top 1 a.Bucket
    FROM .dbo.SQS_NonPar_PR_LS_TINs a with (nolock)
    WHERE a.PROV_TAX_ID = z.PROV_TAX_ID)
    --**Amendment Mailed**
    WHEN z.PROV_TAX_ID IN
    (SELECT b.PROV_TIN
    FROM dbo.SQS_Mailed_TINs_010614 b WITH (NOLOCK )
    where not exists (select * from dbo.sqs_objector_TINs t with (nolock) where b.PROV_TIN = t.prov_tin))
    and z.Hosp_Ind = 'P'
    THEN
    (SELECT top 1 b.Mailing
    FROM dbo.SQS_Mailed_TINs_010614 b with (nolock)
    WHERE z.PROV_TAX_ID = b.PROV_TIN
    -- --**Amendment Mailed Wave 3-5**
    WHEN z.PROV_TAX_ID In
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz
    where qz.Mailing = 'Amendment Mailed (3rd Wave)'
    and not exists (select * from dbo.sqs_objector_TINs t with (nolock) where qz.PROV_TIN = t.prov_tin))
    and z.Hosp_Ind = 'P'
    THEN 'Amendment Mailed (3rd Wave)'
    WHEN z.PROV_TAX_ID IN
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz
    where qz.Mailing = 'Amendment Mailed (4th Wave)'
    and not exists (select * from dbo.sqs_objector_TINs t with (nolock) where qz.PROV_TIN = t.prov_tin))
    and z.Hosp_Ind = 'P'
    THEN 'Amendment Mailed (4th Wave)'
    WHEN z.PROV_TAX_ID IN
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz
    where qz.Mailing = 'Amendment Mailed (5th Wave)'
    and not exists (select * from dbo.sqs_objector_TINs t with (nolock) where qz.PROV_TIN = t.prov_tin))
    and z.Hosp_Ind = 'P'
    THEN 'Amendment Mailed (5th Wave)'
    -- --**Top Objecting Systems**
    WHEN z.SYSTEMNAME IN
    ('ADVENTIST HEALTH SYSTEM','ASCENSION HEALTH ALLIANCE','AULTMAN HEALTH FOUNDATION')
    THEN 'Top Objecting Systems'
    WHEN z.PROV_TAX_ID IN
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    INNER JOIN .dbo.SQS_Provider_Tracking obj with (nolock)
    ON h.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Top Objector'
    WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
    OR h.SMG_ID IS NOT NULL
    )and z.Hosp_Ind = 'H'
    THEN 'Top Objecting Systems'
    -- --**Other Objecting Hospitals**
    WHEN (z.PROV_TAX_ID IN
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    INNER JOIN .dbo.SQS_Provider_Tracking obj with (nolock)
    ON h.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Objector'
    WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
    OR h.SMG_ID IS NOT NULL
    )and z.Hosp_Ind = 'H')
    THEN 'Other Objecting Hospitals'
    -- --**Objecting Physicians**
    WHEN (z.PROV_TAX_ID IN
    (SELECT
    obj.TIN
    FROM .dbo.SQS_Provider_Tracking obj with (nolock)
    WHERE obj.[Objector?] in ('Objector','Top Objector')
    and z.PROV_TAX_ID = obj.TIN
    and z.Hosp_Ind = 'P')
    THEN 'Objecting Physicians'
    --****Rejecting Hospitals****
    WHEN (z.PROV_TAX_ID IN
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    INNER JOIN .dbo.SQS_Provider_Tracking obj with (nolock)
    ON h.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Rejector'
    WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
    OR h.SMG_ID IS NOT NULL
    )and z.Hosp_Ind = 'H')
    THEN 'Rejecting Hospitals'
    --****Rejecting Physciains****
    WHEN
    (z.PROV_TAX_ID IN
    (SELECT
    obj.TIN
    FROM .dbo.SQS_Provider_Tracking obj with (nolock)
    WHERE z.PROV_TAX_ID = obj.TIN
    AND obj.[Objector?] = 'Rejector')
    and z.Hosp_Ind = 'P')
    THEN 'REjecting Physicians'
    ----**********ALL OBJECTORS SHOULD HAVE BEEN BUCKETED AT THIS POINT IN THE QUERY**********
    -- --**Non-Objecting Hospitals**
    WHEN z.PROV_TAX_ID IN
    (SELECT
    h.PROV_TAX_ID
    FROM
    #HIHO_Records h
    WHERE
    (z.PROV_TAX_ID = h.PROV_TAX_ID)
    OR h.SMG_ID IS NOT NULL)
    and z.Hosp_Ind = 'H'
    THEN 'Non-Objecting Hospitals'
    -- **Outstanding Contracts for Review**
    WHEN z.PROV_TAX_ID IN
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz with (nolock)
    where qz.Mailing = 'Non-Objecting Bilateral Physicians'
    AND z.PROV_TAX_ID = qz.PROV_TIN)
    Then 'Non-Objecting Bilateral Physicians'
    When z.prov_tax_id in
    (select
    p.prov_tax_id
    from dbo.SQS_CoC_Potential_Mail_List p with (nolock)
    where p.amendmentrights <> 'Unilateral'
    AND z.prov_tax_id = p.prov_tax_id)
    THEN 'Non-Objecting Bilateral Physicians'
    WHEN z.PROV_TAX_ID IN
    (SELECT
    qz.PROV_TIN
    FROM
    [SQS_Mailed_TINs] qz
    where qz.Mailing = 'More Research Needed'
    AND qz.PROV_TIN = z.PROV_TAX_ID)
    THEN 'More Research Needed'
    WHEN z.PROV_TAX_ID IN (SELECT qz.PROV_TIN FROM [SQS_Mailed_TINs] qz with (nolock) where qz.Mailing = 'Objector' AND qz.PROV_TIN = z.PROV_TAX_ID)
    THEN 'ERROR'
    else 'Market Review/Preparing to Mail'
    END AS [Updated Bucket]
    ,COALESCE(q.INDdesc, f.IND_desc) AS INDdesc
    ,f.Time_Period_for_Dispute
    ,f.Renew_Term_Ind
    ,f.Renewal_Date
    ,z.SMG_ID
    ,'' AS OrderedRank
    INTO dbo.SQS_Bucketed_Details_SMG with (nolock)
    From #SQS_EDW_SOURCE_WithSMG z
    left join #F f ON f.PROV_TAX_ID = z.PROV_TAX_ID
    AND z.SYSTEMNAME = f.SYSTEM_NAME
    AND z.PROVIDERNAME = f.Provider
    Left join #Q q ON z.PROV_TAX_ID = q.TIN
    GROUP BY z.SYSTEMNAME
    --,Z.[SubsystemName]
    ,z.PROVIDERNAME
    ,z.STATECODE
    ,z.PROV_TAX_ID
    ,z.SRC_PAR_CD
    ,q.INDdesc
    ,f.IND_Desc
    ,f.Time_Period_for_Dispute
    ,f.Renew_Term_Ind
    ,f.Renewal_Date
    ,z.SMG_ID
    ,z.Hosp_Ind
    /************************** Drop temp tables*********************/
    --DROP TABLE #SQS_EDW_SOURCE_WithSMG
    --DROP TABLE #Q
    --DROP TABLE #F
    --DROP TABLE #HIHO_Records
    --DROP TABLE #SQS_TINtoSystem
    --DROP TABLE #SQS_EDW_SOURCE_WithSMG
    --DROP TABLE #sqs_objector_TINs

  • Queries taking long time to run

    Hi BW Folks,
    I am working on virtual cube 0bcs_vc10 for bcs(business consolidation) the base cube is 0bcs_c10. We compressed and partitioned the base cube. The queries which i developed are running fine and are in production.
    Now  when a new req came for some more queries after developing them and running in DEv they are taking 20 to 25 mins to run.
    Suprisingly the queries which are running in production they are also taking long time to run, we havent disturbed the performance tuning process we did earlier .
    Can any one of share their experience in how to tackle this. Will assign full points
    THanks

    Hi Nick,
    Do you have a lot of navigational attributes?  That could be slowing you down.  Also, if it's going too slow, try caching and pre-calculation (pre-loads the cache).  Although I'm not sure if this will work with a Virtual Cube.  By their nature they will be much slower than a physical cube.....so worst case scenario for me would be to load the VC data into a regular cube.  If the query is still slow, then at least you know it's a query issue and not the VC.
    Brian

  • Process Chain taking long time in loading data in infocube

    Dear Expert,
      We are loading data thru PC in AR cube it takes data frm
    PSA-> DSO->Activation->Index Deletion->DTP(load infocube)->IndexCreation->Create Aggregates.
    In Index creation everyday its taking long time around 9 to 10 hrs to create it
    when we go in RSRV and repair the infocube thr loading of data happens fast. We are doing it(RSRV) everyday. In DB02 we have seen dat 96% tablespace is used.
    Please tell permanent solution.
    Please suggest its BI Issue or Basis.
    Regards,
    Ankit

    Hi ,
    We are loading data thru PC in AR cube it takes data frm
    PSA-> DSO->Activation->Index Deletion->DTP(load infocube)->IndexCreation->Create Aggregates.
    In the above steps insted of Create Aggregates it should be Roll up Process of aggregates.
    You can ask the basis team to check the Table space in the transaction db02old/db02.
    Check if there is long running job in SM66/SM50 kill that job.
    check there should be enough Batch process to perform the steps.
    Hope this helps.
    "Assigning points is the ways to say thanks on SDN".
    Br
    Alok

  • Rtf template taking long time to load xml

    Dear All
    rtf template taking long time to load xml and Insert fields. I am using MS office2010. It was working before.
    can any one help me out.
    Regards
    Arifuddin

    Hi;
    Pelase review below which could be helpful for you
    XML Publisher Report Issues, Recommendations and Errors [ID 862644.1]
    Regard
    Helios

  • Crystal reports for Eclipse (CR4E)  - taking long time to load

    HI
    We have used your Crystal reports for Eclipse (CR4E) but it is taking long time to load if the record count is more than 3 million
    Our architecture is we are using Oracle DB and web sphere application server both are running on SUN server,
    If we buy original version it will work fast?
    Or do you  have alternative solution for this, this one to implement one of our major client

    You have 3 million records, this is going to take time to process.  Also, you don't define what is meant by a long time.  Are we talking a couple of minutes, or something more like 20 minutes? 
    The real question is, do you really need the report to bring back 3 million records?  Could you do any filtering of the data to reduce the number of records being brought back?  Also, 3 million records could vary.  is each record a single field, or is it multiple.   The more fields, the larger the result set.
    Another thing you want to look at, is just how long is the query taking to run against the database.

  • Java Applet taking long time to load

    Hi,
    I have a swing based Menu generator Applet. On clicking a Menubar item, I have called a new class [ MyEntry1 my1 = new MyEntry() ], which called one or more utility classes. My main applet (which I have used in <Aplpet> tag in .html file) is very small. But from that, I have called severel classes which are not very small.
    My Problem is, when i am trying to run my applet through IE 5, it is taking long time (180-250 secs.)
    Can anyone give me some tips, how to minimise the loading time? I am using Applet/Servlet/JDBC to develop a web application, which will be used remotely. Using Tomcat server. Any code snippets will be very helpfull for me.
    Thanking all gurus in advance.

    Hope someone can tell me why my Java takes so long to
    load when I go into a online game..I don't think anyone in here can. You could call your local computer repair-shop to have them take a look at your PC.

  • 11.5.10.2 -12.1.1 Upgrade- American English patch driver taking long time

    Hi,
    I have performed test upgrade from 11.5.10.2 to 12.1.1.It was successful.
    The American English Upgrade patch driver had taken 20 hours time to complete.
    Now i am doing a second test run by following the same steps, but now the same patch is taking long time. It is running from past 24 hours.
    And still 54000 jobs to complete.
    The main difference between my two test runs is
    1.For first instance both database and apps are in one server. (single node)
    2.For this new test instance, we have database running one server and 12.1.1 file system on another server.
    Will it make any difference? How can i diagnose the issue?
    The patch log is not showing any errors, but taking long time to complete.
    Thanks,

    Hi,
    From m note 12.1.1 UPGRADE FROM 11.5.10.2 VERY SLOW XDOLOADER TASK HANGS [ID 1065393.1],
    after changing mv /dev/random /dev/random_bak
    ln -s /dev/urandom /dev/random
    do i need to reboot the server?
    After this can i continue the previous session of the patch? or start new session?
    Thanks,

  • Query taking long time for EXTRACTING the data more than 24 hours

    Hi ,
    Query taking long time for EXTRACTING the data more than 24 hours please find the query and explain plan details below even indexes avilable on table's goe's to FULL TABLE SCAN. please suggest me.......
    SQL> explain plan for select a.account_id,round(a.account_balance,2) account_balance,
    2 nvl(ah.invoice_id,ah.adjustment_id) transaction_id,
    to_char(ah.effective_start_date,'DD-MON-YYYY') transaction_date,
    to_char(nvl(i.payment_due_date,
    to_date('30-12-9999','dd-mm-yyyy')),'DD-MON-YYYY')
    due_date, ah.current_balance-ah.previous_balance amount,
    decode(ah.invoice_id,null,'A','I') transaction_type
    3 4 5 6 7 8 from account a,account_history ah,invoice i_+
    where a.account_id=ah.account_id
    and a.account_type_id=1000002
    and round(a.account_balance,2) > 0
    and (ah.invoice_id is not null or ah.adjustment_id is not null)
    and ah.CURRENT_BALANCE > ah.previous_balance
    and ah.invoice_id=i.invoice_id(+)
    AND a.account_balance > 0
    order by a.account_id,ah.effective_start_date desc; 9 10 11 12 13 14 15 16
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 544K| 30M| | 693K (20)|
    | 1 | SORT ORDER BY | | 544K| 30M| 75M| 693K (20)|
    |* 2 | HASH JOIN | | 544K| 30M| | 689K (20)|
    |* 3 | TABLE ACCESS FULL | ACCOUNT | 20080 | 294K| | 6220 (18)|
    |* 4 | HASH JOIN OUTER | | 131M| 5532M| 5155M| 678K (20)|
    |* 5 | TABLE ACCESS FULL| ACCOUNT_HISTORY | 131M| 3646M| | 197K (25)|
    | 6 | TABLE ACCESS FULL| INVOICE | 262M| 3758M| | 306K (18)|
    Predicate Information (identified by operation id):
    2 - access("A"."ACCOUNT_ID"="AH"."ACCOUNT_ID")
    3 - filter("A"."ACCOUNT_TYPE_ID"=1000002 AND "A"."ACCOUNT_BALANCE">0 AND
    ROUND("A"."ACCOUNT_BALANCE",2)>0)
    4 - access("AH"."INVOICE_ID"="I"."INVOICE_ID"(+))
    5 - filter("AH"."CURRENT_BALANCE">"AH"."PREVIOUS_BALANCE" AND ("AH"."INVOICE_ID"
    IS NOT NULL OR "AH"."ADJUSTMENT_ID" IS NOT NULL))
    22 rows selected.
    Index Details:+_
    SQL> select INDEX_OWNER,INDEX_NAME,COLUMN_NAME,TABLE_NAME from dba_ind_columns where
    2 table_name in ('INVOICE','ACCOUNT','ACCOUNT_HISTORY') order by 4;
    INDEX_OWNER INDEX_NAME COLUMN_NAME TABLE_NAME
    OPS$SVM_SRV4 P_ACCOUNT ACCOUNT_ID ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT_NAME ACCOUNT_NAME ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT CUSTOMER_NODE_ID ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT ACCOUNT_TYPE_ID ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_ACCOUNT_TYPE ACCOUNT_TYPE_ID ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_INVOICE INVOICE_ID ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_PREVIOUS_INVOICE PREVIOUS_INVOICE_ID ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT_NAME_ID ACCOUNT_NAME ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT_NAME_ID ACCOUNT_ID ACCOUNT
    OPS$SVM_SRV4 I_LAST_MODIFIED_ACCOUNT LAST_MODIFIED ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_INVOICE_ACCOUNT INVOICE_ACCOUNT_ID ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ACCOUNT ACCOUNT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ACCOUNT SEQNR ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_INVOICE INVOICE_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADINV INVOICE_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA CURRENT_BALANCE ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA INVOICE_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA ADJUSTMENT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA ACCOUNT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_LMOD LAST_MODIFIED ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADINV ADJUSTMENT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_PAYMENT PAYMENT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADJUSTMENT ADJUSTMENT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_APPLIED_DT APPLIED_DATE ACCOUNT_HISTORY
    OPS$SVM_SRV4 P_INVOICE INVOICE_ID INVOICE
    OPS$SVM_SRV4 U_INVOICE CUSTOMER_INVOICE_STR INVOICE
    OPS$SVM_SRV4 I_LAST_MODIFIED_INVOICE LAST_MODIFIED INVOICE
    OPS$SVM_SRV4 U_INVOICE_ACCOUNT ACCOUNT_ID INVOICE
    OPS$SVM_SRV4 U_INVOICE_ACCOUNT BILL_RUN_ID INVOICE
    OPS$SVM_SRV4 I_INVOICE_BILL_RUN BILL_RUN_ID INVOICE
    OPS$SVM_SRV4 I_INVOICE_INVOICE_TYPE INVOICE_TYPE_ID INVOICE
    OPS$SVM_SRV4 I_INVOICE_CUSTOMER_NODE CUSTOMER_NODE_ID INVOICE
    32 rows selected.
    Regards,
    Bathula
    Oracle-DBA

    I have some suggestions. But first, you realize that you have some redundant indexes, right? You have an index on account(account_name) and also account(account_name, account_id), and also account_history(invoice_id) and account_history(invoice_id, adjustment_id). No matter, I will suggest some new composite indexes.
    Also, you do not need two lines for these conditions:
    and round(a.account_balance, 2) > 0
    AND a.account_balance > 0
    You can just use: and a.account_balance >= 0.005
    So the formatted query isselect a.account_id,
           round(a.account_balance, 2) account_balance,
           nvl(ah.invoice_id, ah.adjustment_id) transaction_id,
           to_char(ah.effective_start_date, 'DD-MON-YYYY') transaction_date,
           to_char(nvl(i.payment_due_date, to_date('30-12-9999', 'dd-mm-yyyy')),
                   'DD-MON-YYYY') due_date,
           ah.current_balance - ah.previous_balance amount,
           decode(ah.invoice_id, null, 'A', 'I') transaction_type
      from account a, account_history ah, invoice i
    where a.account_id = ah.account_id
       and a.account_type_id = 1000002
       and (ah.invoice_id is not null or ah.adjustment_id is not null)
       and ah.CURRENT_BALANCE > ah.previous_balance
       and ah.invoice_id = i.invoice_id(+)
       AND a.account_balance >= .005
    order by a.account_id, ah.effective_start_date desc;You will probably want to select:
    1. From ACCOUNT first (your smaller table), for which you supply a literal on account_type_id. That should limit the accounts retrieved from ACCOUNT_HISTORY
    2. From ACCOUNT_HISTORY. We want to limit the records as much as possible on this table because of the outer join.
    3. INVOICE we want to access last because it seems to be least restricted, it is the biggest, and it has the outer join condition so it will manufacture rows to match as many rows as come back from account_history.
    Try the query above after creating the following composite indexes. The order of the columns is important:create index account_composite_i on account(account_type_id, account_balance, account_id);
    create index acct_history_comp_i on account_history(account_id, invoice_id, adjustment_id, current_balance, previous_balance, effective_start_date);
    create index invoice_composite_i on invoice(invoice_id, payment_due_date);All the columns used in the where clause will be indexed, in a logical order suited to the needs of the query. Plus each selected column is indexed as well so that we should not need to touch the tables at all to satisfy the query.
    Try the query after creating these indexes.
    A final suggestion is to try larger sort and hash area sizes and a manual workarea policy.alter session set workarea_size_policy = manual;
    alter session set sort_area_size = 2147483647;
    alter session set hash_area_size = 2147483647;

  • CDHDR table query taking long time

    Hi all,
    Select query from CDHDR table is taking long time,in where condition i am giving OBJECTCLASS = 'MAT_FULL' udate = sy-datum and langu = 'EN'.
    any suggestion to improve the performance.i want to select all the article which got changed on current date
    regards
    shibu

    This will always be slow for large data volumes, since CDHDR is designed for quick access by object ID (in this case material number), not by date.
    I'm afraid you would need to introduce a secondary index on OBJECTCLAS and UDATE, if that query is crucial enough to warrant the additional disk space and processing time taken by the new index.
    Greetings
    Thomas

  • Nested joins taking long time

    Hi Experts,
    Select query is taking long time execution.
    *- Get the Goods receipts  mainly selected per period (=> MKPF secondary
      SELECT mseg~ebeln mseg~ebelp mseg~werks
             ekko~bukrs ekko~lifnr ekko~zterm ekko~ekorg ekko~ekgrp
             ekko~inco1 ekko~exnum
             lfa1~name1 lfa1~land1 lfa1~ktokk lfa1~stceg
             mkpf~mblnr mkpf~mjahr mseg~zeile mkpf~bldat mkpf~budat
             mseg~bwart
    *Start of changes for CIP 6203752 by PGOX02
             mseg~smbln
    *End of changes for CIP 6203752 by PGOX02
             ekpo~matnr ekpo~txz01 ekpo~menge ekpo~meins
             ekbe~menge ekbe~dmbtr ekbe~wrbtr ekbe~waers
             ekpo~lgort ekpo~matkl ekpo~webaz ekpo~konnr ekpo~ktpnr
             ekpo~plifz ekpo~bstae
             INTO corresponding fields of TABLE it_temp
    *--Begin of modification
    *    FROM mkpf JOIN mseg ON mseg~mblnr EQ mkpf~mblnr
         FROM mkpf INNER JOIN mseg ON mseg~mandt EQ mkpf~mandt
                           and  mseg~mblnr EQ mkpf~mblnr
    *--End of modification
                           AND mseg~mjahr EQ mkpf~mjahr
                  JOIN ekbe ON ekbe~ebeln EQ mseg~ebeln
                           AND ekbe~ebelp EQ mseg~ebelp
                           AND ekbe~zekkn EQ '00'
                           AND ekbe~vgabe EQ '1'
                           AND ekbe~gjahr EQ mseg~mjahr
                           AND ekbe~belnr EQ mseg~mblnr
                           AND ekbe~buzei EQ mseg~zeile
                  JOIN ekpo ON ekpo~ebeln EQ ekbe~ebeln
                           AND ekpo~ebelp EQ ekbe~ebelp
                  JOIN ekko ON ekko~ebeln EQ ekpo~ebeln
                  JOIN lfa1 ON lfa1~lifnr EQ ekko~lifnr
              WHERE mkpf~budat IN so_budat
          AND mkpf~bldat IN so_bldat
          AND mkpf~vgart EQ 'WE'
          AND mseg~bwart IN so_bwart
          AND mseg~matnr IN so_matnr
          AND mseg~werks IN so_werks
          AND mseg~lifnr IN so_lifnr
          AND mseg~ebeln IN so_ebeln
          AND ekko~ekgrp IN so_ekgrp
          AND ekko~bukrs IN so_bukrs
          AND ekpo~matkl IN so_matkl
          AND ekko~bstyp IN so_bstyp
          AND ekpo~loekz EQ space
          AND ekpo~plifz IN so_plifz.
    in st05 it is showing MKPF is taking more time. Need ur sugesstions need ur help
    Moderator message - Please use code tags to format your code
    Edited by: Rob Burbank on Feb 5, 2010 9:21 AM

    Hi,
    your result set is quite big.
    20296 records in 283,5 seconds (13,9 ms per record) might not be optimal
    but definatelly the big result set will take time to execute, since you are reading data from 6 tables:
    SELECT
    FROM mkpf
    JOIN mseg ON u2026
    JOIN ekbe ON u2026
    JOIN ekpo ON u2026
    JOIN ekko ON u2026
    JOIN lfa1 ON u2026
    what run time do you expect?
    In case we would be able to get one record in 5ms it will still run more than 100 seconds.
    Generally: Limit the result set as far as possible (with where conditions), select only the columns that are really needed.
    Geneal nested loop join optimization:
    check if the optimizer chooses the table that has the smallest result set (take all where conditions for each table
    and use SE16 to count the result sets, the smallest one should be the start for the nested loop join.
    For the starting table the selective where condition fields (those the limit the result set significantly for that table) should be indexed.
    For other tables the join condition (and maybe additional selecitve where conditions for this table) should be indexed. but most likely you will join to the tables using the primary key which is indexed... .
    Kind regards,
    Hermann

  • We are running a report ? it is  taking long time for  execution. what step

    we are running a report ? it is  taking long time for  execution. what steps will we do to reduce the execution time?

    Hi ,
    the performance can be improved thru many ways..
    First try to select based on the key fields if it is a very large table.
    if not then create a Secondary index for selection.
    dont perform selects inside a loop , instead do FOR ALL ENTRIES IN
    try to perform may operations in one loop rather than calling different loops on the same internal table..
    All these above and many more steps can be implemented to improve the performance.
    Need to look into your code, how it can be improved in your case...
    Regards,
    Vivek Shah

Maybe you are looking for

  • How do I download pictures from a Canon 5D Mark III to my Mac mini (mid 2010)

    Got a Canon 5D Mark III and I was wondering how I'm going to download the pictures to my Mac mini (mid 2010).  Would I need any special software and a card reader?  Saw a 3.0 USB card reader for sale but didn't think that would work on my Mac mini. 

  • Run Process Chain Manually

    Hi Experts I have about 10 ODS's for which data is being extracted from R/3. The user may or may not make changes to the data in R/3. Client does not want to click on 10 different start button of infopackages. Client doesnt want a full upload daily s

  • Quicktime loss of quality in web browsers?

    Hello. I'm trying to upload a 30M MOV file to my website. I noticed that there's a loss of quality when the movie plays in a web browser as opposed to just playing it in the Quicktime player outside of the website. Is there something I need to add to

  • Customizable appearance for muse forms

    can you add the ability to customize the look and feel of muse forms as right now they can only be transparent so site on top of whatever background colour you have whereas it would be nice to see text colour background colouron the form and  text an

  • Adobe photoshop 11 freezes on startup

    when I start up adobe photoshop 11, the screen freezes on "initializing model ...".  the only way I know to fix the freeze problem is to reboot my computer. Later on, I may need to do this workaround again.  this workaround is very aggrevating.  what