Update statement taking too long to execute

Hi All,
I'm trying to run this update statement. But its taking too long to execute.
    UPDATE ops_forecast_extract b SET position_id = (SELECT a.row_id
        FROM s_postn a
        WHERE UPPER(a.desc_text) = UPPER(TRIM(B.POSITION_NAME)))
        WHERE position_level = 7
        AND b.am_id IS NULL;
        SELECT COUNT(*) FROM S_POSTN;
        214665
        SELECT COUNT(*) FROM ops_forecast_extract;
        49366
SELECT count(*)
        FROM s_postn a, ops_forecast_extract b
        WHERE UPPER(a.desc_text) = UPPER(TRIM(B.POSITION_NAME));
575What could be the reason for update statement to execute so long?
Thanks

polasa wrote:
Hi All,
I'm trying to run this update statement. But its taking too long to execute.
What could be the reason for update statement to execute so long?You haven't said what "too long" means, but a simple reason could be that the scalar subquery on "s_postn" is using a full table scan for each execution. Potentially this subquery gets executed for each row of the "ops_forecast_extract" table that satisfies your filter predicates. "Potentially" because of the cunning "filter/subquery optimization" of the Oracle runtime engine that attempts to cache the results of already executed instances of the subquery. Since the in-memory hash table that holds these cached results is of limited size, the optimization algorithm depends on the sort order of the data and could suffer from hash collisions it's unpredictable how well this optimization works in your particular case.
You might want to check the execution plan, it should tell you at least how Oracle is going to execute the scalar subquery (it doesn't tell you anything about this "filter/subquery optimization" feature).
Generic instructions how to generate a useful explain plan output and how to post it here follow:
Could you please post an properly formatted explain plan output using DBMS_XPLAN.DISPLAY including the "Predicate Information" section below the plan to provide more details regarding your statement. Please use the {noformat}[{noformat}code{noformat}]{noformat} tag before and {noformat}[{noformat}/code{noformat}]{noformat} tag after or the {noformat}{{noformat}code{noformat}}{noformat} tag before and after to enhance readability of the output provided:
In SQL*Plus:
SET LINESIZE 130
EXPLAIN PLAN FOR <your statement>;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);Note that the package DBMS_XPLAN.DISPLAY is only available from 9i on.
In 9i and above, if the "Predicate Information" section is missing from the DBMS_XPLAN.DISPLAY output but you get instead the message "Plan table is old version" then you need to re-create your plan table using the server side script "$ORACLE_HOME/rdbms/admin/utlxplan.sql".
In previous versions you could run the following in SQL*Plus (on the server) instead:
@?/rdbms/admin/utlxplsA different approach in SQL*Plus:
SET AUTOTRACE ON EXPLAIN
<run your statement>;will also show the execution plan.
In order to get a better understanding where your statement spends the time you might want to turn on SQL trace as described here:
When your query takes too long ...
and post the "tkprof" output here, too.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/

