Taking long time to execute views

Hi All,
my query is taking long time to execute(i am using standard views in my query)
XLA_INV_AEL_GL_V , XLA_WIP_AEL_GL_V -----these standard views itself taking long time to execute ,but i need the info from this views
WHERE gjh.je_batch_id = gjb.je_batch_id AND
gjh.je_header_id = gjl.je_header_id AND
gjh.je_header_id = xlawip.je_header_id AND
gjl.je_header_id = xlawip.je_header_id AND
gjl.je_line_num = xlawip.je_line_num AND
gcc.code_combination_id = gjl.code_combination_id AND
gjl.code_combination_id = xlawip.code_combination_id AND
gjb.set_of_books_id = xlawip.set_of_books_id AND
gjh.je_source = 'Inventory' AND
gjh.je_category = 'WIP' AND
gp.period_set_name = 'Accounting' AND
gp.period_name = gjl.period_name AND
gp.period_name = gjh.period_name AND
gp.start_date +1 between to_date(startdate,'DD-MON-YY') AND
to_date(enddate,'DD-MON-YY') AND
gjh.status =nvl(lstatus,gjh.status)
Could any one help me to execute it fast?
Thanks
Madhu

[url http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=0]When your query takes too long...

Similar Messages

  • Query is taking long time to execute after migrating to 10g r2

    Hi
    We recently migrated the database from 9i to 10gr2 ((10.2.0.2.0).. This query was running in acceptable time before the upgrade in 9i.. Now it is taking a long long time to execute this... Can you please let me know what should i do to improve the performance now.. We are running stats everyday..
    Thanks for your help,
    Shree
    ======================================================================================
    SELECT cr.cash_receipt_id
    ,cr.pay_from_customer
    ,cr.receipt_number
    ,cr.receipt_date
    ,cr.amount
    ,cust.account_number
    ,crh.gl_date
    ,cr.set_of_books_id
    ,sum(ra.amount_applied) amount_applied
    FROM AR_CASH_RECEIPTS_ALL cr
    ,AR_RECEIVABLE_APPLICATIONS_ALL ra
    ,hz_cust_accounts cust
    ,AR_CASH_RECEIPT_HISTORY_ALL crh
    ,GL_PERIOD_STATUSES gps
    ,FND_APPLICATION app
    WHERE cr.cash_receipt_id = ra.cash_receipt_id
    AND ra.status = 'UNAPP'
    AND cr.status <> 'REV'
    AND cust.cust_account_id = cr.pay_from_customer
    AND substr(cust.account_number,1,2) <> 'SI' -- Don't allocate Unapplied receipts FOR SI customers
    AND crh.cash_receipt_id = cr.cash_receipt_id
    AND app.application_id = gps.application_id
    AND app.application_short_name = 'AR'
    AND gps.period_name = 'May-07'
    AND crh.gl_date <= gps.end_date
    AND cr.receipt_number not like 'WH%'
    -- AND cust.customer_number = '0000079260001'
    GROUP BY cr.cash_receipt_id
    ,cr.pay_from_customer
    ,cr.receipt_number
    ,cr.receipt_date
    ,cr.amount
    ,cust.account_number
    ,crh.gl_date
    ,cr.set_of_books_id
    HAVING sum(ra.amount_applied) > 0;
    =========================================================================================
    Here is the explain plan in 10g r2 (10.2.0.2.0)
    PLAN_TABLE_OUTPUT
    Plan hash value: 2617075047
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 92340 | 10M| | 513K (1)|
    |* 1 | FILTER | | | | | |
    | 2 | HASH GROUP BY | | 92340 | 10M| 35M| 513K (1)|
    | 3 | TABLE ACCESS BY INDEX ROWID | AR_RECEIVABLE_APPLICATIONS_ALL | 2 | 34 |
    | 4 | NESTED LOOPS | | 184K| 21M| | 510K (1)|
    |* 5 | HASH JOIN | | 99281 | 9M| 3296K| 176K (1)|
    |* 6 | TABLE ACCESS FULL | HZ_CUST_ACCOUNTS | 112K| 1976K| | 22563 (1)|
    |* 7 | HASH JOIN | | 412K| 33M| 25M| 151K (1)|
    | 8 | TABLE ACCESS BY INDEX ROWID | AR_CASH_RECEIPT_HISTORY_ALL | 332K| 4546K|
    | 9 | NESTED LOOPS | | 498K| 19M| | 26891 (1)|
    | 10 | NESTED LOOPS | | 2 | 54 | | 4 (0)|
    | 11 | TABLE ACCESS BY INDEX ROWID| FND_APPLICATION | 1 | 8 | | 1 (0)|
    |* 12 | INDEX UNIQUE SCAN | FND_APPLICATION_U3 | 1 | | | 0 (0)|
    | 13 | TABLE ACCESS BY INDEX ROWID| GL_PERIOD_STATUSES | 2 | 38 | | 3 (0)
    |* 14 | INDEX RANGE SCAN | GL_PERIOD_STATUSES_U1 | 1 | | | 2 (0)|
    |* 15 | INDEX RANGE SCAN | AR_CASH_RECEIPT_HISTORY_N2 | 332K| | | 1011 (1)
    PLAN_TABLE_OUTPUT
    |* 16 | TABLE ACCESS FULL | AR_CASH_RECEIPTS_ALL | 5492K| 235M| | 108K
    |* 17 | INDEX RANGE SCAN | AR_RECEIVABLE_APPLICATIONS_N1 | 4 | | | 2
    Predicate Information (identified by operation id):
    1 - filter(SUM("RA"."AMOUNT_APPLIED")>0)
    5 - access("CUST"."CUST_ACCOUNT_ID"="CR"."PAY_FROM_CUSTOMER")
    6 - filter(SUBSTR("CUST"."ACCOUNT_NUMBER",1,2)<>'SI')
    7 - access("CRH"."CASH_RECEIPT_ID"="CR"."CASH_RECEIPT_ID")
    12 - access("APP"."APPLICATION_SHORT_NAME"='AR')
    14 - access("APP"."APPLICATION_ID"="GPS"."APPLICATION_ID" AND "GPS"."PERIOD_NAME"='May-07')
    filter("GPS"."PERIOD_NAME"='May-07')
    15 - access("CRH"."GL_DATE"<="GPS"."END_DATE")
    16 - filter("CR"."STATUS"<>'REV' AND "CR"."RECEIPT_NUMBER" NOT LIKE 'WH%')
    17 - access("CR"."CASH_RECEIPT_ID"="RA"."CASH_RECEIPT_ID" AND "RA"."STATUS"='UNAPP')
    filter("RA"."CASH_RECEIPT_ID" IS NOT NULL)
    Here is the explain plan in 9i
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=445977 Card=78530 By
    tes=9423600)
    1 0 FILTER
    2 1 SORT (GROUP BY) (Cost=445977 Card=78530 Bytes=9423600)
    3 2 HASH JOIN (Cost=443717 Card=157060 Bytes=18847200)
    4 3 HASH JOIN (Cost=99563 Card=94747 Bytes=9758941)
    5 4 TABLE ACCESS (FULL) OF 'HZ_CUST_ACCOUNTS' (Cost=12
    286 Card=110061 Bytes=1981098)
    6 4 HASH JOIN (Cost=86232 Card=674761 Bytes=57354685)
    7 6 TABLE ACCESS (BY INDEX ROWID) OF 'AR_CASH_RECEIP
    T_HISTORY_ALL' (Cost=17532 Card=542304 Bytes=7592256)
    8 7 NESTED LOOPS (Cost=17536 Card=809791 Bytes=332
    01431)
    9 8 NESTED LOOPS (Cost=4 Card=1 Bytes=27)
    10 9 TABLE ACCESS (BY INDEX ROWID) OF 'FND_APPL
    ICATION' (Cost=1 Card=1 Bytes=8)
    11 10 INDEX (UNIQUE SCAN) OF 'FND_APPLICATION_
    U3' (UNIQUE)
    12 9 TABLE ACCESS (BY INDEX ROWID) OF 'GL_PERIO
    D_STATUSES' (Cost=3 Card=1 Bytes=19)
    13 12 INDEX (RANGE SCAN) OF 'GL_PERIOD_STATUSE
    S_U1' (UNIQUE) (Cost=2 Card=1)
    14 8 INDEX (RANGE SCAN) OF 'AR_CASH_RECEIPT_HISTO
    RY_N2' (NON-UNIQUE) (Cost=1740 Card=542304)
    15 6 TABLE ACCESS (FULL) OF 'AR_CASH_RECEIPTS_ALL' (C
    ost=60412 Card=8969141 Bytes=394642204)
    16 3 TABLE ACCESS (FULL) OF 'AR_RECEIVABLE_APPLICATIONS_A
    LL' (Cost=337109 Card=15613237 Bytes=265425029)

    Hi,
    The plan between 9i and 10g is pretty the same but the amount of data fetched has considerably increased. I guess the query was performing slow even in 9i.
    The AR_CASH_RECEIPT_HISTORY_ALL is presently having 332000 rows in 10g where as it was 17532 in 9i.
    AR_CASH_RECEIPT_HISTORY_N2 is now having 332,000 rows in 10g where as in 9i it had 1,740
    Try creating some indexes on
    AR_CASH_RECEIPTS_ALL
    hz_cust_accounts

  • Function taking longer time to execute

    Hi,
    I have a scenario where i am using a TABLE FUNCTION in a join con condition with a Normal TABLE but its getting longer time to execute:
    The function is given below:
    CREATE OR REPLACE FUNCTION GET_ACCOUNT_TYPE(
    SUBNO VARCHAR2 DEFAULT NULL
    RETURN ACCOUNT_TYP_KEY_1 PIPELINED AS
    V_SUBNO VARCHAR2(20);
    V_SUBS_TYP VARCHAR2(10);
    V_ACCOUNT_TYP_KEY VARCHAR2(10);
    V_ACCOUNT_TYP_KEY_1 VARCHAR2(10);
    V_SUBS_TYP_KEY_1 VARCHAR2(10);
    V_VAL1 VARCHAR2(255);
    CURSOR C1_REC2 IS SELECT SUBNO,NULL
    FROM CTVA_ETL.RA_CRM_USER_INFO
    GROUP BY SUBNO,SUBSCR_TYPE;
    --CURSOR C1_REC IS SELECT SUBNO,SUBSCR_TYPE,ACCOUNT_TYPE_KEY
    --FROM CTVA_ETL.RA_CRM_USER_INFO,DIM_RA_MAST_ACCOUNT_TYPE
    --WHERE ACCOUNT_TYPE_KEY=RA_CRM_USER_INFO.SUBSCR_TYPE
    --WHERE MSISDN='8615025400109'
    --WHERE MSISDN IN ('8615025400068','8615025400083','8615025400101','8615025400132','8615025400109')
    CURSOR C1_REC IS SELECT SUBNO,SUBSCR_TYPE--,ACCOUNT_TYPE_KEY
    FROM CTVA_ETL.RA_CRM_USER_INFO
    GROUP BY SUBNO,SUBSCR_TYPE;
    BEGIN
    OPEN C1_REC;
    LOOP
    FETCH C1_REC INTO V_SUBNO ,V_SUBS_TYP;
    IF V_SUBS_TYP IS NOT NULL THEN
    BEGIN
    SELECT
    ACCOUNT_TYPE_KEY
    INTO
    V_ACCOUNT_TYP_KEY
    FROM
    DIM_RA_MAST_ACCOUNT_TYPE,
    RA_CRM_USER_INFO
    WHERE
    ACCOUNT_TYPE_KEY=V_SUBS_TYP
    AND ACCOUNT_TYPE_KEY=RA_CRM_USER_INFO.SUBSCR_TYPE
    AND SUBNO=V_SUBNO;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    V_ACCOUNT_TYP_KEY := '-99';
    V_ACCOUNT_TYP_KEY_1 := V_ACCOUNT_TYP_KEY;
    END;
    ELSE
    V_ACCOUNT_TYP_KEY_1:='-99';
    END IF;
    FOR CUR IN (select
    DISTINCT V_SUBNO SUBNO_TYP_2 ,V_ACCOUNT_TYP_KEY_1 ACCOUNT_TYP
    from dual)
    LOOP
    PIPE ROW (ACCOUNT_TYP_KEY(CUR.SUBNO_TYP_2,CUR.ACCOUNT_TYP));
    END LOOP;
    END LOOP;
    RETURN;
    CLOSE C1_REC;
    END;
    The above function wil return rows with respect to SUBSCRIBER TYPE (if Not Null then it will return the ACCOUNT KEY and SUBNO else '-99').
    But its not returning any rows so all the rows will come as
    SUBNO ACCOUNT_TYP
    21 -99
    22 -99
    23 -99
    24 -99
    25 -99
    Thanks and Regards

    Hi LMLobo,
    In addition to Sebastian’s answer, you can refer to the document
    Server Memory Server Configuration Options to check whether the maximum server memory setting of the SQL Server is changed on the new server. Besides, you can also compare the
    network packet size setting of the SQL Server as well as the network connectivity on both servers. Besides, you can refer to the following link to troubleshooting SSIS package performance
    issue:
    http://technet.microsoft.com/en-us/library/dd795223(v=sql.100).aspx.
    Regards,
    Mike Yin
    TechNet Community Support

  • In MM02 taking long time to open views

    Hi,
       In MM02 I had taken the material T-BBD09,and select views i selected Basic Data1 and executed its taking very long time to open its going to time out after 1 hr,how to rectify the same to open.
    Thanku

    HI,
             In MM02 I had taken the material T-BBD09,and select views i selected Basic Data1 and executed its taking very long time to open its going to time out after 1 hr,how to rectify the same to open.
    Remaining all tr.codes working fine in my server,any inputs for the same.
    Thanku

  • Reports taking long time to execute

    Hi,
    There are few reports on SSRS which are taking almost 6-8 minutes to complete and display the data.
    I am using Oracle database as source.
    When I checked the query performance, what I found that main data set is taking almost 2-3 minutes to execute on Sql developer. Also there are two parameters which are taking almost 1-1 minute to execute.
    When I run the report without these two parameters, report execution time is reduced by more than 3 minutes.
    Also I am using 3-4 groupings in the report and 6 columns are aggregated at each grouping.
    Reports are tabular reports and contains header, footers and 2-3 text boxes to display parameter values.
    Can you please provide me some ways to optimize the queries and reduce the time taken by report to complete.

    Hi sudipta,
    According to your description, it takes too long to render the report when accessing it. Right?
    In this scenario, it can be many possibilities which will reduce the report performance. We suggest you check the report on ReportServer first. Go to the ReportServer ExecutionLog to see which part takes more time.
    Then we need to do some troubleshooting to improve the report performance. Here we have a article for your reference:
    Troubleshooting Reports: Report Performance
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Script is taking long time to execute

    Hi:
    This is the query I am executing, this takes a lot of time, how can I use temp tables to make this work fast:
    There are only about 6000 records but even then taking lot of time
    SET NOCOUNT ON
     DECLARE @SName VARCHAR(40), @ContactNo varchar(11), @Code VARCHAR(20), @EMail VARCHAR(40),@CodeId int
    DECLARE C1 CURSOR
     STATIC FOR SELECT [Staff Name],[Contact No],[Code],[EMail ID] FROM AB
     OPEN C1
      IF @@CURSOR_ROWS > 0
       FETCH NEXT FROM C1 INTO @SName,@ContactNo,@Code,@EMail
       WHILE @@Fetch_status = 0
       BEGIN
        IF EXISTS (SELECT * FROM AddressBook WHERE 
    Name=@SName)
         BEGIN
          UPDATE AddressBook
          SET MobileNo=@ContactNo,
    EMailId=@EMail
          WHERE Name=@SName
         END
        ELSE
         BEGIN
          INSERT INTO AddressBook
          VALUES(@SName,'',@ContactNo,@EMail,'',GETDATE(),GETDATE(),'','A',8,NULL,NULL)
         END
       END
     CLOSE C1
     DEALLOCATE C1
     SET NOCOUNT OFF

    Instead of cursor have you tried to look at MERGE command?
    IF OBJECT_ID('t1') IS NOT NULL
        DROP TABLE t1 
    GO
    CREATE TABLE t1 (id INT PRIMARY KEY, name1 VARCHAR(10))
    INSERT INTO t1
    SELECT 1, 'name 1' UNION ALL
    SELECT 2, 'name 2' UNION ALL
    SELECT 3, 'name 3' UNION ALL
    SELECT 4, 'name 4' UNION ALL
    SELECT 5, 'name 5'
    GO 
    DECLARE @id INT = 6, @name1 VARCHAR(10) = 'name 6'
    MERGE t1
    USING (SELECT @id AS id, @name1 AS name1) AS t2 ON t1.id = t2.id
    WHEN MATCHED
        THEN UPDATE SET t1.name1 = t2.name1
    WHEN NOT MATCHED
        THEN INSERT VALUES(@id, @name1 );
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Stopping a Query taking more time to execute in runtime in Oracle Forms.

    Hi,
    In the present application one of the oracle form screen is taking long time to execute a query, user wanted an option to stop the query in between and browse the result (whatever has been fetched before stopping the query).
    We have tried three approach.
    1. set max fetch record in form and block level.
    2. set max fetch time in form and block level.
    in above two method does not provide the appropiate solution for us.
    3. the third approach we applied is setting the interaction mode to "NON BLOCKING" at the form level.
    It seems to be worked, while the query took long time to execute, oracle app server prompts an message to press Esc to cancel the query and it a displaying the results fetched upto that point.
    But the drawback is one pressing esc, its killing the session itself. which is causing the entire application to collapse.
    Please suggest if there is any alternative approach for this or how to overcome this perticular scenario.
    This kind of facility is alreday present in TOAD and PL/SQL developer where we can stop an executing query and browse the results fetched upto that point, is the similar facility is avialable in oracle forms ,please suggest.
    Thanks and Regards,
    Suraj
    Edited by: user10673131 on Jun 25, 2009 4:55 AM

    Hello Friend,
    You query will definitely take more time or even fail in PROD,becuase the way it is written. Here are my few observations, may be it can help :-
    1. XLA_AR_INV_AEL_SL_V XLA_AEL_SL_V : Never use a view inside such a long query , becuase View is just a window to the records.
    and when used to join other table records, then all those tables which are used to create a view also becomes part of joining conition.
    First of all please check if you really need this view. I guess you are using to check if the records have been created as Journal entries or not ?
    Please check the possbility of finding it through other AR tables.
    2. Remove _ALL tables instead use the corresponding org specific views (if you are in 11i ) or the sysnonymns ( in R12 )
    For example : For ra_cust_trx_types_all use ra_cust_trx_types.
    This will ensure that the query will execute only for those ORG_IDs which are assigned to that responsibility.
    3. Check with the DBA whether the GATHER SCHEMA STATS have been run atleast for ONT and RA tables.
    You can also check the same using
    SELECT LAST_ANALYZED FROM ALL_TABLES WHERE TABLE_NAME = 'ra_customer_trx_all'.
    If the tables are not analyzed , the CBO will not be able to tune your query.
    4. Try to remove the DISTINCT keyword. This is the MAJOR reason for this problem.
    5. If its a report , try to separate the logic in separate queries ( using a procedure ) and then populate the whole data in custom table, and use this custom table for generating the
    report.
    Thanks,
    Neeraj Shrivastava
    [email protected]
    Edited by: user9352949 on Oct 1, 2010 8:02 PM
    Edited by: user9352949 on Oct 1, 2010 8:03 PM

  • F4 Help is taking long time

    Hi All,
    We are working on BI 7.0. version
    In the varaible pop-up screen we have two info objects.
    1. Fiscal year Period
    2. JOA(Joint operating aggriment)
    If u press F4 for JOA, it is taking long time to execute and finally the application is getting closed.same situation is there in RSRT also.
    If i enter with out JOA the query is giving the output. Here i have to restrict the query by JOA.
    i have changed the JOA peroperties in query designer.
    Query execution for filter value selection = Values in master data table.......
    but still the situation is the same.......
    Could you please suggest any solution for this.....
    Thanks & Regards,
    PK

    Hi Kamal,
    You can set that at the query level in the query designer for each query.
    1. Select the corresponding characteristic in the query designer.
    2. Goto to the "Extended tab" in the properties
    3. Select the "Values in the Master data table" in the "Query execution in the filter value selection.
    Also see some recomendations:
    Note 748623 - Input help (F4) has a very long runtime - recommendations
    Hope this helps.
    CK

  • Identifying which part of stored procedure is taking long time

    Hi Everyone,
    I have a stored procedure which is taking long time to execute.  I am trying to understand which part/query in the stored procedure is taking long time.
    It involves lots of table variables and n no of queries .Could anyone please help me in how to identify which query/part of the stored procedure is taking long time to execute?
    Thanks in Advance

    Hi Vivek -
    I am only familiar with running the plan visualization for a single SQL query.
    Could you please guide me how to run it for a procedure.
    Thanks in Advance.

  • Performance tunned report taking more time to execute - URGENT

    Dear Experts,
    In One Report Program is Taking long time to execute at background session, I am Taking That Report To Tune The Performance But This is taking 12 hours more to excute .........
    The Code is given below.
    Before Tune.
    DATA  :  BEGIN OF ITAB OCCURS 0,
            LGOBE    LIKE T001L-LGOBE,
            105DT    LIKE MKPF-BUDAT,
            XBLNR    LIKE MKPF-XBLNR,
            BEDAT    LIKE EKKO-BEDAT,
            LIFNR    LIKE EKKO-LIFNR,
            NAME1    LIKE LFA1-NAME1,
            EKKO     LIKE EKKO-BEDAT,
            BISMT    LIKE MARA-BISMT,
            MAKTX    LIKE MAKT-MAKTX,
            NETPR    LIKE EKPO-NETPR,
            PEINH    LIKE EKPO-PEINH,
            VALUE    TYPE P DECIMALS 2,
            DISPO    LIKE MARC-DISPO,
            DSNAM    LIKE T024D-DSNAM,
            AGE      TYPE P DECIMALS 0,
            PARLIFNR LIKE EKKO-LIFNR,
            PARNAME1 LIKE LFA1-NAME1,
             MBLNR    LIKE MSEG-MBLNR,
             MJAHR    LIKE MSEG-MJAHR,
             ZEILE    LIKE MSEG-ZEILE,
             BWART    LIKE MSEG-BWART,
             MATNR    LIKE MSEG-MATNR,
             WERKS    LIKE MSEG-WERKS,
             LIFNR    LIKE MSEG-LIFNR,
             MENGE    LIKE MSEG-MENGE,
             MEINS    LIKE MSEG-MEINS,
             EBELN    LIKE MSEG-EBELN,
             EBELP    LIKE MSEG-EBELP,
             LGORT    LIKE MSEG-LGORT,
             SMBLN    LIKE MSEG-SMBLN,
             BUKRS    LIKE MSEG-BUKRS,
             GSBER    LIKE MSEG-GSBER,
             INSMK    LIKE MSEG-INSMK,
             XAUTO    LIKE MSEG-XAUTO,
             END OF ITAB.
    SELECT MBLNR MJAHR ZEILE BWART MATNR WERKS LIFNR MENGE MEINS
             EBELN EBELP LGORT SMBLN BUKRS GSBER INSMK XAUTO
             FROM MSEG
             INTO CORRESPONDING FIELDS OF TABLE ITAB
             WHERE WERKS  EQ P_WERKS AND
                   MBLNR  IN S_MBLNR AND
                   BWART  EQ '105'   and
                   mblnr ne '5002361303' and
                   mblnr ne '5003501080' and
                   mblnr ne '5002996300' and
                   mblnr ne '5002996407' AND
                    mblnr ne '5003587026' AND
                    mblnr ne '5003587026' AND
                    mblnr ne '5003493186' AND
                    mblnr ne '5002720583' AND
                    mblnr ne '5002928122' AND
                    mblnr ne '5002628263'.
    After tune.
    TYPES :  BEGIN OF ST_ITAB ,
             MBLNR    LIKE MSEG-MBLNR,
             MJAHR    LIKE MSEG-MJAHR,
             ZEILE    LIKE MSEG-ZEILE,
             BWART    LIKE MSEG-BWART,
             MATNR    LIKE MSEG-MATNR,
             WERKS    LIKE MSEG-WERKS,
             LIFNR    LIKE MSEG-LIFNR,
             MENGE    LIKE MSEG-MENGE,
             MEINS    LIKE MSEG-MEINS,
             EBELN    LIKE MSEG-EBELN,
             EBELP    LIKE MSEG-EBELP,
             LGORT    LIKE MSEG-LGORT,
             SMBLN    LIKE MSEG-SMBLN,
             BUKRS    LIKE MSEG-BUKRS,
             GSBER    LIKE MSEG-GSBER,
             INSMK    LIKE MSEG-INSMK,
             XAUTO    LIKE MSEG-XAUTO,
            END OF ST_ITAB.
    DATA : ITAB TYPE STANDARD TABLE OF ST_ITAB WITH HEADER LINE.
    SELECT MBLNR MJAHR ZEILE BWART MATNR WERKS LIFNR MENGE MEINS
             EBELN EBELP LGORT SMBLN BUKRS GSBER INSMK XAUTO
             FROM MSEG
             INTO TABLE ITAB
             WHERE WERKS  EQ P_WERKS AND
                   MBLNR  IN S_MBLNR AND
                   BWART  EQ '105'   AND
                   MBLNR NE '5002361303' AND
                   MBLNR NE '5003501080' AND
                   MBLNR NE '5002996300' AND
                   MBLNR NE '5002996407' AND
                    MBLNR NE '5003587026' AND
                    MBLNR NE '5003587026' AND
                    MBLNR NE '5003493186' AND
                    MBLNR NE '5002720583' AND
                    MBLNR NE '5002928122' AND
                    MBLNR NE '5002628263'.
    PLEASE GIVE ME THE SOULUTION......
    Reward avail for useful answer
    thanks in adv,
    jai.m

    Hi.
    The Select statment accessing MSEG Table is Slow Many a times.
    To Improve the performance of  MSEG.
    1.Check for the proper notes in the Service Market Place if you are working for CIN version.
    2.Index the MSEG table
    2.Check and limit the Columns in the Select statment .
    Possible Way.
    SELECT MBLNR MJAHR ZEILE BWART MATNR WERKS LIFNR MENGE MEINS
    EBELN EBELP LGORT SMBLN BUKRS GSBER INSMK XAUTO
    FROM MSEG
    INTO CORRESPONDING FIELDS OF TABLE ITAB
    WHERE WERKS EQ P_WERKS AND
    MBLNR IN S_MBLNR AND
    BWART EQ '105' .
    Delete itab where itab EQ '5002361303'
    Delete itab where itab EQ  '5003501080' 
    Delete itab where itab EQ  '5002996300'
    Delete itab where itab EQ '5002996407'
    Delete itab where itab EQ '5003587026'
    Delete itab where itab EQ  '5003587026'
    Delete itab where itab EQ  '5003493186'
    Delete itab where itab EQ  '5002720583'
    Delete itab where itab EQ '5002928122'
    Delete itab where itab EQ '5002628263'.
    Select
    Regards
    Bala.M
    Edited by: Bala Malvatu on Feb 7, 2008 9:18 PM

  • Getting Long time to execute select count(*) statement.

    Hi all,
    My table have 40 columns and it doesn't have the primary key column. it contain more than 5M records. it's taking long time to execute simple sql statement.
    Such as select (*) take 1min and 30 sec. If i use select count(index_colunm) then it finished with in 3s. i did the following workarounds.
    Analyzed the table.
    created required indexes.
    yet getting the same performance issues. please help me to solve this issue
    Thanks

    BlueDiamond wrote:
    COUNT(*) counts the number of rows produced by the query, whereas COUNT(1) counts the number of 1 values.Would you care to show details that prove that?
    In fact, if you use count(1) then the optimizer actually re-writes that internally as count(*).
    Count(*) and Count(1) are have identical executions.
    Re: Count(*)/Count(1)
    http://asktom.oracle.com/pls/asktom/f?p=100:11:6346014113972638::::P11_QUESTION_ID:1156159920245

  • ExecuteQuery method of view object taking much time to execute

    Hi All,
    I am using a view object and execute the VO query using executeQuery method in VOImpl java.
    But, problem is, it is taking long time to bring the results after executing the query after setting the parameters. Same query in TOAD gives 4 seconds. While executing using executeQuery method, it is taking 5 mins.
    It is urgent issue. Please help me. Thanks.
    Regards, Soorya

    Hi Kali,
    Thanks for your prompt response.
    Yes. It has bind parameters. I have printed the statement before and after the executeQuery method
    ++VOImpl Code snippet++
    setWhereClauseParams(params);
    System.out.println("before executing query:Time:"+System.currentTimeMillis());
    executeQuery();
    System.out.println( "after executing query:Time:"+System.currentTimeMillis());
    +++
    I have removed some conditions in the query as it is business confidential. Please find the jdev log.
    ++++++++
    before executing query:Time:1322071711046
    [724] Column count: 41
    [725] ViewObject close prepared statements...
    [726] ViewObject : Created new QUERY statement
    [727] ViewObject: VO1
    [728] UserDefined Query: SELECT DISTINCT
    ai.invoice_num invoice_num
    FROM ap_invoices_all ai
    , ap_checks_all ac
    WHERE ...
    ai.org_id = :p_orgid
    AND ac.id = :p_id
    [729] Binding param 1: ,468,
    [730] Binding param 2: 247
    [731] The resource pool monitor thread invoked cleanup on the application module pool, AM, at 2011-11-23 23:41:32.781
    after executing query:Time:1322072052875
    +++++++
    Regards,
    Soorya

  • Rank Function taking a long time to execute in SAP HANA

    Hi All,
    I have a couple of reports with rank function which is timing out/ or taking a really long time to execute, Is there any way to get the result in less time when rank functions are involved?
    the following is a sample of how the Query looks,
    SQL 1:
    select      a.column1,
                    b.column1,
                    rank () over(partition by a.column1 order by sum(b.column2) asc)
    from         "_SYS_BIC"."Analyticview1"         b
                    join          "Table1"            a
                      on          (a.column2 = b.column3)
    group by  a.column1,
    b.column1;
    SQL 2:
    select    a.column1,
                    b.column1,
                    rank () over( order by min(b.column1) asc) WJXBFS1
    from         "_SYS_BIC"."Analytic view2"         b
                    cross join                "Table 2"               a
    where      (a.column2  like '%a%'
    and b.column1  between 100 and 200)
    group by  a.column1,
                    b.column1
    when I visualize the execution plan,the rank function is the one taking up a longer time frame. so I executed the same SQL without the rank() or partition or order by(only with Sum() in SQL1 and Min() in SQL 2) even that took a around an hour to get the result.
    1.Does anyone have an any idea to make these queries to execute faster?
    2. Does the latency have anything to do with the rank function or could it be size of the result set?
    3. is there any workaround to implement these rank function/partition inside the Analytic view itself? if yes, will this make it give the result faster?
    Thank you for your help!!
    -Gayathri

    Krishna,
    I tried both of them, Graphical and CE function,
    It is also taking a long time to execute
    Graphical view giving me the following error after 2 hr and 36 minutes
    Could not execute 'SELECT ORDER_ID,ITEM_ID,RANK from "_SYS_BIC"."EMMAPERF/ORDER_FACT_HANA_CV" group by ...' in 2:36:23.411 hours .
    SAP DBTech JDBC: [2048]: column store error: search table error:  [2620] executor: plan operation failed
    CE function - I aborted after 40 mins
    Do you know the syntax to declare local variable to use in CE function?

  • Why oracle text index column taking long  time

    why oracle text index column is taking long time to return result.I created text index on a column if I run the query on a single table result is very fast.If I join table with other table (10 records only )
    it is taking long time but in explain plan it is searching by index only.
    I created this index for searching a varchar2 column,the data is comma seperated values like ( UK,US,IT,BR) and the table having records 20 lakhs.Normally if I query with like operater
    ( like '%US%' ) it is taking full table scan because I am using '%' both sides. Please help me on this regard how to search the data with less time. Here is may sample code and explain plan.
    SQL*Plus: Release 9.2.0.1.0 - Production on Wed Jan 28 16:54:22 2009
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL&gt; set timing on
    SQL&gt; set linesize 180
    SQL&gt; explain plan for SELECT T.esongid FROM (SELECT A.ESONGID FROM wcmedeco.EDECO_ESONGS_TERR_CTRY 
    A WHERE CONTAINS(A.TERR_CTRY_NAMES,'US')&gt;0  
      2  GROUP BY A.ESONGID)K,T
      3  WHERE  K.ESONGID=T.ESONGID;
    Explained.
    Elapsed: 00:00:00.01
    SQL&gt; select *from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id  | Operation                      |  Name                   | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT               |                         |     1 |    26 |     4 |
    |   1 |  NESTED LOOPS                  |                         |     1 |    26 |     4 |
    |   2 |   VIEW                         |                         |     1 |    13 |     4 |
    |   3 |    SORT GROUP BY               |                         |     1 |    89 |     4 |
    |   4 |     TABLE ACCESS BY INDEX ROWID| EDECO_ESONGS_TERR_CTRY  |     1 |    89 |     2 |
    |   5 |      DOMAIN INDEX              | IDX_TERR_CTRY_NAMES     |       |       |     0 |
    |   6 |   INDEX RANGE SCAN             | IDX_ESONGID_T           |     1 |    13 |     1 |
    PLAN_TABLE_OUTPUT
    Note: cpu costing is off, 'PLAN_TABLE' is old version
    14 rows selected.
    Elapsed: 00:00:00.00
    SQL&gt; Regards,
    Rajasekhar

    You have not formatted your code properly so we cannot see the query you're executing. Please put some line breaks in.
    Secondly, how fresh are the statistics on those tables? Are you really returning one record out of twenty million?
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • Connecting to the database taking long time to connect database server

    Hi
    When I execute procedure i am getting the below message at bottom of the Oracle SQL Developer
    "Connecting to the database"
    it is taking more than 10 min plz guide

    Hi
    have you installed a normal Oracle Client also on your Host? normal Oracle Client
    Did you connect with host:port:sid or with a Oracle Naming Service? through TNS Service
    Can you test tnsping <alias> yes, It is working fine
    Did other user have the same problem? yes
    Did you connect through WAN or LAN connection? LAN (Intranet)
    Can you tell more about you client/database setup?
    Database setup:
    OS: Window 2008 server
    version: 11.1.0
    Client: 11.1.0
    OS: Window 2008 server
    Now I am not able to execute single select query which table contains 6 records and 15 columns it is taking long time I have waited 30 min still no resutls
    only one table is behaving like this remaining is working fine
    Edited by: user9235224 on Oct 6, 2012 7:06 PM

Maybe you are looking for

  • Tutorial Announcement :: How To Use Auto Complete Text Form Control ::

    Hello Everyone... Here in this tutorial we gonna to learn a new and amazing feature of (ADDT), we will learn how to use Adobe developer toolbox (ADDT) form controls. Form controls help you to add a fantastic features to your forms, that helps you to

  • Problem with HP laserjet 8100 (error 79.00 FE)

    Hallo, my company have two printers LaserJet 8100. They worked perfect on Windows XP. When i install Windows 7 both of them stoped working. And start show error 79.00 FE.  I tried cold reset. They printed ~50 pages and stoped. We have Hp laserjet 815

  • Using Linksys WRT54G as an AP

    I recently moved into a new home with a roomate and our DSL box is 4 port wireless router. One desktop is hardlined into that, my laptop has no problems keeping a good connection to it wireless, but my PC in the back bedroom frequently drops connecti

  • Link vendor evaluation with Source of Supply

    Hi Gurus, We have a requirement whwrein we want to have the source of supply in the purchase requisition determined automatically based on vendor Evaluation.Meaning for a particular material when i create a PR through MRP run the source of supply sho

  • HT1414 1015

    How to restore my Iphone 3G. I've tried many times but it failed and stated that 1015 error occured...