Similar Messages

  • SQL Update statement taking too long..

    Hi All,
    I have a simple update statement that goes through a table of 95000 rows that is taking too long to update; here are the details:
    Oracle Version: 11.2.0.1 64bit
    OS: Windows 2008 64bit
    desc temp_person;
    Name                                                                                Null?    Type
    PERSON_ID                                                                           NOT NULL NUMBER(10)
    DISTRICT_ID                                                                     NOT NULL NUMBER(10)
    FIRST_NAME                                                                                   VARCHAR2(60)
    MIDDLE_NAME                                                                                  VARCHAR2(60)
    LAST_NAME                                                                                    VARCHAR2(60)
    BIRTH_DATE                                                                                   DATE
    SIN                                                                                          VARCHAR2(11)
    PARTY_ID                                                                                     NUMBER(10)
    ACTIVE_STATUS                                                                       NOT NULL VARCHAR2(1)
    TAXABLE_FLAG                                                                                 VARCHAR2(1)
    CPP_EXEMPT                                                                                   VARCHAR2(1)
    EVENT_ID                                                                            NOT NULL NUMBER(10)
    USER_INFO_ID                                                                                 NUMBER(10)
    TIMESTAMP                                                                           NOT NULL DATE
    CREATE INDEX tmp_rs_PERSON_ED ON temp_person (PERSON_ID,DISTRICT_ID) TABLESPACE D_INDEX;
    Index created.
    ANALYZE INDEX tmp_PERSON_ED COMPUTE STATISTICS;
    Index analyzed.
    explain plan for update temp_person
      2  set first_name = (select trim(f_name)
      3                    from ext_names_csv
      4                               where temp_person.PERSON_ID=ext_names_csv.p_id
      5                               and   temp_person.DISTRICT_ID=ext_names_csv.ed_id);
    Explained.
    @?/rdbms/admin/utlxpls.sql
    PLAN_TABLE_OUTPUT
    Plan hash value: 3786226716
    | Id  | Operation                   | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | UPDATE STATEMENT            |                | 82095 |  4649K|  2052K  (4)| 06:50:31 |
    |   1 |  UPDATE                     | TEMP_PERSON    |       |       |            |          |
    |   2 |   TABLE ACCESS FULL         | TEMP_PERSON    | 82095 |  4649K|   191   (1)| 00:00:03 |
    |*  3 |   EXTERNAL TABLE ACCESS FULL| EXT_NAMES_CSV  |     1 |   178 |    24   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - filter("EXT_NAMES_CSV"."P_ID"=:B1 AND "EXT_NAMES_CSV"."ED_ID"=:B2)
    Note
       - dynamic sampling used for this statement (level=2)
    19 rows selected.By the looks of it the update is going to take 6 hrs!!!
    ext_names_csv is an external table that have the same number of rows as the PERSON table.
    ROHO@rohof> desc ext_names_csv
    Name                                                                                Null?    Type
    P_ID                                                                                         NUMBER
    ED_ID                                                                                        NUMBER
    F_NAME                                                                                       VARCHAR2(300)
    L_NAME                                                                                       VARCHAR2(300)Anyone can help diagnose this please.
    Thanks
    Edited by: rsar001 on Feb 11, 2011 9:10 PM

    Thank you all for the great ideas, you have been extremely helpful. Here is what we did and were able to resolve the query.
    We started with Etbin's idea to create a table from the ext table so that we can index and reference easier than an external table, so we did the following:
    SQL> create table ext_person as select P_ID,ED_ID,trim(F_NAME) fst_name,trim(L_NAME) lst_name from EXT_NAMES_CSV;
    Table created.
    SQL> desc ext_person
    Name                                                                                Null?    Type
    P_ID                                                                                         NUMBER
    ED_ID                                                                                        NUMBER
    FST_NAME                                                                                     VARCHAR2(300)
    LST_NAME                                                                                     VARCHAR2(300)
    SQL> select count(*) from ext_person;
      COUNT(*)
         93383
    SQL> CREATE INDEX EXT_PERSON_ED ON ext_person (P_ID,ED_ID) TABLESPACE D_INDEX;
    Index created.
    SQL> exec dbms_stats.gather_index_stats(ownname=>'APPD', indname=>'EXT_PERSON_ED',partname=> NULL , estimate_percent=> 30 );
    PL/SQL procedure successfully completed.We had a look at the plan with the original SQL query that we had:
    SQL> explain plan for update temp_person
      2  set first_name = (select fst_name
      3                    from ext_person
      4                               where temp_person.PERSON_ID=ext_person.p_id
      5                               and   temp_person.DISTRICT_ID=ext_person.ed_id);
    Explained.
    SQL> @?/rdbms/admin/utlxpls.sql
    PLAN_TABLE_OUTPUT
    Plan hash value: 1236196514
    | Id  | Operation                    | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | UPDATE STATEMENT             |                | 93383 |  1550K|   186K (50)| 00:37:24 |
    |   1 |  UPDATE                      | TEMP_PERSON    |       |       |            |          |
    |   2 |   TABLE ACCESS FULL          | TEMP_PERSON    | 93383 |  1550K|   191   (1)| 00:00:03 |
    |   3 |   TABLE ACCESS BY INDEX ROWID| EXTT_PERSON    |     9 |  1602 |     1   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN          | EXT_PERSON_ED  |     1 |       |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       4 - access("EXT_PERSON"."P_ID"=:B1 AND "RS_PERSON"."ED_ID"=:B2)
    Note
       - dynamic sampling used for this statement (level=2)
    20 rows selected.As you can see the time has dropped to 37min (from 6 hrs). Then we decided to change the SQL query and use donisback's suggestion (using MERGE); we explained the plan for teh new query and here is the results:
    SQL> explain plan for MERGE INTO temp_person t
      2  USING (SELECT fst_name ,p_id,ed_id
      3  FROM  ext_person) ext
      4  ON (ext.p_id=t.person_id AND ext.ed_id=t.district_id)
      5  WHEN MATCHED THEN
      6  UPDATE set t.first_name=ext.fst_name;
    Explained.
    SQL> @?/rdbms/admin/utlxpls.sql
    PLAN_TABLE_OUTPUT
    Plan hash value: 2192307910
    | Id  | Operation            | Name         | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | MERGE STATEMENT      |              | 92307 |    14M|       |  1417   (1)| 00:00:17 |
    |   1 |  MERGE               | TEMP_PERSON  |       |       |       |            |          |
    |   2 |   VIEW               |              |       |       |       |            |          |
    |*  3 |    HASH JOIN         |              | 92307 |    20M|  6384K|  1417   (1)| 00:00:17 |
    |   4 |     TABLE ACCESS FULL| TEMP_PERSON  | 93383 |  5289K|       |   192   (2)| 00:00:03 |
    |   5 |     TABLE ACCESS FULL| EXT_PERSON   | 92307 |    15M|       |    85   (2)| 00:00:02 |
    Predicate Information (identified by operation id):
       3 - access("P_ID"="T"."PERSON_ID" AND "ED_ID"="T"."DISTRICT_ID")
    Note
       - dynamic sampling used for this statement (level=2)
    21 rows selected.As you can see, the update now takes 00:00:17 to run (need to say more?) :)
    Thank you all for your ideas that helped us get to the solution.
    Much appreciated.
    Thanks

  • Query is taking too long to execute - contd

    I am unable to post the entire explain plan in one post as it exceeds maximum length.
    Please advise on how to post this.
    Previous post Link : Link: Query is taking too long to execute
    Regards,
    Sreekanth Munagala.
    Edited by: Sreekanth Munagala on Oct 27, 2009 8:31 AM
    Edited by: Sreekanth Munagala on Oct 27, 2009 8:34 AM

    Hi Tubby,
    Today i executed only the first query in the view and it took almost 2.5 hrs.
    Here is the explain plan for this query
    SQL> SET SERVEROUTPUT ON
    SQL> set linesize 200
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT                                                                                                                                                                                      
    | Id  | Operation                                        |  Name                         | Rows  | Bytes | Cost  |                                                                                     
    |   0 | SELECT STATEMENT                                 |                               |     1 |   766 |  2448 |                                                                                     
    |   1 |  TABLE ACCESS BY INDEX ROWID                     | PO_VENDORS                    |     1 |    13 |     3 |                                                                                     
    |*  2 |   INDEX UNIQUE SCAN                              | PO_VENDORS_U1                 |     1 |       |     2 |                                                                                     
    |   3 |  TABLE ACCESS BY INDEX ROWID                     | PO_VENDORS                    |     1 |    29 |     3 |                                                                                     
    |*  4 |   INDEX UNIQUE SCAN                              | PO_VENDORS_U1                 |     1 |       |     2 |                                                                                     
    |   5 |  VIEW                                            | POC_ASN_PICKUP_LOCATIONS_V    |     2 |  2426 |    17 |                                                                                     
    |   6 |   UNION-ALL                                      |                               |       |       |       |                                                                                     
    |   7 |    NESTED LOOPS                                  |                               |     1 |    85 |     4 |                                                                                     
    |   8 |     NESTED LOOPS                                 |                               |     1 |    78 |     4 |                                                                                     
    |*  9 |      TABLE ACCESS BY INDEX ROWID                 | PO_VENDOR_SITES_ALL           |     1 |    73 |     3 |                                                                                     
    |* 10 |       INDEX UNIQUE SCAN                          | PO_VENDOR_SITES_U2            |     1 |       |     2 |                                                                                     
    |* 11 |      INDEX UNIQUE SCAN                           | PO_VENDORS_U1                 |     1 |     5 |     1 |                                                                                     
    |* 12 |     INDEX UNIQUE SCAN                            | FND_TERRITORIES_TL_U1         |     1 |     7 |       |                                                                                     
    |  13 |    NESTED LOOPS                                  |                               |     1 |    91 |    13 |                                                                                     
    |  14 |     NESTED LOOPS                                 |                               |     1 |    84 |    13 |                                                                                     
    |  15 |      TABLE ACCESS BY INDEX ROWID                 | PO_VENDORS                    |     1 |    13 |     3 |                                                                                     
    |* 16 |       INDEX UNIQUE SCAN                          | PO_VENDORS_U1                 |     1 |       |     2 |                                                                                     
    PLAN_TABLE_OUTPUT                                                                                                                                                                                      
    |* 17 |      TABLE ACCESS BY INDEX ROWID                 | FND_LOOKUP_VALUES             |     1 |    71 |    10 |                                                                                     
    |* 18 |       INDEX RANGE SCAN                           | FND_LOOKUP_VALUES_U2          |    13 |       |     2 |                                                                                     
    |* 19 |     INDEX UNIQUE SCAN                            | FND_TERRITORIES_TL_U1         |     1 |     7 |       |                                                                                     
    |* 20 |  COUNT STOPKEY                                   |                               |       |       |       |                                                                                     
    |  21 |   TABLE ACCESS BY INDEX ROWID                    | MTL_SYSTEM_ITEMS_B            |     8 |   136 |    12 |                                                                                     
    |* 22 |    INDEX RANGE SCAN                              | MTL_SYSTEM_ITEMS_B_U1         |     8 |       |     3 |                                                                                     
    |* 23 |  COUNT STOPKEY                                   |                               |       |       |       |                                                                                     
    |  24 |   TABLE ACCESS BY INDEX ROWID                    | MTL_SYSTEM_ITEMS_B            |     8 |   288 |    12 |                                                                                     
    |* 25 |    INDEX RANGE SCAN                              | MTL_SYSTEM_ITEMS_B_U1         |     8 |       |     3 |                                                                                     
    |  26 |  TABLE ACCESS BY INDEX ROWID                     | FND_TERRITORIES_TL            |     1 |    24 |     2 |                                                                                     
    |* 27 |   INDEX UNIQUE SCAN                              | FND_TERRITORIES_TL_U1         |     1 |       |     1 |                                                                                     
    |  28 |  NESTED LOOPS                                    |                               |     1 |    40 |     5 |                                                                                     
    |  29 |   TABLE ACCESS BY INDEX ROWID                    | HZ_CUST_ACCOUNTS              |     1 |    11 |     3 |                                                                                     
    |* 30 |    INDEX UNIQUE SCAN                             | HZ_CUST_ACCOUNTS_U1           |     1 |       |     2 |                                                                                     
    |  31 |   TABLE ACCESS BY INDEX ROWID                    | HZ_PARTIES                    |     1 |    29 |     2 |                                                                                     
    |* 32 |    INDEX UNIQUE SCAN                             | HZ_PARTIES_U1                 |     1 |       |     1 |                                                                                     
    |  33 |  TABLE ACCESS BY INDEX ROWID                     | FND_TERRITORIES_TL            |     1 |    24 |     2 |                                                                                     
    |* 34 |   INDEX UNIQUE SCAN                              | FND_TERRITORIES_TL_U1         |     1 |       |     1 |                                                                                     
    |  35 |  TABLE ACCESS BY INDEX ROWID                     | FND_TERRITORIES_TL            |     1 |    24 |     2 |                                                                                     
    |* 36 |   INDEX UNIQUE SCAN                              | FND_TERRITORIES_TL_U1         |     1 |       |     1 |                                                                                     
    |* 37 |  COUNT STOPKEY                                   |                               |       |       |       |                                                                                     
    PLAN_TABLE_OUTPUT                                                                                                                                                                                      
    |* 38 |   TABLE ACCESS BY INDEX ROWID                    | ONTC_MTC_PROFORMA_HEADERS     |     1 |    21 |     3 |                                                                                     
    |* 39 |    INDEX RANGE SCAN                              | ONTC_MTC_PROFORMA_HEADERS_U2  |     1 |       |     2 |                                                                                     
    |  40 |  TABLE ACCESS BY INDEX ROWID                     | FND_TERRITORIES_TL            |     1 |    24 |     2 |                                                                                     
    |* 41 |   INDEX UNIQUE SCAN                              | FND_TERRITORIES_TL_U1         |     1 |       |     1 |                                                                                     
    |* 42 |  COUNT STOPKEY                                   |                               |       |       |       |                                                                                     
    |* 43 |   TABLE ACCESS BY INDEX ROWID                    | ONTC_MTC_PROFORMA_HEADERS     |     1 |    21 |     3 |                                                                                     
    |* 44 |    INDEX RANGE SCAN                              | ONTC_MTC_PROFORMA_HEADERS_U2  |     1 |       |     2 |                                                                                     
    |  45 |  SORT AGGREGATE                                  |                               |     1 |    39 |       |                                                                                     
    |  46 |   NESTED LOOPS OUTER                             |                               |     2 |    78 |  1828 |                                                                                     
    |* 47 |    TABLE ACCESS FULL                             | ONTC_MTC_PROFORMA_HEADERS     |     1 |    24 |  1825 |                                                                                     
    |  48 |    TABLE ACCESS BY INDEX ROWID                   | ONTC_MTC_PROFORMA_LINES       |     5 |    75 |     3 |                                                                                     
    |* 49 |     INDEX RANGE SCAN                             | ONTC_MTC_PROFORMA_LINES_PK    |    11 |       |     2 |                                                                                     
    |  50 |  NESTED LOOPS                                    |                               |     1 |   766 |  2448 |                                                                                     
    |  51 |   NESTED LOOPS                                   |                               |     1 |   761 |  2447 |                                                                                     
    |  52 |    NESTED LOOPS                                  |                               |     1 |   746 |  2445 |                                                                                     
    |  53 |     NESTED LOOPS                                 |                               |     1 |   694 |  2443 |                                                                                     
    |  54 |      NESTED LOOPS                                |                               |     1 |   682 |  2441 |                                                                                     
    |  55 |       NESTED LOOPS                               |                               |     1 |   671 |  2439 |                                                                                     
    |  56 |        NESTED LOOPS                              |                               |     1 |   612 |  2437 |                                                                                     
    |  57 |         NESTED LOOPS                             |                               |     1 |   600 |  2435 |                                                                                     
    |  58 |          NESTED LOOPS                            |                               |     1 |   575 |  2433 |                                                                                     
    PLAN_TABLE_OUTPUT                                                                                                                                                                                      
    |  59 |           NESTED LOOPS                           |                               |     1 |   552 |  2431 |                                                                                     
    |  60 |            NESTED LOOPS                          |                               |     1 |   533 |  2429 |                                                                                     
    |  61 |             NESTED LOOPS                         |                               |     1 |   524 |  2428 |                                                                                     
    |  62 |              NESTED LOOPS                        |                               |     1 |   455 |  2427 |                                                                                     
    |  63 |               NESTED LOOPS                       |                               |     1 |   429 |  2426 |                                                                                     
    |  64 |                NESTED LOOPS                      |                               |     1 |   389 |  2424 |                                                                                     
    |  65 |                 NESTED LOOPS                     |                               |     1 |   368 |  2422 |                                                                                     
    |  66 |                  NESTED LOOPS                    |                               |     1 |   308 |  2421 |                                                                                     
    |  67 |                   NESTED LOOPS                   |                               |     1 |   281 |  2419 |                                                                                     
    |  68 |                    NESTED LOOPS                  |                               |     1 |   253 |  2418 |                                                                                     
    |  69 |                     NESTED LOOPS                 |                               |     1 |   214 |  2416 |                                                                                     
    |  70 |                      NESTED LOOPS                |                               |    39 |  7371 |  2338 |                                                                                     
    |* 71 |                       TABLE ACCESS FULL          | RCV_SHIPMENT_HEADERS          |    39 |  5070 |  2221 |                                                                                     
    |* 72 |                       TABLE ACCESS BY INDEX ROWID| RCV_SHIPMENT_LINES            |     1 |    59 |     3 |                                                                                     
    |* 73 |                        INDEX RANGE SCAN          | RCV_SHIPMENT_LINES_U2         |     1 |       |     2 |                                                                                     
    |* 74 |                      TABLE ACCESS BY INDEX ROWID | PO_LINES_ALL                  |     1 |    25 |     2 |                                                                                     
    |* 75 |                       INDEX UNIQUE SCAN          | PO_LINES_U1                   |     1 |       |     1 |                                                                                     
    |* 76 |                     TABLE ACCESS BY INDEX ROWID  | PO_LINE_LOCATIONS_ALL         |     1 |    39 |     2 |                                                                                     
    |* 77 |                      INDEX UNIQUE SCAN           | PO_LINE_LOCATIONS_U1          |     1 |       |     1 |                                                                                     
    |* 78 |                    TABLE ACCESS BY INDEX ROWID   | PO_HEADERS_ALL                |     1 |    28 |     1 |                                                                                     
    |* 79 |                     INDEX UNIQUE SCAN            | PO_HEADERS_U1                 |     1 |       |       |                                                                                     
    PLAN_TABLE_OUTPUT                                                                                                                                                                                      
    |* 80 |                   TABLE ACCESS BY INDEX ROWID    | OE_ORDER_LINES_ALL            |     1 |    27 |     2 |                                                                                     
    |* 81 |                    INDEX UNIQUE SCAN             | OE_ORDER_LINES_U1             |     1 |       |     1 |                                                                                     
    |  82 |                  TABLE ACCESS BY INDEX ROWID     | OE_ORDER_HEADERS_ALL          |     1 |    60 |     1 |                                                                                     
    |* 83 |                   INDEX UNIQUE SCAN              | OE_ORDER_HEADERS_U1           |     1 |       |       |                                                                                     
    |* 84 |                 TABLE ACCESS BY INDEX ROWID      | HZ_CUST_SITE_USES_ALL         |     1 |    21 |     2 |                                                                                     
    |* 85 |                  INDEX UNIQUE SCAN               | HZ_CUST_SITE_USES_U1          |     1 |       |     1 |                                                                                     
    |* 86 |                TABLE ACCESS BY INDEX ROWID       | HZ_CUST_SITE_USES_ALL         |     1 |    40 |     2 |                                                                                     
    |* 87 |                 INDEX UNIQUE SCAN                | HZ_CUST_SITE_USES_U1          |     1 |       |     1 |                                                                                     
    |  88 |               TABLE ACCESS BY INDEX ROWID        | WSH_CARRIERS                  |     1 |    26 |     1 |                                                                                     
    |* 89 |                INDEX UNIQUE SCAN                 | WSH_CARRIERS_U2               |     1 |       |       |                                                                                     
    |* 90 |              TABLE ACCESS BY INDEX ROWID         | WSH_CARRIER_SERVICES          |     1 |    69 |     1 |                                                                                     
    |* 91 |               INDEX RANGE SCAN                   | WSH_CARRIER_SERVICES_N1       |     2 |       |       |                                                                                     
    |* 92 |             TABLE ACCESS BY INDEX ROWID          | WSH_ORG_CARRIER_SERVICES      |     1 |     9 |     1 |                                                                                     
    |* 93 |              INDEX RANGE SCAN                    | WSH_ORG_CARRIER_SERVICES_N1   |     1 |       |       |                                                                                     
    |  94 |            TABLE ACCESS BY INDEX ROWID           | HZ_CUST_ACCOUNTS              |     1 |    19 |     2 |                                                                                     
    |* 95 |             INDEX UNIQUE SCAN                    | HZ_CUST_ACCOUNTS_U1           |     1 |       |     1 |                                                                                     
    |* 96 |           TABLE ACCESS BY INDEX ROWID            | HZ_CUST_ACCT_SITES_ALL        |     1 |    23 |     2 |                                                                                     
    |* 97 |            INDEX UNIQUE SCAN                     | HZ_CUST_ACCT_SITES_U1         |     1 |       |     1 |                                                                                     
    |* 98 |          TABLE ACCESS BY INDEX ROWID             | HZ_CUST_ACCT_SITES_ALL        |     1 |    25 |     2 |                                                                                     
    |* 99 |           INDEX UNIQUE SCAN                      | HZ_CUST_ACCT_SITES_U1         |     1 |       |     1 |                                                                                     
    | 100 |         TABLE ACCESS BY INDEX ROWID              | HZ_PARTY_SITES                |     1 |    12 |     2 |                                                                                     
    PLAN_TABLE_OUTPUT                                                                                                                                                                                      
    |*101 |          INDEX UNIQUE SCAN                       | HZ_PARTY_SITES_U1             |     1 |       |     1 |                                                                                     
    | 102 |        TABLE ACCESS BY INDEX ROWID               | HZ_LOCATIONS                  |     1 |    59 |     2 |                                                                                     
    |*103 |         INDEX UNIQUE SCAN                        | HZ_LOCATIONS_U1               |     1 |       |     1 |                                                                                     
    |*104 |       INDEX RANGE SCAN                           | HZ_LOC_ASSIGNMENTS_N1         |     1 |    11 |     2 |                                                                                     
    | 105 |      TABLE ACCESS BY INDEX ROWID                 | HZ_PARTY_SITES                |     1 |    12 |     2 |                                                                                     
    |*106 |       INDEX UNIQUE SCAN                          | HZ_PARTY_SITES_U1             |     1 |       |     1 |                                                                                     
    | 107 |     TABLE ACCESS BY INDEX ROWID                  | HZ_LOCATIONS                  |     1 |    52 |     2 |                                                                                     
    |*108 |      INDEX UNIQUE SCAN                           | HZ_LOCATIONS_U1               |     1 |       |     1 |                                                                                     
    |*109 |    INDEX RANGE SCAN                              | HZ_LOC_ASSIGNMENTS_N1         |     1 |    15 |     2 |                                                                                     
    |*110 |   INDEX UNIQUE SCAN                              | HZ_PARTIES_U1                 |     1 |     5 |     1 |                                                                                     
    I will put the predicate information in another post.
    193 rows selected.
    SQL> spool offPlease suggest on how can we improve the performance.
    Regards,
    Sreekanth Munagala.

  • SQL Statement taking too long to get the data

    Hi,
    There are over 2500 records in a table and when retrieve all using ' SELECT * From Table' it is taking too long to get the data. ie .. 4.3 secs.
    Is there any possible way to shorten the process time.
    Thanks

    Hi Patrick,
    Here is the sql statement and table desc.
    ID     Number
    SN     Varchar2(12)
    FN     Varchar2(30)
    LN     Varchar2(30)
    By     Varchar(255)
    Dt     Date(7)
    Add     Varchar2(50)
    Add1     Varchar2(30)
    Cty     Varchar2(30)
    Stt     Varchar2(2)
    Zip     Varchar2(12)
    Ph     Varchar2(15)
    Email     Varchar2(30)
    ORgId     Number
    Act     Varchar2(3)     
    select A."FN" || '' '' || A."LN" || '' ('' || A."SN" || '')'' "Name",
    A."By", A."Dt",
    A."Add" || ''
    '' || A."Cty" || '', '' || A."Stt" || '' '' || A."Zip" "Location",
    A."Ph", A."Email", A."ORgId", A."ID",
    A."SN" "OSN", A."Act"
    from "TBL_OPTRS" A where A."ID" <> 0 ';
    I'm displaying all rows in a report.
    if I use 'select * from TBL_OPTRS' , this also takes 4.3 to 4.6 secs.
    Thanks.

  • Update is taking too long to install

    I'm in the process of installing an update to iTunes (11.0.4) and what I think is a security update on my MBP. However, the installation process is taking too long. First, it was stuck for about 2 hours on "registering updated components", and now (for the last hour) I'm seeing a blue screen with the spinning gear. Should I just keep waiting? Has anyone had a similar experience? 

    zornie,
    Try going to safari>preferences, general tab, and setting the "save downloaded files to your desktop (if desktop is not in the drop down menu, click other then select desktop from the left side bar). This will download the update to your dektop as a stand alone installer. Also if for some reason the download is interupted you can click the download icon on the desktop and it will resume where it left off. When the download is complete double click the icon/installer package and follow the prompts. Do them one at a time. (Thsi is not using software update, which can some times get corrupted during DL, especially if your are doing it wireless)
    Security update:
    http://support.apple.com/kb/DL1660
    iTunes:
    http://www.apple.com/itunes/download/
    Hope this helps

  • UIMsg_RefreshWindows is taking too long to execute

    Hi all,
    I have a Process Model sequence file that calls the PostUIMessageEx method with the UIMsg_RefreshWindows parameter on the SequenceFielPostStepRuntimeError and the SequenceFilePostStepFailure callbacks. This has been taking really long to execute (>3 minutes) since I moved to TS3.5 about a month ago. Do you guys know of any issue of this method with these particular  parameters on TS3.5? What could be causing this problem?
    Attachments:
    UIMsg.jpg ‏92 KB

    Hi, <<...
    There is nothing out of normal among your parameters. The synchronize option you selected is going to make the method wait until the operator interface process the message. So it depends on what you put in your UI message event handler. I'm not aware of anything related to this method itself that could cause this slow execution behavior. If you could send us a simplified version of the project, maybe we can further investigate the issue.
    Song D
    Regards,
    Song Du
    Systems Software
    National Instruments R&D

  • Update statement takes too long to run

    Hello,
    I am running this simple update statement, but it takes too long to run. It was running for 16 hours and then I cancelled it. It was not even finished. The destination table that I am updating has 2.6 million records, but I am only updating 206K records. If add ROWNUM <20 to the update statement works just fine and updates the right column with the right information. Do you have any ideas what could be wrong in my update statement? I am also using a DB link since CAP.ESS_LOOKUP table resides in different db from the destination table. We are running 11g Oracle Db.
    UPDATE DEV_OCS.DOCMETA IPM
    SET IPM.XIPM_APP_2_17 = (SELECT DISTINCT LKP.DOC_STATUS
    FROM [email protected] LKP
    WHERE LKP.DOC_NUM = IPM.XIPM_APP_2_1 AND
    IPM.XIPMSYS_APP_ID = 2
    WHERE
    IPM.XIPMSYS_APP_ID = 2;
    Thanks,
    Ilya

    matthew_morris wrote:
    In the first SQL, the SELECT against the remote table was a correlated subquery. the 'WHERE LKP.DOC_NUM = IPM.XIPM_APP_2_1 AND IPM.XIPMSYS_APP_ID = 2" means that the subquery had to run once for each row of DEV_OCS.DOCMETA being evaluated. This might have meant thousands of iterations, meaning a great deal of network traffic (not to mention each performing a DISTINCT operation). Queries where the data is split between two or more databases are much more expensive than queries using only tables in a single database.Sorry to disappoint you again, but with clause by itself doesn't prevent from "subquery had to run once for each row of DEV_OCS.DOCMETA being evaluated". For example:
    {code}
    SQL> set linesize 132
    SQL> explain plan for
    2 update emp e
    3 set deptno = (select t.deptno from dept@sol10 t where e.deptno = t.deptno)
    4 /
    Explained.
    SQL> @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    Plan hash value: 3247731149
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Inst |IN-OUT|
    | 0 | UPDATE STATEMENT | | 14 | 42 | 17 (83)| 00:00:01 | | |
    | 1 | UPDATE | EMP | | | | | | |
    | 2 | TABLE ACCESS FULL| EMP | 14 | 42 | 3 (0)| 00:00:01 | | |
    | 3 | REMOTE | DEPT | 1 | 13 | 0 (0)| 00:00:01 | SOL10 | R->S |
    PLAN_TABLE_OUTPUT
    Remote SQL Information (identified by operation id):
    3 - SELECT "DEPTNO" FROM "DEPT" "T" WHERE "DEPTNO"=:1 (accessing 'SOL10' )
    16 rows selected.
    SQL> explain plan for
    2 update emp e
    3 set deptno = (with t as (select * from dept@sol10) select t.deptno from t where e.deptno = t.deptno)
    4 /
    Explained.
    SQL> @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    Plan hash value: 3247731149
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Inst |IN-OUT|
    | 0 | UPDATE STATEMENT | | 14 | 42 | 17 (83)| 00:00:01 | | |
    | 1 | UPDATE | EMP | | | | | | |
    | 2 | TABLE ACCESS FULL| EMP | 14 | 42 | 3 (0)| 00:00:01 | | |
    | 3 | REMOTE | DEPT | 1 | 13 | 0 (0)| 00:00:01 | SOL10 | R->S |
    PLAN_TABLE_OUTPUT
    Remote SQL Information (identified by operation id):
    3 - SELECT "DEPTNO" FROM "DEPT" "DEPT" WHERE "DEPTNO"=:1 (accessing 'SOL10' )
    16 rows selected.
    SQL>
    {code}
    As you can see, WITH clause by itself guaranties nothing. We must force optimizer to materialize it:
    {code}
    SQL> explain plan for
    2 update emp e
    3 set deptno = (with t as (select /*+ materialize */ * from dept@sol10) select t.deptno from t where e.deptno = t.deptno
    4 /
    Explained.
    SQL> @?\rdbms\admin\utlxpls
    PLAN_TABLE_OUTPUT
    Plan hash value: 3568118945
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Inst |IN-OUT|
    | 0 | UPDATE STATEMENT | | 14 | 42 | 87 (17)| 00:00:02 | | |
    | 1 | UPDATE | EMP | | | | | | |
    | 2 | TABLE ACCESS FULL | EMP | 14 | 42 | 3 (0)| 00:00:01 | | |
    | 3 | TEMP TABLE TRANSFORMATION | | | | | | | |
    | 4 | LOAD AS SELECT | SYS_TEMP_0FD9D6603_1CEEEBC | | | | | | |
    | 5 | REMOTE | DEPT | 4 | 80 | 3 (0)| 00:00:01 | SOL10 | R->S |
    PLAN_TABLE_OUTPUT
    |* 6 | VIEW | | 4 | 52 | 2 (0)| 00:00:01 | | |
    | 7 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6603_1CEEEBC | 4 | 80 | 2 (0)| 00:00:01 | | |
    Predicate Information (identified by operation id):
    6 - filter("T"."DEPTNO"=:B1)
    Remote SQL Information (identified by operation id):
    PLAN_TABLE_OUTPUT
    5 - SELECT "DEPTNO","DNAME","LOC" FROM "DEPT" "DEPT" (accessing 'SOL10' )
    25 rows selected.
    SQL>
    {code}
    I do know hint materialize is not documented, but I don't know any other way besides splitting statement in two to materialize it.
    SY.

  • Update statement time too long

    HI
    im doing this update statement using toad and its been an hour now and not finished ( its only 900 records)
    and when i try to update 20 records only it takes about 3min
    update IC_ITEM_MST set WHSE_ITEM_ID ='503' where ITEM_NO like 'PP%'
    thnx
    Edited by: george samaan on Dec 21, 2008 10:35 PM

    select * from v$locked_object
    gave me this
    XIDUSN XIDSLOT XIDSQN OBJECT_ID SESSION_ID ORACLE_USERNAME
    OS_USER_NAME PROCESS LOCKED_MODE
    11 15 10999 36834 97 APPS
    appltst2 897256 3
    10 47 347465 63200 14 APPS
    Administrator 3124:2324 2
    10 47 347465 63569 14 APPS
    Administrator 3124:2324 2
    10 47 347465 63867 14 APPS
    Administrator 3124:2324 3
    10 47 347465 64380 14 APPS
    Administrator 3124:2324 2
    10 47 347465 64447 14 APPS
    Administrator 3124:2324 2
    10 47 347465 64934 14 APPS
    XIDUSN XIDSLOT XIDSQN OBJECT_ID SESSION_ID ORACLE_USERNAME
    OS_USER_NAME PROCESS LOCKED_MODE
    Administrator 3124:2324 2
    10 47 347465 78678 14 APPS
    Administrator 3124:2324 3
    10 47 347465 79069 14 APPS
    Administrator 3124:2324 3
    10 47 347465 64026 14 APPS
    Administrator 3124:2324 3
    10 47 347465 93468 14 APPS
    Administrator 3124:2324 3
    10 47 347465 209903 14 APPS
    Administrator 3124:2324 3
    10 47 347465 80084 14 APPS
    Administrator 3124:2324 3
    XIDUSN XIDSLOT XIDSQN OBJECT_ID SESSION_ID ORACLE_USERNAME
    OS_USER_NAME PROCESS LOCKED_MODE
    0 0 0 36944 60 APPS
    appltst2 1572894 3
    14 rows selected.

  • Query taking too long to execute after clone

    Hi All,
    We have a query which is working fine in our development environment and taking around 15 secs to execute the query. When we run the same query with same parameters in a recently cloned instance, the query is taking 1200 secs to execute.
    Please help us on this issue.
    Thanks,
    Raghava

    Hi All,
    I have 4 unions in my query. individual sqls are running in very less time. But when i use all of them in UNION then im getting performance issue. Below is my query:
    SELECT /*+ parallel(xla_l) parallel(xla_h) leading(xla_h) */
    XLA_L.code_combination_id,
    gl.name,
    fnd_flex_ext.get_segs('SQLGL', 'GL#', gl.chart_of_accounts_id, xla_l.code_combination_id) ACCOUNT,
    xla_oa_functions_pkg.get_ccid_description (gl.chart_of_accounts_id, xla_l.code_combination_id) account_description ,
    xla_h.accounting_date,
    XLA_L.accounting_class_code,
    NVL(lk7.meaning, xla_l.accounting_class_code) accounting_class,
    xla_h.entity_id,
    xla_h.event_type_code,
    et.event_class_code,
    bud.budget_name,
    xla_h.ledger_id,
    xla_l.entered_dr,
    xla_l.entered_cr,
    te.ledger_id trx_ledger_id,
    te.legal_entity_id,
    et.entity_code,
    te.source_id_int_1,
    te.source_id_int_2,
    te.source_id_int_3,
    te.source_id_int_4,
    te.source_id_char_1,
    te.source_id_char_2,
    te.source_id_char_3,
    te.source_id_char_4,
    te.security_id_int_1,
    te.security_id_int_2,
    te.security_id_int_3,
    te.security_id_char_1,
    te.security_id_char_2,
    te.security_id_char_3,
    te.valuation_method,
    xla_h.application_id,
    xs.drilldown_procedure_name,
    GL_CUSTOM_DRILL_DOWN.get_trx_description(te.source_id_int_1,et.entity_code) description,
    null fleet_number,
    null Vendor_Name,
    xs.je_source_name JournalSource,
    xla_h.je_category_name JournalCategory,
    XLA_L.AE_LINE_NUM Line
    FROM xla.xla_ae_lines XLA_L,
    xla.xla_ae_headers xla_h,
    xla_gl_ledgers_v gl ,
    xla_lookups lk5 ,
    xla_lookups lk7,
    xla.xla_events xla_e ,
    xla.xla_event_types_tl et ,
    xla.xla_event_classes_tl ec ,
    xla.xla_transaction_entities te,
    gl_budget_versions bud ,
    --gl_import_references ir,
    xla.xla_subledgers xs
    --gl_je_lines gl_l
    where
    --ir.gl_sl_link_id=XLA_L.gl_sl_link_id
    --and ir.gl_sl_link_table=XLA_L.gl_sl_link_table
    --and gl.ledger_id       = xla_h.ledger_id
    --AND
    xla_h.ae_header_id = xla_l.ae_header_id
    AND xla_h.application_id = xla_l.application_id
    AND lk7.lookup_code(+) = xla_l.accounting_class_code
    AND lk7.lookup_type(+) = 'XLA_ACCOUNTING_CLASS'
    AND xla_e.event_id = xla_h.event_id
    AND xla_e.application_id = xla_h.application_id
    AND xs.application_id =xla_h.application_id
    AND te.entity_id =xla_h.entity_id
    AND te.application_id =xla_l.application_id --xla_h.application_id
    AND ec.application_id = et.application_id
    AND ec.entity_code = et.entity_code
    AND ec.event_class_code = et.event_class_code
    AND ec.language = USERENV('LANG')
    AND et.application_id = xla_h.application_id
    AND et.event_type_code = xla_h.event_type_code
    AND et.language = USERENV('LANG')
    AND lk5.lookup_code = NVL(xla_h.funds_status_code, 'REQUIRED')
    AND lk5.lookup_type = 'XLA_FUNDS_STATUS'
    AND bud.budget_version_id(+) = xla_h.budget_version_id
    and xs.je_source_name != 'Cost Management'
    and (xla_l.gl_sl_link_id,xla_l.gl_sl_link_table) in (select ir.gl_sl_link_id, ir.gl_sl_link_table from
    gl_import_references ir,
    gl_je_lines gl_l
    where ir.je_header_id = gl_l.je_header_id
    and gl_l.je_line_num=ir.je_line_num
    and gl_l.period_name =NVL(:1,gl_l.period_name)
    and gl_l.code_combination_id =:2)
    UNION
    SELECT
    lines.code_combination_id LINE_CODE_COMBINATION_ID,
    lr.target_ledger_name LEDGER_NAME,
    fnd_flex_ext.get_segs('SQLGL', 'GL#', b.chart_of_accounts_id, lines.code_combination_id) ACCOUNT,
    xla_oa_functions_pkg.get_ccid_description (b.chart_of_accounts_id, lines.code_combination_id) account_description,
    h.date_created,
    null,
    null,
    null,
    null,
    null,
    null,
    h.ledger_id LEDGER_ID,
    lines.entered_dr LINE_ENTERED_DR,
    lines.entered_cr LINE_ENTERED_CR,
    lines.ledger_id LINE_LEDGER_ID,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    lines.description LINE_DESCRIPTION,
    null FLEET_NUMBER,
    null Vendor_Name,
    h.je_source JournalSource,
    h.je_category JournalCategory,
    lines.JE_LINE_NUM Line
    FROM gl_period_statuses ps,
    gl_je_lines lines,
    gl_je_headers h,
    gl_je_batches b,
    gl_ledger_relationships lr
    WHERE lr.source_ledger_id = lr.target_ledger_id
    --AND lr.target_currency_code = DECODE ( GLR03300_pkg.get_ledger_currency, 'ALL123456789012345', lr.target_currency_code, GLR03300_pkg.get_ledger_currency )
    AND lr.application_id = 101
    AND b.average_journal_flag = 'N'
    AND b.je_batch_id = h.je_batch_id
    AND b.actual_flag = 'A'
    AND h.je_header_id = lines.je_header_id
    AND h.currency_code = DECODE ( GLR03300_PKG.get_entered_currency_code, 'ALL123456789012345', h.currency_code, NULL, h.currency_code, GLR03300_pkg.get_entered_currency_code )
    AND h.ledger_id = lr.source_ledger_id
    AND lines.period_name = ps.period_name
    and lines.period_name = NVL(:3,lines.period_name)
    AND ps.ledger_id = lines.ledger_id
    AND ps.application_id = 101
    AND lines.code_combination_id=:4
    AND h.je_source != 'Cost Management'
    UNION
    SELECT /*+ parallel(xla_l) parallel(xla_h) leading(xla_h) */ gl_l.code_combination_id LINE_CODE_COMBINATION_ID,
    gl.name,
    fnd_flex_ext.get_segs('SQLGL', 'GL#', gl.chart_of_accounts_id, xla_l.code_combination_id) ACCOUNT,
    xla_oa_functions_pkg.get_ccid_description (gl.chart_of_accounts_id, xla_l.code_combination_id) account_description,
    xla_h.accounting_date,--gjh.date_created,
    XLA_L.accounting_class_code,
    NVL(lk7.meaning, xla_l.accounting_class_code) accounting_class,
    null,
    null,
    null,
    null,
    xla_h.ledger_id LEDGER_ID,
    NVL(xla_l.entered_dr,0) LINE_ENTERED_DR,
    NVL(xla_l.entered_cr,0) LINE_ENTERED_CR,
    te.ledger_id trx_ledger_id,
    te.legal_entity_id,
    et.entity_code,
    te.source_id_int_1,
    te.source_id_int_2,
    te.source_id_int_3,
    te.source_id_int_4,
    te.source_id_char_1,
    te.source_id_char_2,
    te.source_id_char_3,
    te.source_id_char_4,
    te.security_id_int_1,
    te.security_id_int_2,
    te.security_id_int_3,
    te.security_id_char_1,
    te.security_id_char_2,
    te.security_id_char_3,
    te.valuation_method,
    xla_h.application_id,
    xs.drilldown_procedure_name,
    GL_CUSTOM_DRILL_DOWN.get_trx_description(te.source_id_int_1,et.entity_code) description,-- gl_l.description LINE_DESCRIPTION,
    cii.instance_number FLEET_NUMBER,
    (select a.vendor_name
    from RCV_VRC_TXS_VENDINT_V a
    where a.wip_entity_id = mmt.TRANSACTION_SOURCE_ID
    AND a.organization_id = mmt.organization_id
    and a.item_id = mmt.inventory_item_id) Vendor_Name,
    xs.je_source_name JournalSource,
    xla_h.je_category_name JournalCategory,
    gl_l.JE_LINE_NUM Line
    FROM xla.xla_ae_lines XLA_L,
    xla.xla_ae_headers xla_h,
    xla_gl_ledgers_v gl ,
    xla_lookups lk5,
    xla_lookups lk7,
    xla.xla_events xla_e ,
    xla.xla_event_types_tl et,
    xla.xla_event_classes_tl ec,
    xla.xla_transaction_entities te,
    gl_budget_versions bud,
    gl_import_references ir,
    xla.xla_subledgers xs,
    gl_je_lines gl_l,
    mtl_transaction_accounts mta,
    XLA_TRANSACTION_ENTITIES_upg xte,
    xla_distribution_links xdl,
    mtl_material_transactions mmt,
    WIP_ENTITIES WIE,
    WIP_DISCRETE_JOBS WDJ,
    csi_item_instances CII
    where
    ir.gl_sl_link_id=XLA_L.gl_sl_link_id
    and ir.je_header_id = gl_l.je_header_id
    and gl_l.je_line_num=ir.je_line_num
    and ir.gl_sl_link_table=XLA_L.gl_sl_link_table
    and gl_l.period_name =NVL(:5,gl_l.period_name)
    and gl_l.code_combination_id = :6
    and xla_h.ae_header_id = xla_l.ae_header_id
    AND xla_h.application_id = xla_l.application_id
    AND lk7.lookup_code(+) = xla_l.accounting_class_code
    AND lk7.lookup_type(+) = 'XLA_ACCOUNTING_CLASS'
    AND xla_e.event_id = xla_h.event_id
    AND xla_e.application_id = xla_h.application_id
    AND xs.application_id =xla_h.application_id
    AND te.entity_id =xla_h.entity_id
    AND te.application_id =xla_l.application_id --xla_h.application_id
    AND ec.application_id = et.application_id
    AND ec.entity_code = et.entity_code
    AND ec.event_class_code = et.event_class_code
    AND ec.language = USERENV('LANG')
    AND et.application_id = xla_h.application_id
    AND et.event_type_code = xla_h.event_type_code
    AND et.language = USERENV('LANG')
    AND lk5.lookup_code = NVL(xla_h.funds_status_code, 'REQUIRED')
    AND lk5.lookup_type = 'XLA_FUNDS_STATUS'
    AND bud.budget_version_id(+) = xla_h.budget_version_id
    AND mta.reference_account = gl_l.code_combination_id
    AND mmt.transaction_id = mta.transaction_id
    and mta.transaction_id = xte.source_id_int_1
    AND mta.inventory_item_id =mmt.inventory_item_id
    AND mta.organization_id = mmt.organization_id
    AND mmt.transaction_type_id = 35
    and xte.entity_id = xla_e.entity_id
    and xdl.source_distribution_type = 'MTL_TRANSACTION_ACCOUNTS'
    and xdl.source_distribution_id_num_1 = mta.inv_sub_ledger_id
    and xdl.APPLICATION_ID=707
    and xla_h.ae_header_id = xdl.ae_header_id
    and xdl.ae_header_id = XLA_L.ae_header_id
    and ir.gl_sl_link_table = 'XLAJEL'
    and ir.gl_sl_link_id = XLA_L.gl_sl_link_id
    and gl_l.je_header_id = ir.je_header_id
    and gl_l.je_line_num = ir.je_line_num
    and mmt.TRANSACTION_SOURCE_ID = wie.wip_entity_id
    AND mmt.organization_id = wdj.organization_id
    and wie.wip_entity_id = wdj.wip_entity_id
    and wdj.asset_group_id = cii.inventory_item_id
    and wdj.maintenance_object_id=cii.instance_id
    and xs.je_source_name = 'Cost Management'
    UNION
    SELECT /*+ parallel(XLA_L) parallel(xla_h) leading(xla_h) */ gl_l.code_combination_id LINE_CODE_COMBINATION_ID,
    gl.name,
    fnd_flex_ext.get_segs('SQLGL', 'GL#', gl.chart_of_accounts_id, xla_l.code_combination_id) ACCOUNT,
    xla_oa_functions_pkg.get_ccid_description (gl.chart_of_accounts_id, xla_l.code_combination_id) account_description,
    xla_h.accounting_date,--gjh.date_created,
    XLA_L.accounting_class_code,
    NVL(lk7.meaning, xla_l.accounting_class_code) accounting_class,
    null,
    null,
    null,
    null,
    xla_h.ledger_id LEDGER_ID,
    NVL(xla_l.entered_dr,0) LINE_ENTERED_DR,
    NVL(xla_l.entered_cr,0) LINE_ENTERED_CR,
    te.ledger_id trx_ledger_id,
    te.legal_entity_id,
    et.entity_code,
    te.source_id_int_1,
    te.source_id_int_2,
    te.source_id_int_3,
    te.source_id_int_4,
    te.source_id_char_1,
    te.source_id_char_2,
    te.source_id_char_3,
    te.source_id_char_4,
    te.security_id_int_1,
    te.security_id_int_2,
    te.security_id_int_3,
    te.security_id_char_1,
    te.security_id_char_2,
    te.security_id_char_3,
    te.valuation_method,
    xla_h.application_id,
    xs.drilldown_procedure_name,
    GL_CUSTOM_DRILL_DOWN.get_trx_description(te.source_id_int_1,et.entity_code) description,-- gl_l.description LINE_DESCRIPTION,
    cii.instance_number FLEET_NUMBER,
    (select a.vendor_name
    from RCV_VRC_TXS_VENDINT_V a
    where a.wip_entity_id = wta.wip_entity_id
    AND a.organization_id = wta.organization_id
    and a.item_id = cii.inventory_item_id) Vendor_Name,
    xs.je_source_name JournalSource,
    xla_h.je_category_name JournalCategory,
    gl_l.JE_LINE_NUM Line
    FROM xla.xla_ae_lines XLA_L,
    xla.xla_ae_headers xla_h,
    xla_gl_ledgers_v gl ,
    xla_lookups lk5,
    xla_lookups lk7,
    xla.xla_events xla_e ,
    xla.xla_event_types_tl et,
    xla.xla_event_classes_tl ec,
    xla.xla_transaction_entities te,
    gl_budget_versions bud,
    gl_import_references ir,
    xla.xla_subledgers xs,
    gl_je_lines gl_l,
    wip_transaction_accounts wta,
    XLA_TRANSACTION_ENTITIES_upg xte,
    xla_distribution_links xdl,
    -- mtl_material_transactions mmt,
    WIP_ENTITIES WIE,
    WIP_DISCRETE_JOBS WDJ,
    csi_item_instances CII
    where
    ir.gl_sl_link_table=XLA_L.gl_sl_link_table
    and gl_l.period_name =NVL(:7,gl_l.period_name)
    and gl_l.code_combination_id = :8
    and xla_h.ae_header_id = xla_l.ae_header_id
    AND xla_h.application_id = xla_l.application_id
    AND lk7.lookup_code(+) = xla_l.accounting_class_code
    AND lk7.lookup_type(+) = 'XLA_ACCOUNTING_CLASS'
    AND xla_e.event_id = xla_h.event_id
    AND xla_e.application_id = xla_h.application_id
    AND xs.application_id =xla_h.application_id
    AND te.entity_id =xla_h.entity_id
    AND te.application_id =xla_l.application_id --xla_h.application_id
    AND ec.application_id = et.application_id
    AND ec.entity_code = et.entity_code
    AND ec.event_class_code = et.event_class_code
    AND ec.language = USERENV('LANG')
    AND et.application_id = xla_h.application_id
    AND et.event_type_code = xla_h.event_type_code
    AND et.language = USERENV('LANG')
    AND lk5.lookup_code = NVL(xla_h.funds_status_code, 'REQUIRED')
    AND lk5.lookup_type = 'XLA_FUNDS_STATUS'
    AND bud.budget_version_id(+) = xla_h.budget_version_id
    AND wta.reference_account = gl_l.code_combination_id
    and wta.transaction_id = xte.source_id_int_1(+)
    and xte.entity_id = xla_e.entity_id
    and xdl.source_distribution_type = 'WIP_TRANSACTION_ACCOUNTS'
    and xdl.source_distribution_id_num_1 = wta.wip_sub_ledger_id(+)
    and xdl.APPLICATION_ID=707
    and xla_h.ae_header_id = xdl.ae_header_id
    and xdl.ae_header_id = XLA_L.ae_header_id
    and ir.gl_sl_link_table = 'XLAJEL'
    and ir.gl_sl_link_id = XLA_L.gl_sl_link_id
    and gl_l.je_header_id = ir.je_header_id
    and gl_l.je_line_num = ir.je_line_num
    and wie.wip_entity_id = wta.wip_entity_id
    AND wta.organization_id = wdj.organization_id
    and wie.wip_entity_id = wdj.wip_entity_id
    and wdj.asset_group_id = cii.inventory_item_id
    and wdj.maintenance_object_id=cii.instance_id
    and xs.je_source_name = 'Cost Management'
    Please help me in tuning the above query.
    Thanks
    Raghava

  • Query taking too long to execute

    Hi All,
    I have just moved a cube from DEV to Q and loaded the data(using INIT). I have created a query to test the data. When I execute the query, the initial result is showing up quickly but when I drill down using one char, say CHAR ABC, it is taking a lot time(I am waiting from last 25 min to see the result but it is still running). The same query is not taking any time when run in T. What could be the problem. This query is my first query in Q.
    Any suggestions would be highly appreciated.
    Best Rgds,
    James.

    GO to RSRV and you will see a an option " All combined tests.
    IN that, you will see " Check data for master data". Double click that and enter your CHAR* and run the test.
    Next under transaction data " run each of the tests" for the ODS / Cube that you run the report from.
    These tests usually will point to inconsistency. You may also want to look the design of cube / ODS. In ODS, you may have to check the key fields.
    Ravi Thothadri

  • Insert statement taking too long

    Hi,
    I am inserting in a TAB_A from TAB_B using following statement
    INSERT INTO TAB_A
    SELECT * FROM TAB_B;
    In TAB_A more than 98000000 rows exits. While in TAB_B rows may be vary from 1000 to 1000000.
    TAB_A is a partition table.
    This insert is taking more than 3 hrs to insert 800000 rows from TAB_B.
    I need to improve performance of this insert statement.
    Can you please help me ???

    Hi,
    Try this:
    INSERT INTO tab_a SELECT /*+append*/  * FROM tab_b;                                                                                                                                                                                           

  • Background Job RSPPFPROCESS Taking too long to execute.

    Hi Gurus,
    I'm working with SAP CRM 2007 - Interaction Centre
    We have configured first response date and to do by date in item category.
    If agent fails to response within the first response date or if agent fails to complete
    to close the ticket within the to do by date,An action is configured to trigger and an
    escalation email(Smart Form) is sent to agent`s manager inbox.
    We have scheduled background job for the program RSPPFPROCESS with variant in background
    to trigger this actions( It is scheduled 4 times in a day ).
    Previously this job used to take 6 hours to complete execution.
    But now its taking 12 hours to complete the execution and there is no change in the
    variant.
    Can anyone please advice me reason for this behavior.
    Kind Regards,
    Vinod

    Hi Manfred,
    We are experiencing similar performance issue when running the RSPPFPROCESS  Job. We opened a OSS message for quite some time but didn't get any useful help from SAP.
    Can you please provide more information regarding your ZRSPPFPROCESS program on identifying the crtical performance steps to resolve the performance issue? We are also thinking of archiving  the record in table PPFTTRIGG , we have over 73+ millions records in the table but there is no archiving object for PPF actions. We would like to focus on reducing the number of entries in the table PPFTTRIGG hopefully to improve the performance. Any thoughts on it?
    Thanks in advance for your kind help!
    Best Regards,
    Madeline

  • Update statement taking too much time

    Hi All,
    I defined a cursor in which there are almost 94 lakh records and i want to update few fields of a table from another table which takes data over a dblink.
    my cursor is
    cursor c_tpo is
          select t.loc_loc_id,
                 t.till_no,
                 t.transaction_date,
                 t.sales_audit_txn_no,
                 t.third_party_order_ref
            from dwt_om_email_addresses t
           where (t.merc_loaded_date_time is null or t.ws_ordered_date_time is null or
                 t.copos_ordered_date_time is null)
    -- And for loop is
    for i in c_tpo loop
        select count(*)
          into ln_count
          from web_sales@nrstp
         where dmw_order = i.third_party_order_ref;
        if ln_count = 1 then
          select date_loaded, order_date, order_date, pkt_ctrl_nbr
            into ld_merc_load_date,
                 ld_ws_order_date,
                 ld_cop_order_date,
                 lc_pkt_ctrl_nbr
            from web_sales@nrstp
           where dmw_order = i.third_party_order_ref;
          update dwt_om_email_addresses t
             set merc_loaded_date_time   = ld_merc_load_date,
                 ws_ordered_date_time    = ld_ws_order_date,
                 copos_ordered_date_time = ld_cop_order_date
           where t.loc_loc_id = i.loc_loc_id
             and t.till_no = i.till_no
             and t.transaction_date = i.transaction_date
             and t.sales_audit_txn_no = i.sales_audit_txn_no;
      end if;
        ln_count          := 0;
        ln_count_pkt      := 0;
        ld_merc_load_date := null;
        ld_ws_order_date  := null;
        ld_cop_order_date := null;
        ld_pkms_date_time := null;
        lc_pkt_ctrl_nbr   := null;
      end loop;
      -----------The ln_count is used to avoid the exception no_data_found and too_many_rows. How do I speed up the process as it takes 1 hr to update 500 records.
    What would be the best approach to achieve this in less time.
    Thanks

    if you check the your condition some where you have metioned
    dmw_order = t.third_party_order_ref
    if both of these are unique keys or primary key then there is no problem
    but if for there are multiple values edit the query by using
    rownum <= 1
    update dwt_om_email_addresses t
    set (merc_loaded_date_time,ws_ordered_date_time,copos_ordered_date_time) =(select date_loaded, order_date, order_date, pkt_ctrl_nbr from( select date_loaded, order_date, order_date, pkt_ctrl_nbr
                                                                                 from web_sales@nrstp
                                                                                  where dmw_order = t.third_party_order_ref)
    where rownum<=1)
    where exists  (select '1'
                  from web_sales@nrstp i
                  where t.loc_loc_id = i.loc_loc_id
                  and t.till_no = i.till_no
                  and t.transaction_date = i.transaction_date
                  and t.sales_audit_txn_no = i.sales_audit_txn_no
                  and (t.merc_loaded_date_time is null or t.ws_ordered_date_time is null or
                 t.copos_ordered_date_time is null));and for exists clause there is no problem
    Edited by: 810345 on Jun 10, 2011 4:07 PM
    Edited by: 810345 on Jun 10, 2011 4:08 PM

  • HT4623 Why is Software update is taking too long?

    Im trying to update my iPhone 3gs 5.0.1 to 6.1.2 and I received an Error "iPhone software update failed" i tried it several times but nothing happened

    Are you trying to do on your phone or with iTunes?   Most people here would advise to do an update in iTunes and to not forget to back up your phone first before doing so.

  • Query taking too long to execute on Oracle 9i

    Mark,
    If you remember, I was working on a large xml document with deep nested complex elements.
    I am trying to query the document and as such I am running a join query. The database is not able to run this query and I am wondering if there is any alternate way to rephrase this query.
    PS: I have run this query for almost 24 hrs without any result.
    Here is the query:
    select extract(value(X),'//eNest[@aSixtyFour=2][@aUnique1=//eNest[@aSixtyFour=2]/@aUnique1]/@aUnique1')
    from OracleBench_No_Schema X
    any feedback would be extremely helpful
    Thanks
    JN

    John
    I'm not sure that I can be of much more help at the moment. We are working to improive the performance of //queries over recursive structures. These enhancements will appear in future release of the product.

Maybe you are looking for

  • Zen VW not showing up in Media Sou

    I have a one year old Zen VW. I recently reformatted my pc, it had been two years on that install and needed it. Anyway when I reinstalled everything back my Zen is not recognized by Creative Media Source. When I connected it via USB, Windows sees th

  • Another Install Problem (With Log Files)

    Hey there. I've read many of the install problem threads and have tried numerous things to get this working, but to no avail. This is getting VERY frustrating.. :-E Machine is a Dell Latitude with 1Gb mem, Running XP Pro SP2. My login ID is dgault. I

  • UIX Tree Component

    I have an issue with using tree component for our application. We need to provide expand/collapse facility for tree component (using default (+) and (-) icons). Does ADF_UIX support s for this situation. Please provide me any guideline....

  • Adobe Creative Suite 5 Web Premium - Aufrüstung DW CS5.5

    Hallo - ich bräuchte mal dringend Hilfe - BITTE ich habe die Adobe Creative Suite CS5 Web Premium - und möchte diese nun nur mit DW CS5.5 aufrüsten - funkt das oder MUSS ich mir die komplette Suite CS5.5 besorgen??? Lieben DANK

  • Gedit fails to open as root in terminal

    When I start a terminal, I enter "su -" When I try to open any file, or simply enter gedit, I get: ======================================== ** (gedit:1216): WARNING **: Could not open X display Cannot open display: ===================================