Same select statement taking more time

Hello all,
I have two select statements. only the name of table from where it is fetching records are different.
1) select belnr posnr etenr into corresponding fields of table it_cdtemp2
from j_3avasso for all entries in it_cdtemp1
where belnr = it_cdtemp1-vbeln and posnr = it_cdtemp1-posnr .
it_cdtemp1 has 100 entries and j_3avasso has 20000 entries
2) select belnr posnr etenr into corresponding fields of table it_cdtemp2
from j_3avap for all entries in it_cdtemp1
where belnr = it_cdtemp1-vbeln and posnr = it_cdtemp1-posnr .
it_cdtemp1 has 100 entries and j_3avasso has 2000 entries
statement 1 is executing less than a minute where as statement 2 is taking around 15 to 20 minutes
could anyone suggest why.. if so how to minimize run time
Regards
Bala

Hi,
You can sort the internal table before using FOR ALL ENTRIES BY VBELN and POSNR.
This will save a lot of processing time.
You can also try combing both the selects as one join statement taking both the tables with for all entries addition.
Regards,
Subhashini
Edited by: Subhashini K on Oct 8, 2009 2:58 PM

Similar Messages

  • Select Statement taking more time.How to improve the query performance.

    SELECT DISTINCT ORDERKEY, SUM(IMPRESSIONCNT) AS ActualImpressions ,SUM(DiscountedSales)AS ActualRevenue ,SUM(AgencyCommAmt) as AgencyCommAmt
    ,SUM(SalesHouseCommAMT) as SalesHouseCommAMT
    --INTO Anticiapted_ADXActualsMeasures
    FROM AdRevenueFact_ADX ADx WITH(NOLOCK)
    Where FiscalMonthkey >=201301 and Exists (Select 1 from Anticipated_cdr_AX_OrderItem OI Where Adx.Orderkey=Oi.Orderkey)
    GROUP BY ORDERKEY
    Clustered indexes on orderkey,fiscalmonthkey and orderkey in AdRevenueFact_ADX(contain more than 170 million rows)
    thanks

    As mentioned by Kalman, if your clustered index starts with Orderkey, then this query will require a full table scan. If it is an option to change the clustered index in such a way that FiscalMonthkey is the leading column, then only the data of the last
    two year has to be queried.
    In addition, you should have a look at the indexes of table Anticipated_cdr_AX_OrderItem. Ideally, there is a nonclustered index on Orderkey.
    To get better advice, please post the query plan and list all available indexes of these tables.
    Finally, an off topic remark: it is a good practice to keep consistent spelling of object names, and to keep the same spelling as their declaration. Your query would cause serious problems if the database is ever run with case sensitive collation.
    Gert-Jan

  • Select query taking more time..

    Hi friends..
    The below inner join statement is taking more time ,  can any  body sugget me to improve the performance . I tried FOR ALL ENTRIES also but that also taking more time than inner join statement .
    SELECT a~vbeln from vbap as a inner join vakpa as b
          on avbeln = bvbeln
          into corresponding fields of table IT_VAKPA
          where a~WERKS IN S_IWERKS
          and a~pstyv NE 'ZRS'
          and b~vkorg = IVKORG
          and b~audat IN IAUDAT
          and b~vtweg IN IVTWEG.
    Regards
    Chetan

    Hi Chetan ,
    VAKPA is an index table. From the select query , it has been observed that you are not fetching any data from VAKPA. Only you have added some selection paramenters in where clause of select query.
    My suggestion will be instead of using VAKPA in inner join you use VBAK along with VBAP. All the fields that you are using as selection condition from VAKPA are there in VBAK.
    I am sure performance of query will be improved.
    If still duo to business logic you need to use VAKPA, try to create secondary non unique index on fields VKORD,AUDATand VTWEG on table VAKPA.
    However I will recommend you to go for first option only. If this does not work then go for second option.
    Hopfully this will help you.
    Regards,
    Nikhil

  • Select Statement takes more time after immediate insert statement..

    Hello,
    I found below scenario
    1. I have table TABLE1 which has index on COL1 field. It has around 40 columns and 100000 rows.
    2. whenever i insert 100000 rows in bulk with changing indexed key column and executing SELECT statement in same session then it takes around 3 mins to complete.
    3. However, if i open new session and execute same select statement then it returns in 2-3 seconds.
    I didnt get anything in XPLAN.. :(
    I felt Buffer Clean is cause to take time. please let me know your opinion.
    Thanks in Advance
    Sach

    sach09 wrote:
    Hello,
    I found below scenario
    1. I have table TABLE1 which has index on COL1 field. It has around 40 columns and 100000 rows.
    2. whenever i insert 100000 rows in bulk with changing indexed key column and executing SELECT statement in same session then it takes around 3 mins to complete.
    3. However, if i open new session and execute same select statement then it returns in 2-3 seconds.
    I didnt get anything in XPLAN.. :(
    I felt Buffer Clean is cause to take time. please let me know your opinion.Are you running the query in the other session after running it from the first?
    Aman....

  • Select statement taking much time.......

    Hi,
    IF NOT i601[] is initial.
    select vbelv
           posnv
           vbeln
           posnn
           vbtyp_v
           matnr
           from vbfa into table ivbfa
           FOR ALL ENTRIES IN i601
           where vbeln  = i601-mblnr and
                 posnn  = i601-zeile2 and
                 vbtyp_v = 'J'.
    select vbeln
           matnr
           werks
           lgort
           vgbel
           vgpos
           mwsbp
    from vbrp into table ivbrp
    FOR ALL ENTRIES IN ivbfa
    where vgbel = ivbfa-vbelv and
          vgpos = ivbfa-posnv and
          vgtyp = 'J' and
          werks IN werks.
    CLEAR i601.
    FREE i601.
    ENDIF.
    At the above highlighted select statement it is getting stucked up.I was not able to figure out the reason.No loops nothing but still is not moving from the second select statement,quite a long time it is taking.Can any one here throw some light.By the way none of the fields in the where clause of the 2nd select are primary keys.
    Thanks,
    K.Kiran.

    Hi,
    In second table you are tring to extract the records without passing the primary key values...
    Any how you have values vbeln ,posnr in internal table i601.So pass those values to VBRP.
    IF NOT i601[] is initial.
    select vbelv
    posnv
    vbeln
    posnn
    vbtyp_v
    matnr
    from vbfa into table ivbfa
    FOR ALL ENTRIES IN i601
    where vbeln = i601-mblnr and
    posnn = i601-zeile2 and
    vbtyp_v = 'J'.
    IF NOT ivbfa[] IS INITIAL
    select vbeln
    matnr
    werks
    lgort
    vgbel
    vgpos
    mwsbp
    from vbrp into table ivbrp
    FOR ALL ENTRIES IN ivbfa
    where *vbeln = ivbfa-vbeln  AND *
               posnr = ivbfa-posnv AND
               vgbel = ivbfa-vbelv and
               vgpos = ivbfa-posnv and
               vgtyp = 'J' and
               werks IN werks.
    ENDIF.
    CLEAR i601.
    FREE i601.
    ENDIF.
    Now check your  program.
    Pls. reward if useful.....

  • Insert statement taking more time

    Hi,
    Insert happening very slow after sqlldr happening in my program. Please find the below workflow of my program.
    1) SQLLDR will be called, it will insert around 4 lakhs records in 'TEMP" table using direct path load.Response time is good here.
    2)After, SQLLDR has finished its job, my procedure will be called, there every cursor statement working fine, but when it comes for "INSERT" statement it takes almost 40 mins.
    3)Insert statement like this
    INSERT /*+ append */ INTO HISTORY_TABLE(<COLUMN1>,<COLUMN2>,..etc) SELECT (<COLUMN1>,.<COLUMN2>...etc) from TEMP_TABLE;
    4)select records from temp table which records were inserted during sqlldr(direct=true),before procedure call.
    5)I check explain plan for the Insert statement it shows conventional path loading
    | Id  | Operation                | Name             | Rows  | Bytes | Cost (%CPU)|
    |   0 | INSERT STATEMENT         |                  |   409K|   143M|  6752   (2)|
    |   1 |  LOAD AS SELECT          | HISTORY_TABLE    |       |       |            |
    |   2 |   TABLE ACCESS FULL      | TEMP_TABLE       |   409K|   143M|  6752   (2)|
    6)Since i have no where condition in my insert statement it go for an full table scan.
    Kindly advice to impove its performance.
    My db is oracle 11g r2(11.2.0.3.0)
    OS-Windows server 2008 r2
    Tkprof for the sesion:
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      1     98.10    1860.58     347770      74736    1711253      407077
    Fetch        0      0.00       0.00          0          0          0           0
    total        1     98.10    1860.58     347770      74736    1711253      407077
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 84     (recursive depth: 1)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                    256304        6.61       1299.01
      direct path read temp                         273        3.47         14.99
      log buffer space                               22        0.75          3.84
      log file switch completion                      7       19.48         30.70
      log file switch (checkpoint incomplete)        16        8.12         17.15
      db file parallel read                           2        0.07          0.09
      log file switch (private strand flush incomplete)
                                                      3        0.32          0.74
      buffer busy waits                               4        0.00          0.00
      undo segment extension                          2        0.00          0.00
    SQL> show parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_capture_sql_plan_baselines boolean     FALSE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      11.2.0.3
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    optimizer_use_invisible_indexes      boolean     FALSE
    optimizer_use_pending_statistics     boolean     FALSE
    optimizer_use_sql_plan_baselines     boolean     TRUE
    SQL> show parameter db_file_multi
    NAME                                 TYPE        VALUE
    db_file_multiblock_read_count        integer     128
    SQL> show parameter db_block_size
    NAME                                 TYPE        VALUE
    db_block_size                        integer     8192
    SQL> show parameter cursor_sharing
    NAME                                 TYPE        VALUE
    cursor_sharing                       string      EXACT
    SQL>
    SQL> l
      1  select
      2* sname,pname,pval1,pval2 from sys.aux_stats$
    SQL> /
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          11-03-2011 06:38
    SYSSTATS_INFO        DSTOP                           11-03-2011 06:38
    SYSSTATS_INFO        FLAGS                         1
    SYSSTATS_MAIN        CPUSPEEDNW           1720.20725
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM
    SYSSTATS_MAIN        MREADTIM
    SYSSTATS_MAIN        CPUSPEED
    SYSSTATS_MAIN        MBRC
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_MAIN        MAXTHR
    SYSSTATS_MAIN        SLAVETHR
    Thanks
    Faiz

    Hi,
    Below i apend the both table definitions. Please check
    CREATE TABLE HISTORY_TABLE
       ( DAT_TIM VARCHAR2(19 BYTE),
    REC_TYP VARCHAR2(2 BYTE),
    AUTH_PPD VARCHAR2(4 BYTE),
    LN_TERM VARCHAR2(4 BYTE),
    FIID_TERM VARCHAR2(4 BYTE),
    TERM_ID VARCHAR2(16 BYTE),
    LN_ISSUER VARCHAR2(4 BYTE),
    FIID_ISSUER VARCHAR2(20 BYTE),
    PAN VARCHAR2(19 BYTE),
    MBR_NUM VARCHAR2(3 BYTE),
    BRCH_ID VARCHAR2(4 BYTE),
    REGN_ID VARCHAR2(4 BYTE),
    USER_FLD1X VARCHAR2(2 BYTE),
    TYP_CDE VARCHAR2(2 BYTE),
    TYP VARCHAR2(4 BYTE),
    RTE_STAT VARCHAR2(2 BYTE),
    ORIGINATOR CHAR(1 BYTE),
    RESPONDER CHAR(1 BYTE),
    ENTRY_TIM VARCHAR2(19 BYTE),
    EXIT_TIM VARCHAR2(19 BYTE),
    RE_ENTRY_TIM VARCHAR2(19 BYTE),
    TRAN_DAT VARCHAR2(6 BYTE),
    TRAN_TIM VARCHAR2(8 BYTE),
    POST_DAT VARCHAR2(6 BYTE),
    ACQ_ICHG_SETL_DAT VARCHAR2(6 BYTE),
    ISS_ICHG_SETL_DAT VARCHAR2(6 BYTE),
    SEQ_NUM VARCHAR2(12 BYTE),
    TERM_TYP VARCHAR2(2 BYTE),
    TIM_OFST VARCHAR2(5 BYTE),
    ACQ_INST_ID_NUM VARCHAR2(11 BYTE),
    RCV_INST_ID_NUM VARCHAR2(11 BYTE),
    T_CDE VARCHAR2(2 BYTE),
    T_FROM VARCHAR2(2 BYTE),
    T_TO VARCHAR2(2 BYTE),
    FROM_ACCT VARCHAR2(24 BYTE),
    USER_FLD1 VARCHAR2(1 BYTE),
    TO_ACCT VARCHAR2(19 BYTE),
    MULT_ACCT VARCHAR2(1 BYTE),
    AMT1 VARCHAR2(19 BYTE),
    AMT2 VARCHAR2(19 BYTE),
    AMT3 VARCHAR2(19 BYTE),
    DEP_BAL_CR VARCHAR2(10 BYTE),
    DEP_TYP VARCHAR2(1 BYTE),
    RESP_BYTE1 VARCHAR2(3 BYTE),
    RESP_BYTE2 VARCHAR2(3 BYTE),
    TERM_NAME_LOC VARCHAR2(25 BYTE),
    TERM_OWNER_NAME VARCHAR2(40 BYTE),
    TERM_CITY VARCHAR2(13 BYTE),
    TERM_ST_X VARCHAR2(3 BYTE),
    TERM_CNTRY_X VARCHAR2(2 BYTE),
    OSEQ_NUM VARCHAR2(12 BYTE),
    OTRAN_DAT VARCHAR2(4 BYTE),
    OTRAN_TIM VARCHAR2(8 BYTE),
    B24_POST_DAT VARCHAR2(4 BYTE),
    ORIG_CRNCY_CDE VARCHAR2(3 BYTE),
    AUTH_CRNCY_CDE VARCHAR2(3 BYTE),
    AUTH_CONV_RATE VARCHAR2(8 BYTE),
    SETL_CRNCY_CDE VARCHAR2(3 BYTE),
    SETL_CONV_RATE VARCHAR2(8 BYTE),
    CONV_DAT_TIM VARCHAR2(19 BYTE),
    RVSL_RSN VARCHAR2(2 BYTE),
    PIN_OFST VARCHAR2(16 BYTE),
    SHRG_GRP VARCHAR2(1 BYTE),
    DEST_ORDER VARCHAR2(1 BYTE),
    AUTH_ID_RESP VARCHAR2(6 BYTE),
    IMP_IND VARCHAR2(1 BYTE),
    AVAIL_IMP VARCHAR2(2 BYTE),
    LEDG_IMP VARCHAR2(2 BYTE),
    HLD_AMT_IMP VARCHAR2(2 BYTE),
    CAF_REFR_IND VARCHAR2(1 BYTE),
    USER_FLD3 VARCHAR2(1 BYTE),
    DEP_SETL_IMP_FLG VARCHAR2(1 BYTE),
    ADJ_SETL_IMP_FLG VARCHAR2(1 BYTE),
    PBF1 VARCHAR2(1 BYTE),
    PBF2 VARCHAR2(1 BYTE),
    PBF3 VARCHAR2(1 BYTE),
    PBF4 VARCHAR2(1 BYTE),
    USER_FLD4 VARCHAR2(16 BYTE),
    FRWD_INST_ID_NUM VARCHAR2(11 BYTE),
    CRD_ACCPT_ID_NUM VARCHAR2(40 BYTE),
    CRD_ISS_ID_NUM VARCHAR2(11 BYTE),
    USER_FLD6 VARCHAR2(1 BYTE),
    FILE_NAME VARCHAR2(100 BYTE),
    ERR_FLAG CHAR(1 BYTE),
    AMT2_ACTUAL VARCHAR2(20 BYTE),
    ID_COL NUMBER(23,0),
    RVSL_FLAG CHAR(1 BYTE),
    SWRE_ID VARCHAR2(20 BYTE),
    GAC_ID VARCHAR2(20 BYTE),
    INS_USER NUMBER(5,0),
    PART_CODE NUMBER(3,0),
    ISS_RECON NUMBER(1,0),
    ACQ_RECON NUMBER(1,0),
    CROSS_BRANCH CHAR(1 BYTE),
    CONSORTIUM_CODE NUMBER(3,0),
    FROM_HOST VARCHAR2(1 BYTE),
    FROM_HOST_ACQ VARCHAR2(1 BYTE),
    AUDIT_NUM VARCHAR2(12 BYTE),
    CAPTURE_CODE VARCHAR2(1 BYTE),
    RESP_DAT_TIME VARCHAR2(19 BYTE),
    PAN_SEQ_NUM NUMBER(1,0),
    SERVICE_CODE VARCHAR2(3 BYTE),
    ISS_BIN VARCHAR2(6 BYTE),
    POS_DATA VARCHAR2(12 BYTE),
    SECURITY_DATA VARCHAR2(8 BYTE),
    CASHBACK_AMT VARCHAR2(15 BYTE),
    REPLACEMENT_AMOUNT VARCHAR2(15 BYTE),
    SETTL_AMT VARCHAR2(16 BYTE),
    TRAN_FEE VARCHAR2(15 BYTE),
    SETL_FEE VARCHAR2(15 BYTE),
    MERC_CODE VARCHAR2(4 BYTE),
    NTWORK_DATA VARCHAR2(12 BYTE),
    PRIVATE_DATA_C_100 VARCHAR2(100 BYTE),
    PAYMENT_INFO VARCHAR2(50 BYTE),
    SURCHARGE_FEE VARCHAR2(15 BYTE),
    SURC_BILL_AMT VARCHAR2(19 BYTE),
    PROCESSING_CODE VARCHAR2(7 BYTE),
    FRWD_CNTRY_CODE VARCHAR2(3 BYTE),
    NTWORK_CODE VARCHAR2(2 BYTE),
    FUNCTION_CODE VARCHAR2(3 BYTE),
    REASON_CODE VARCHAR2(4 BYTE),
    FEES VARCHAR2(10 BYTE),
    SUR_CHARGE VARCHAR2(10 BYTE),
    MESSAGE_TYPE VARCHAR2(4 BYTE),
    APPROVE_STATUS VARCHAR2(10 BYTE),
    CPS_TRAN_ID VARCHAR2(20 BYTE),
    BANKTYPE_CODE VARCHAR2(5 BYTE),
    RRB_BIN_CODE VARCHAR2(7 BYTE),
    T_TYPE VARCHAR2(5 BYTE),
    FEE_CRNCY VARCHAR2(25 BYTE),
    FEE_INDICATOR VARCHAR2(1 BYTE),
    FEE_TYPE VARCHAR2(84 BYTE),
    CREDIT_BANK_CODE VARCHAR2(11 BYTE),
    CREDIT_BR_CODE VARCHAR2(8 BYTE),
    DEBIT_BANK_CODE VARCHAR2(11 BYTE),
    ACTION_CODE VARCHAR2(3 BYTE),
    ZEROS VARCHAR2(6 BYTE),
    OTRACE_AUDIT_NO VARCHAR2(6 BYTE),
    OFEE_TYPE1 VARCHAR2(2 BYTE),
    OFEE_CRNCY1 VARCHAR2(3 BYTE),
    OFEE_AMNT VARCHAR2(16 BYTE),
    OFEE_INDICATOR VARCHAR2(1 BYTE),
    SPACES VARCHAR2(2 BYTE),
    ACQ_BANK_CODE VARCHAR2(6 BYTE),
    CASHAT_POS VARCHAR2(16 BYTE),
    LTS_STATUS VARCHAR2(30 BYTE),
    APP_CODE VARCHAR2(6 BYTE),
    CARD_ACCEPTID VARCHAR2(15 BYTE),
    RESPONSE_CODE VARCHAR2(15 BYTE),
    RES_RECVD_HOST VARCHAR2(1 BYTE),
    DEVICE_ID VARCHAR2(16 BYTE),
    RECORD_TYPE VARCHAR2(1 BYTE),
    RRT_DEBIT_BANK_CODE VARCHAR2(11 BYTE),
    ORIG_TYP VARCHAR2(6 BYTE),
    DEVICE_TYPE VARCHAR2(3 BYTE),
    ORGTRAN_CODE VARCHAR2(4 BYTE),
    BILL_CRNCY VARCHAR2(3 BYTE),
    BILL_AMNT VARCHAR2(19 BYTE),
    OTRAN_AMNT VARCHAR2(19 BYTE),
    INS_DATE DATE,
    RECON_FLAG VARCHAR2(2 BYTE),
    TRAN_ID VARCHAR2(25 BYTE)
       ) SEGMENT CREATION IMMEDIATE
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
    NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_TST ;
      CREATE INDEX CMS_ALL_SWT_DATA_INDEX ON HISTORY_TABLE (TYP, DEVICE_ID, FROM_ACCT, AMT1, NTWORK_CODE, ISS_BIN, POST_DAT, RESP_BYTE1, DEVICE_TYPE, T_CDE, PRIVATE_DATA_C_100, REASON_CODE)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX CMS_ALL_SWT_DATA_INDEX1 ON HISTORY_TABLE (TO_NUMBER(AMT1))
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX CMS_ALL_SWT_DATA_INDEX_FN ON HISTORY_TABLE (SUBSTR(DEVICE_ID,4))
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX CMS_ALL_SWT_DATA_INDEX_IDX ON HISTORY_TABLE (T_CDE, PRIVATE_DATA_C_100, ISS_BIN)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX CMS_ALL_SWT_DATA_INDEX_TST ON HISTORY_TABLE (TYP, POST_DAT, RESP_BYTE1, DEVICE_TYPE, AMT1)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX CMS_ALL_SWT_DATA_INDEX_TST1 ON HISTORY_TABLE (DEVICE_TYPE, TO_NUMBER(AMT1))
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX IDX_ALLSWT_PAN ON HISTORY_TABLE (PAN)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
    Table Definition for TEMP Table:
    CREATE TABLE REC_TLF_TEMP
       ( DAT_TIM VARCHAR2(19 BYTE),
    REC_TYP VARCHAR2(2 BYTE),
    AUTH_PPD VARCHAR2(4 BYTE),
    LN_TERM VARCHAR2(4 BYTE),
    FIID_TERM VARCHAR2(4 BYTE),
    TERM_ID VARCHAR2(16 BYTE),
    LN_ISSUER VARCHAR2(4 BYTE),
    FIID_ISSUER VARCHAR2(20 BYTE),
    PAN VARCHAR2(19 BYTE),
    MBR_NUM VARCHAR2(3 BYTE),
    BRCH_ID VARCHAR2(4 BYTE),
    REGN_ID VARCHAR2(4 BYTE),
    USER_FLD1X VARCHAR2(2 BYTE),
    TYP_CDE VARCHAR2(2 BYTE),
    TYP VARCHAR2(4 BYTE),
    RTE_STAT VARCHAR2(2 BYTE),
    ORIGINATOR CHAR(1 BYTE),
    RESPONDER CHAR(1 BYTE),
    ENTRY_TIM VARCHAR2(19 BYTE),
    EXIT_TIM VARCHAR2(19 BYTE),
    RE_ENTRY_TIM VARCHAR2(19 BYTE),
    TRAN_DAT VARCHAR2(6 BYTE),
    TRAN_TIM VARCHAR2(8 BYTE),
    POST_DAT VARCHAR2(6 BYTE),
    ACQ_ICHG_SETL_DAT VARCHAR2(6 BYTE),
    ISS_ICHG_SETL_DAT VARCHAR2(6 BYTE),
    SEQ_NUM VARCHAR2(12 BYTE),
    TERM_TYP VARCHAR2(2 BYTE),
    TIM_OFST VARCHAR2(5 BYTE),
    ACQ_INST_ID_NUM VARCHAR2(11 BYTE),
    RCV_INST_ID_NUM VARCHAR2(11 BYTE),
    T_CDE VARCHAR2(2 BYTE),
    T_FROM VARCHAR2(2 BYTE),
    T_TO VARCHAR2(2 BYTE),
    FROM_ACCT VARCHAR2(24 BYTE),
    USER_FLD1 VARCHAR2(1 BYTE),
    TO_ACCT VARCHAR2(19 BYTE),
    MULT_ACCT VARCHAR2(1 BYTE),
    AMT1 VARCHAR2(19 BYTE),
    AMT2 VARCHAR2(19 BYTE),
    AMT3 VARCHAR2(19 BYTE),
    DEP_BAL_CR VARCHAR2(10 BYTE),
    DEP_TYP VARCHAR2(1 BYTE),
    RESP_BYTE1 VARCHAR2(3 BYTE),
    RESP_BYTE2 VARCHAR2(3 BYTE),
    TERM_NAME_LOC VARCHAR2(25 BYTE),
    TERM_OWNER_NAME VARCHAR2(40 BYTE),
    TERM_CITY VARCHAR2(13 BYTE),
    TERM_ST_X VARCHAR2(3 BYTE),
    TERM_CNTRY_X VARCHAR2(2 BYTE),
    OSEQ_NUM VARCHAR2(12 BYTE),
    OTRAN_DAT VARCHAR2(4 BYTE),
    OTRAN_TIM VARCHAR2(8 BYTE),
    B24_POST_DAT VARCHAR2(4 BYTE),
    ORIG_CRNCY_CDE VARCHAR2(3 BYTE),
    AUTH_CRNCY_CDE VARCHAR2(3 BYTE),
    AUTH_CONV_RATE VARCHAR2(8 BYTE),
    SETL_CRNCY_CDE VARCHAR2(3 BYTE),
    SETL_CONV_RATE VARCHAR2(8 BYTE),
    CONV_DAT_TIM VARCHAR2(19 BYTE),
    RVSL_RSN VARCHAR2(2 BYTE),
    PIN_OFST VARCHAR2(16 BYTE),
    SHRG_GRP VARCHAR2(1 BYTE),
    DEST_ORDER VARCHAR2(1 BYTE),
    AUTH_ID_RESP VARCHAR2(6 BYTE),
    IMP_IND VARCHAR2(1 BYTE),
    AVAIL_IMP VARCHAR2(2 BYTE),
    LEDG_IMP VARCHAR2(2 BYTE),
    HLD_AMT_IMP VARCHAR2(2 BYTE),
    CAF_REFR_IND VARCHAR2(1 BYTE),
    USER_FLD3 VARCHAR2(1 BYTE),
    DEP_SETL_IMP_FLG VARCHAR2(1 BYTE),
    ADJ_SETL_IMP_FLG VARCHAR2(1 BYTE),
    PBF1 VARCHAR2(1 BYTE),
    PBF2 VARCHAR2(1 BYTE),
    PBF3 VARCHAR2(1 BYTE),
    PBF4 VARCHAR2(1 BYTE),
    USER_FLD4 VARCHAR2(16 BYTE),
    FRWD_INST_ID_NUM VARCHAR2(11 BYTE),
    CRD_ACCPT_ID_NUM VARCHAR2(40 BYTE),
    CRD_ISS_ID_NUM VARCHAR2(11 BYTE),
    USER_FLD6 VARCHAR2(1 BYTE),
    FILE_NAME VARCHAR2(100 BYTE),
    ERR_FLAG CHAR(1 BYTE),
    AMT2_ACTUAL VARCHAR2(20 BYTE),
    ID_COL NUMBER(23,0),
    RVSL_FLAG CHAR(1 BYTE),
    SWRE_ID VARCHAR2(20 BYTE),
    GAC_ID VARCHAR2(20 BYTE),
    INS_USER NUMBER(5,0),
    PART_CODE NUMBER(3,0),
    ISS_RECON NUMBER(1,0),
    ACQ_RECON NUMBER(1,0),
    CROSS_BRANCH CHAR(1 BYTE),
    CONSORTIUM_CODE NUMBER(3,0),
    FROM_HOST VARCHAR2(1 BYTE),
    FROM_HOST_ACQ VARCHAR2(1 BYTE),
    AUDIT_NUM VARCHAR2(12 BYTE),
    CAPTURE_CODE VARCHAR2(1 BYTE),
    RESP_DAT_TIME VARCHAR2(19 BYTE),
    PAN_SEQ_NUM NUMBER(1,0),
    SERVICE_CODE VARCHAR2(3 BYTE),
    ISS_BIN VARCHAR2(6 BYTE),
    POS_DATA VARCHAR2(12 BYTE),
    SECURITY_DATA VARCHAR2(8 BYTE),
    CASHBACK_AMT VARCHAR2(15 BYTE),
    REPLACEMENT_AMOUNT VARCHAR2(15 BYTE),
    SETTL_AMT VARCHAR2(16 BYTE),
    TRAN_FEE VARCHAR2(15 BYTE),
    SETL_FEE VARCHAR2(15 BYTE),
    MERC_CODE VARCHAR2(4 BYTE),
    NTWORK_DATA VARCHAR2(12 BYTE),
    PRIVATE_DATA_C_100 VARCHAR2(100 BYTE),
    PAYMENT_INFO VARCHAR2(50 BYTE),
    SURCHARGE_FEE VARCHAR2(15 BYTE),
    SURC_BILL_AMT VARCHAR2(19 BYTE),
    PROCESSING_CODE VARCHAR2(7 BYTE),
    FRWD_CNTRY_CODE VARCHAR2(3 BYTE),
    NTWORK_CODE VARCHAR2(2 BYTE),
    FUNCTION_CODE VARCHAR2(3 BYTE),
    REASON_CODE VARCHAR2(4 BYTE),
    FEES VARCHAR2(10 BYTE),
    SUR_CHARGE VARCHAR2(10 BYTE),
    MESSAGE_TYPE VARCHAR2(4 BYTE),
    APPROVE_STATUS VARCHAR2(10 BYTE),
    CPS_TRAN_ID VARCHAR2(20 BYTE),
    BANKTYPE_CODE VARCHAR2(5 BYTE),
    RRB_BIN_CODE VARCHAR2(7 BYTE),
    T_TYPE VARCHAR2(5 BYTE),
    FEE_CRNCY VARCHAR2(25 BYTE),
    FEE_INDICATOR VARCHAR2(1 BYTE),
    FEE_TYPE VARCHAR2(84 BYTE),
    CREDIT_BANK_CODE VARCHAR2(11 BYTE),
    CREDIT_BR_CODE VARCHAR2(8 BYTE),
    DEBIT_BANK_CODE VARCHAR2(11 BYTE),
    ACTION_CODE VARCHAR2(3 BYTE),
    ZEROS VARCHAR2(6 BYTE),
    OTRACE_AUDIT_NO VARCHAR2(6 BYTE),
    OFEE_TYPE1 VARCHAR2(2 BYTE),
    OFEE_CRNCY1 VARCHAR2(3 BYTE),
    OFEE_AMNT VARCHAR2(16 BYTE),
    OFEE_INDICATOR VARCHAR2(1 BYTE),
    SPACES VARCHAR2(2 BYTE),
    ACQ_BANK_CODE VARCHAR2(6 BYTE),
    CASHAT_POS VARCHAR2(16 BYTE),
    LTS_STATUS VARCHAR2(30 BYTE),
    APP_CODE VARCHAR2(6 BYTE),
    CARD_ACCEPTID VARCHAR2(15 BYTE),
    RESPONSE_CODE VARCHAR2(15 BYTE),
    RES_RECVD_HOST VARCHAR2(1 BYTE),
    DEVICE_ID VARCHAR2(16 BYTE),
    RECORD_TYPE VARCHAR2(1 BYTE),
    RRT_DEBIT_BANK_CODE VARCHAR2(11 BYTE),
    ORIG_TYP VARCHAR2(6 BYTE),
    DEVICE_TYPE VARCHAR2(3 BYTE),
    ORGTRAN_CODE VARCHAR2(4 BYTE),
    BILL_CRNCY VARCHAR2(3 BYTE),
    TRAN_ID VARCHAR2(25 BYTE),
    RECON_FLAG VARCHAR2(2 BYTE),
    BILL_AMNT VARCHAR2(19 BYTE),
    OTRAN_AMNT VARCHAR2(19 BYTE),
    INS_DATE DATE
       ) SEGMENT CREATION IMMEDIATE
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
    NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_TST ;
      CREATE INDEX CMS_TLF_TEMP_INDEX3 ON REC_TLF_TEMP (TO_NUMBER(PAN))
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX CMS_TLF_TEMP_INDEX4 ON REC_TLF_TEMP (TO_NUMBER(AUDIT_NUM))
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX IDX_REC_TEMP_CDE ON REC_TLF_TEMP (T_CDE)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_TST ;
      CREATE INDEX IDX_TLF_DEVICEID ON REC_TLF_TEMP (DEVICE_ID)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX IDX_TLF_PRIVATE ON REC_TLF_TEMP (PRIVATE_DATA_C_100)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_TST ;
      CREATE INDEX IDX_TLF_TEMP_BYTE1 ON REC_TLF_TEMP (PRIVATE_DATA_C_100, ISS_BIN, NTWORK_CODE)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_TST ;
      CREATE INDEX IDX_TLF_TEMP_TST ON REC_TLF_TEMP (RESP_BYTE1)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX IND_TLFTEMP_RVSLFLG ON REC_TLF_TEMP (RVSL_FLAG)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX IND_TLFTEMP_TRMID_TCD ON REC_TLF_TEMP (TERM_ID, T_CDE)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX IND_TLFTMP_NWCDE ON REC_TLF_TEMP (NTWORK_CODE)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX REC_TLF_TEMP_INDEX ON REC_TLF_TEMP (PAN, SEQ_NUM, AUDIT_NUM)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
      CREATE INDEX TEMPREVLSET ON REC_TLF_TEMP (SEQ_NUM, TYP, REC_TYP, PAN)
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE TBS_IDX ;
    It shows that no triggers for both the tables.
    Confirm that no where condition being used in the SQL.
    Thanks
    Faiz

  • XML Publisher(XDODTEXE) in EBS taking more time with the same SQL in TOAD

    HI
    XML Publisher(XDODTEXE) in EBS taking more time with the same SQL in TOAD.
    The sql has 5 union clauses.
    It takes 20-30 minutes in TOAD compared to running through Concurrent Program in XML Publisher in EBS taking around 4-5 hours.
    The Scalable Flag at report level is turned on with the JVM options set to -Xmx1024m -Xmx1024m in Concurrent Program definition.
    Other configurations for Data Template like XSLT, Scalable, Optimization are turned on though didn't bounce the OPP Server for these to take effect as I am not sure whether it is needed.
    Thanks in advance for your help.

    But the question is that how come it is working in TOAD and takes only 15-20 minutes?
    with initialization of session ?
    what about sqlplus ?
    Do I have to set up the the temp directory for the XML Publisher report to make it faster?
    look at
    R12: Troubleshooting Known XML Publisher and E-Business Suite (EBS) Integration Issues (Doc ID 1410160.1)
    BI Publisher - Troubleshooting Oracle Business Intelligence (XML) Publisher For The Oracle E-Business Suite (Doc ID 364547.1)

  • BSAD table is taking more time in select query.

    Hi ,
    The below SELECT query is taking more time , there is no any secondary index is there .
    Can anybody suggest how to improve it .
    SELECT bukrs
             kunnr
             augdt
             augbl
             gjahr
             belnr
             budat
             bldat
             waers
             xblnr
             BLART
             monat
             shkzg
             gsber
             DMBTR
             WRBTR
             prctr
             FROM  BSAD INTO TABLE gt_bsad
             WHERE  bukrs  = p_bukrs
             AND    kunnr  IN so_kunnr
             AND    budat  IN so_budat
             AND    xblnr  IN so_xblnr
             AND  ( blart  EQ 'DA' OR
                    blart  EQ 'DZ' OR
                    blart  EQ 'ZP' OR               "D03K904574
                    blart  EQ 'KZ' OR               "D03K904574
                    blart  EQ 'DP' )
             AND   PRCTR IN R_PC.
    Thanks in advance
    Regards
    chetan

    Hi Chetan ,
    I will suggest you two things :
    1. Try to add Secondary ( Non-unique) index on table BSAD with fields : mandt,bukrs,kunnr,budat,xblnr,blart,prctr.
        but before adding this index test the selectivity of this index by going to Tcode DB05
    2. In the select query you have used OR condition for blart. Instead of this try to create a ranges table for blart and append the  values 'DA','DZ','ZP','KZ','DP' and use this in the select query. This will improve the performance for sure.
    Hope this will help to ypu.
    Regards,
    Nikhil

  • Which statement is taking more time in a block?

    Hi,
    I have a plsql block with thousands of sql statements in it, line by line.
    My query is how can i know which particular sql statement is taking more time.
    Thanks,
    VInod

    910575 wrote:
    This is not the answer i expected.Having a 1000 SQLs statements in a single PL/SQL does not make any sense. Fact.
    This is not how one modularise software. And modularisation is a critically important fundamental.
    Each SQL means I/O. I/O is the single most expensive database operation. More I/O means slower performance.
    So why is a 1000+ SQL statements needed? Do these pull data into PL/SQL? If so, why? What does PL/SQL do with the data returned by these SQLs? Do the SQLs use bind variables? Can the SQLs be combined? What are the business requirements that need to be met?
    I just want to find which sql statement is taking more time in a procedure/bock.Not the correct approach. Performance need to look at the COMPLETE process. Not a single step in the process.
    Performance is a result of a sound design and proper implementation of this design into programming language code. It is not focusing on a single line of code and saying that is the problem and need to be fixed. The problem can be in the design. Can be in how that was written. And not in a single line of code.
    And seeing that you have 1000+ SQL statements in a single PL/SQL block - that IS an indication of a basic design flaw.

  • Custom Report taking more time to complete Normat

    Hi All,
    Custom report(Aging Report) in oracle is taking more time to complete Normal.
    In one instance, the same report is taking 5 min and the other instance this is taking 40-50 min to complete.
    We have enabled the trace and checked the trace file, but all the queries are working fine.
    Could you please suggest me regarding this issue.
    Thanks in advance!!

    TKPROF: Release 10.1.0.5.0 - Production on Tue Jun 5 10:49:32 2012
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Sort options: prsela exeela fchela
    count = number of times OCI procedure was executed
    cpu = cpu time in seconds executing
    elapsed = elapsed time in seconds executing
    disk = number of physical reads of buffers from disk
    query = number of buffers gotten for consistent read
    current = number of buffers gotten in current mode (usually for update)
    rows = number of rows processed by the fetch or execute call
    Error in CREATE TABLE of EXPLAIN PLAN table: APPS.prof$plan_table
    ORA-00922: missing or invalid option
    parse error offset: 1049
    EXPLAIN PLAN option disabled.
    SELECT DISTINCT OU.ORGANIZATION_ID , OU.BUSINESS_GROUP_ID
    FROM
    HR_OPERATING_UNITS OU WHERE OU.SET_OF_BOOKS_ID =:B1
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.05 11 22 0 3
    total 3 0.00 0.05 11 22 0 3
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 173 (recursive depth: 1)
    Rows Row Source Operation
    3 HASH UNIQUE (cr=22 pr=11 pw=0 time=52023 us cost=10 size=66 card=1)
    3 NESTED LOOPS (cr=22 pr=11 pw=0 time=61722 us)
    3 NESTED LOOPS (cr=20 pr=11 pw=0 time=61672 us cost=9 size=66 card=1)
    3 NESTED LOOPS (cr=18 pr=11 pw=0 time=61591 us cost=7 size=37 card=1)
    3 NESTED LOOPS (cr=16 pr=11 pw=0 time=61531 us cost=7 size=30 card=1)
    3 TABLE ACCESS BY INDEX ROWID HR_ORGANIZATION_INFORMATION (cr=11 pr=9 pw=0 time=37751 us cost=6 size=22 card=1)
    18 INDEX RANGE SCAN HR_ORGANIZATION_INFORMATIO_FK1 (cr=1 pr=1 pw=0 time=17135 us cost=1 size=0 card=18)(object id 43610)
    3 TABLE ACCESS BY INDEX ROWID HR_ALL_ORGANIZATION_UNITS (cr=5 pr=2 pw=0 time=18820 us cost=1 size=8 card=1)
    3 INDEX UNIQUE SCAN HR_ORGANIZATION_UNITS_PK (cr=2 pr=0 pw=0 time=26 us cost=0 size=0 card=1)(object id 43657)
    3 INDEX UNIQUE SCAN HR_ALL_ORGANIZATION_UNTS_TL_PK (cr=2 pr=0 pw=0 time=32 us cost=0 size=7 card=1)(object id 44020)
    3 INDEX RANGE SCAN HR_ORGANIZATION_INFORMATIO_FK2 (cr=2 pr=0 pw=0 time=52 us cost=1 size=0 card=1)(object id 330960)
    3 TABLE ACCESS BY INDEX ROWID HR_ORGANIZATION_INFORMATION (cr=2 pr=0 pw=0 time=26 us cost=2 size=29 card=1)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 11 0.01 0.05
    asynch descriptor resize 2 0.00 0.00
    INSERT INTO FND_LOG_MESSAGES ( ECID_ID, ECID_SEQ, CALLSTACK, ERRORSTACK,
    MODULE, LOG_LEVEL, MESSAGE_TEXT, SESSION_ID, USER_ID, TIMESTAMP,
    LOG_SEQUENCE, ENCODED, NODE, NODE_IP_ADDRESS, PROCESS_ID, JVM_ID, THREAD_ID,
    AUDSID, DB_INSTANCE, TRANSACTION_CONTEXT_ID )
    VALUES
    ( SYS_CONTEXT('USERENV', 'ECID_ID'), SYS_CONTEXT('USERENV', 'ECID_SEQ'),
    :B16 , :B15 , SUBSTRB(:B14 ,1,255), :B13 , SUBSTRB(:B12 , 1, 4000), :B11 ,
    NVL(:B10 , -1), SYSDATE, FND_LOG_MESSAGES_S.NEXTVAL, :B9 , SUBSTRB(:B8 ,1,
    60), SUBSTRB(:B7 ,1,30), SUBSTRB(:B6 ,1,120), SUBSTRB(:B5 ,1,120),
    SUBSTRB(:B4 ,1,120), :B3 , :B2 , :B1 ) RETURNING LOG_SEQUENCE INTO :O0
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 20 0.00 0.03 4 1 304 20
    Fetch 0 0.00 0.00 0 0 0 0
    total 21 0.00 0.03 4 1 304 20
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 173 (recursive depth: 1)
    Rows Row Source Operation
    1 LOAD TABLE CONVENTIONAL (cr=1 pr=4 pw=0 time=36498 us)
    1 SEQUENCE FND_LOG_MESSAGES_S (cr=0 pr=0 pw=0 time=24 us)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 4 0.01 0.03
    SELECT MESSAGE_TEXT, MESSAGE_NUMBER, TYPE, FND_LOG_SEVERITY, CATEGORY,
    SEVERITY
    FROM
    FND_NEW_MESSAGES M, FND_APPLICATION A WHERE :B3 = M.MESSAGE_NAME AND :B2 =
    M.LANGUAGE_CODE AND :B1 = A.APPLICATION_SHORT_NAME AND M.APPLICATION_ID =
    A.APPLICATION_ID
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 2 0.00 0.00 0 0 0 0
    Fetch 2 0.00 0.03 4 12 0 2
    total 5 0.00 0.03 4 12 0 2
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 173 (recursive depth: 1)
    Rows Row Source Operation
    1 NESTED LOOPS (cr=6 pr=2 pw=0 time=15724 us cost=3 size=134 card=1)
    1 TABLE ACCESS BY INDEX ROWID FND_APPLICATION (cr=2 pr=0 pw=0 time=20 us cost=1 size=9 card=1)
    1 INDEX UNIQUE SCAN FND_APPLICATION_U3 (cr=1 pr=0 pw=0 time=9 us cost=0 size=0 card=1)(object id 33993)
    1 TABLE ACCESS BY INDEX ROWID FND_NEW_MESSAGES (cr=4 pr=2 pw=0 time=15693 us cost=2 size=125 card=1)
    1 INDEX UNIQUE SCAN FND_NEW_MESSAGES_PK (cr=3 pr=1 pw=0 time=6386 us cost=1 size=0 card=1)(object id 34367)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 4 0.00 0.03
    DELETE FROM MO_GLOB_ORG_ACCESS_TMP
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.02 3 4 4 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.02 3 4 4 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 173 (recursive depth: 1)
    Rows Row Source Operation
    0 DELETE MO_GLOB_ORG_ACCESS_TMP (cr=4 pr=3 pw=0 time=29161 us)
    1 TABLE ACCESS FULL MO_GLOB_ORG_ACCESS_TMP (cr=3 pr=2 pw=0 time=18165 us cost=2 size=13 card=1)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 3 0.01 0.02
    SET TRANSACTION READ ONLY
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.01 0 0 0 0
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.01 0 0 0 0
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 173
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net message to client 1 0.00 0.00
    SQL*Net message from client 1 0.00 0.00
    begin Fnd_Concurrent.Init_Request; end;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 148 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.00 0 148 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 173
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    log file sync 1 0.01 0.01
    SQL*Net message to client 1 0.00 0.00
    SQL*Net message from client 1 0.00 0.00
    declare X0rv BOOLEAN; begin X0rv := FND_INSTALLATION.GET(:APPL_ID,
    :DEP_APPL_ID, :STATUS, :INDUSTRY); :X0 := sys.diutil.bool_to_int(X0rv);
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 9 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.00 0 9 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 173
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net message to client 8 0.00 0.00
    SQL*Net message from client 8 0.00 0.00
    begin fnd_global.bless_next_init('FND_PERMIT_0000');
    fnd_global.initialize(:session_id, :user_id, :resp_id, :resp_appl_id,
    :security_group_id, :site_id, :login_id, :conc_login_id, :prog_appl_id,
    :conc_program_id, :conc_request_id, :conc_priority_request, :form_id,
    :form_application_id, :conc_process_id, :conc_queue_id, :queue_appl_id,
    :server_id); fnd_profile.put('ORG_ID', :org_id);
    fnd_profile.put('MFG_ORGANIZATION_ID', :mfg_org_id);
    fnd_profile.put('MFG_CHART_OF_ACCOUNTS_ID', :coa);
    fnd_profile.put('APPS_MAINTENANCE_MODE', :amm); end;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 8 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.00 0 8 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 173
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net message to client 1 0.00 0.00
    SQL*Net message from client 1 0.00 0.00
    SELECT FPI.STATUS, FPI.INDUSTRY, FPI.PRODUCT_VERSION, FOU.ORACLE_USERNAME,
    FPI.TABLESPACE, FPI.INDEX_TABLESPACE, FPI.TEMPORARY_TABLESPACE,
    FPI.SIZING_FACTOR
    FROM
    FND_PRODUCT_INSTALLATIONS FPI, FND_ORACLE_USERID FOU, FND_APPLICATION FA
    WHERE FPI.APPLICATION_ID = FA.APPLICATION_ID AND FPI.ORACLE_ID =
    FOU.ORACLE_ID AND FA.APPLICATION_SHORT_NAME = :B1
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 2 0.00 0.00 0 7 0 1
    total 4 0.00 0.00 0 7 0 1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 173 (recursive depth: 1)
    Rows Row Source Operation
    1 NESTED LOOPS (cr=7 pr=0 pw=0 time=89 us)
    1 NESTED LOOPS (cr=6 pr=0 pw=0 time=93 us cost=4 size=76 card=1)
    1 NESTED LOOPS (cr=5 pr=0 pw=0 time=77 us cost=3 size=67 card=1)
    1 TABLE ACCESS BY INDEX ROWID FND_APPLICATION (cr=2 pr=0 pw=0 time=19 us cost=1 size=9 card=1)
    1 INDEX UNIQUE SCAN FND_APPLICATION_U3 (cr=1 pr=0 pw=0 time=9 us cost=0 size=0 card=1)(object id 33993)
    1 TABLE ACCESS BY INDEX ROWID FND_PRODUCT_INSTALLATIONS (cr=3 pr=0 pw=0 time=51 us cost=2 size=58 card=1)
    1 INDEX RANGE SCAN FND_PRODUCT_INSTALLATIONS_PK (cr=2 pr=0 pw=0 time=27 us cost=1 size=0 card=1)(object id 22583)
    1 INDEX UNIQUE SCAN FND_ORACLE_USERID_U1 (cr=1 pr=0 pw=0 time=7 us cost=0 size=0 card=1)(object id 22597)
    1 TABLE ACCESS BY INDEX ROWID FND_ORACLE_USERID (cr=1 pr=0 pw=0 time=7 us cost=1 size=9 card=1)
    SELECT P.PID, P.SPID, AUDSID, PROCESS, SUBSTR(USERENV('LANGUAGE'), INSTR(
    USERENV('LANGUAGE'), '.') + 1)
    FROM
    V$SESSION S, V$PROCESS P WHERE P.ADDR = S.PADDR AND S.AUDSID =
    USERENV('SESSIONID')
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.00 0 0 0 1
    total 3 0.00 0.00 0 0 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 173 (recursive depth: 1)
    Rows Row Source Operation
    1 NESTED LOOPS (cr=0 pr=0 pw=0 time=1883 us cost=1 size=108 card=2)
    1 HASH JOIN (cr=0 pr=0 pw=0 time=1869 us cost=1 size=100 card=2)
    1 NESTED LOOPS (cr=0 pr=0 pw=0 time=1059 us cost=0 size=58 card=2)
    182 FIXED TABLE FULL X$KSLWT (cr=0 pr=0 pw=0 time=285 us cost=0 size=1288 card=161)
    1 FIXED TABLE FIXED INDEX X$KSUSE (ind:1) (cr=0 pr=0 pw=0 time=617 us cost=0 size=21 card=1)
    181 FIXED TABLE FULL X$KSUPR (cr=0 pr=0 pw=0 time=187 us cost=0 size=10500 card=500)
    1 FIXED TABLE FIXED INDEX X$KSLED (ind:2) (cr=0 pr=0 pw=0 time=4 us cost=0 size=4 card=1)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    asynch descriptor resize 2 0.00 0.00
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 6 0.00 0.00 0 0 0 0
    Execute 6 0.01 0.02 0 165 0 4
    Fetch 1 0.00 0.00 0 0 0 1
    total 13 0.01 0.02 0 165 0 5
    Misses in library cache during parse: 0
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net message to client 37 0.00 0.00
    SQL*Net message from client 37 1.21 2.19
    log file sync 1 0.01 0.01
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 49 0.00 0.00 0 0 0 0
    Execute 89 0.01 0.07 7 38 336 24
    Fetch 29 0.00 0.09 15 168 0 27
    total 167 0.02 0.16 22 206 336 51
    Misses in library cache during parse: 3
    Misses in library cache during execute: 1
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    asynch descriptor resize 6 0.00 0.00
    db file sequential read 22 0.01 0.14
    48 user SQL statements in session.
    1 internal SQL statements in session.
    49 SQL statements in session.
    0 statements EXPLAINed in this session.
    Trace file compatibility: 10.01.00
    Sort options: prsela exeela fchela
    1 session in tracefile.
    48 user SQL statements in trace file.
    1 internal SQL statements in trace file.
    49 SQL statements in trace file.
    48 unique SQL statements in trace file.
    928 lines in trace file.
    1338833753 elapsed seconds in trace file.

  • Sql query is taking more time

    Hi all,
    db:oracle 9i
    I am facing below query prob.
    prob is that query is taking more time 45 min than earliar (10 sec).
    please any one suggest me .....
    SQL> SELECT MAX (tdar1.ID) ID, tdar1.request_id, tdar1.lolm_transaction_id,
    2 tdar1.transaction_version
    3 FROM transaction_data_arc tdar1
    4 WHERE tdar1.transaction_name ='O96U '
    5 AND tdar1.transaction_type = 'REQUEST'
    6 AND tdar1.message_type_code ='PCN'
    7 AND NOT EXISTS (
    8 SELECT NULL
    9 FROM transaction_data_arc tdar2
    10 WHERE tdar2.request_id = tdar1.request_id
    11 AND tdar2.lolm_transaction_id != tdar1.lolm_transaction_id
    12 AND tdar2.ID > tdar1.ID)
    13 GROUP BY tdar1.request_id,
    14 tdar1.lolm_transaction_id,
    15 tdar1.transaction_version;
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=17 Card=1 Bytes=42)
    1 0 SORT (GROUP BY) (Cost=12 Card=1 Bytes=42)
    2 1 FILTER
    3 2 TABLE ACCESS (BY INDEX ROWID) OF 'TRANSACTION_DATA_ARC
    ' (Cost=1 Card=1 Bytes=42)
    4 3 INDEX (RANGE SCAN) OF 'NK_TDAR_2' (NON-UNIQUE) (Cost
    =3 Card=1)
    5 2 TABLE ACCESS (BY INDEX ROWID) OF 'TRANSACTION_DATA_ARC
    ' (Cost=5 Card=918 Bytes=20196)
    6 5 INDEX (RANGE SCAN) OF 'NK_TDAR_7' (NON-UNIQUE) (Cost
    =8 Card=4760)

    prob is that query is taking more time 45 min than earliar (10 sec).Then something must have changed (data growth/stale statistics/...?).
    You should post as much details as possible, how and what it is described in the FAQ, see:
    *3. How to improve the performance of my query? / My query is running slow*.
    When your query takes too long...
    How to post a SQL statement tuning request
    SQL and PL/SQL FAQ
    Also, given your database version, using NOT IN instead of NOT EXISTS might make a difference (but they're not the same).
    See: SQL and PL/SQL FAQ

  • Query is taking more time to execute in PROD

    Hi All,
    Can anyone tell me why this query is taking more time when I am using for single trx_number record it is working fine but when I am trying to use all the records it is not fatching any records and it is keep on running.
    SELECT DISTINCT OOH.HEADER_ID
    ,OOH.ORG_ID
    ,ct.CUSTOMER_TRX_ID
    ,ool.ship_from_org_id
    ,ct.trx_number IDP_SHIPMENT_ID
    ,ctt.type STATUS_CODE
    ,SYSDATE STATUS_DATE
    ,ooh.attribute16 IDP_ORDER_NBR --Change based on testing on 21-JUL-2010 in UAT
    ,lpad(rac_bill.account_number,6,0) IDP_BILL_TO_CUSTOMER_NBR
    ,rac_bill.orig_system_reference
    ,rac_ship_party.party_name SHIP_TO_NAME
    ,raa_ship_loc.address1 SHIP_TO_ADDR1
    ,raa_ship_loc.address2 SHIP_TO_ADDR2
    ,raa_ship_loc.address3 SHIP_TO_ADDR3
    ,raa_ship_loc.address4 SHIP_TO_ADDR4
    ,raa_ship_loc.city SHIP_TO_CITY
    ,NVL(raa_ship_loc.state,raa_ship_loc.province) SHIP_TO_STATE
    ,raa_ship_loc.country SHIP_TO_COUNTRY_NAME
    ,raa_ship_loc.postal_code SHIP_TO_ZIP
    ,ooh.CUST_PO_NUMBER CUSTOMER_ORDER_NBR
    ,ooh.creation_date CUSTOMER_ORDER_DATE
    ,ool.actual_shipment_date DATE_SHIPPED
    ,DECODE(mp.organization_code,'CHP', 'CHESAPEAKE'
    ,'CSB', 'CHESAPEAKE'
    ,'DEP', 'CHESAPEAKE'
    ,'CHESAPEAKE') SHIPPED_FROM_LOCATION --'MEMPHIS' --'HOUSTON'
    ,ooh.freight_carrier_code FREIGHT_CARRIER
    ,NVL(XX_FSG_NA_FASTRAQ_IFACE.get_invoice_amount ('FREIGHT',ct.customer_trx_id,ct.org_id),0)
    + NVL(XX_FSG_NA_FASTRAQ_IFACE.get_line_fr_amt ('FREIGHT',ct.customer_trx_id,ct.org_id),0)FREIGHT_CHARGE
    ,ooh.freight_terms_code FREIGHT_TERMS
    ,'' IDP_BILL_OF_LADING
    ,(SELECT WAYBILL
    FROM WSH_DELIVERY_DETAILS_OE_V
    WHERE -1=-1
    AND SOURCE_HEADER_ID = ooh.header_id
    AND SOURCE_LINE_ID = ool.line_id
    AND ROWNUM =1) WAYBILL_CARRIER
    ,'' CONTAINERS
    ,ct.trx_number INVOICE_NBR
    ,ct.trx_date INVOICE_DATE
    ,NVL(XX_FSG_NA_FASTRAQ_IFACE.get_invoice_amount ('LINE',ct.customer_trx_id,ct.org_id),0) +
    NVL(XX_FSG_NA_FASTRAQ_IFACE.get_invoice_amount ('TAX',ct.customer_trx_id,ct.org_id),0) +
    NVL(XX_FSG_NA_FASTRAQ_IFACE.get_invoice_amount ('FREIGHT',ct.customer_trx_id,ct.org_id),0)INVOICE_AMOUNT
    ,NULL IDP_TAX_IDENTIFICATION_NBR
    ,NVL(XX_FSG_NA_FASTRAQ_IFACE.get_invoice_amount ('TAX',ct.customer_trx_id,ct.org_id),0) TAX_AMOUNT_1
    ,NULL TAX_DESC_1
    ,NULL TAX_AMOUNT_2
    ,NULL TAX_DESC_2
    ,rt.name PAYMENT_TERMS
    ,NULL RELATED_INVOICE_NBR
    ,'Y' INVOICE_PRINT_FLAG
    FROM ra_customer_trx_all ct
    ,ra_cust_trx_types_all ctt
    ,hz_cust_accounts rac_ship
    ,hz_cust_accounts rac_bill
    ,hz_parties rac_ship_party
    ,hz_locations raa_ship_loc
    ,hz_party_sites raa_ship_ps
    ,hz_cust_acct_sites_all raa_ship
    ,hz_cust_site_uses_all su_ship
    ,ra_customer_trx_lines_all rctl
    ,oe_order_lines_all ool
    ,oe_order_headers_all ooh
    ,mtl_parameters mp
    ,ra_terms rt
    ,OE_ORDER_SOURCES oos
    ,XLA_AR_INV_AEL_SL_V XLA_AEL_SL_V
    WHERE ct.cust_trx_type_id = ctt.cust_trx_type_id
    AND ctt.TYPE <> 'BR'
    AND ct.org_id = ctt.org_id
    AND ct.ship_to_customer_id = rac_ship.cust_account_id
    AND ct.bill_to_customer_id = rac_bill.cust_account_id
    AND rac_ship.party_id = rac_ship_party.party_id
    AND su_ship.cust_acct_site_id = raa_ship.cust_acct_site_id
    AND raa_ship.party_site_id = raa_ship_ps.party_site_id
    AND raa_ship_loc.location_id = raa_ship_ps.location_id
    AND ct.ship_to_site_use_id = su_ship.site_use_id
    AND su_ship.org_id = ct.org_id
    AND raa_ship.org_id = ct.org_id
    AND ct.customer_trx_id = rctl.customer_trx_id
    AND ct.org_id = rctl.org_id
    AND rctl.interface_line_attribute6 = to_char(ool.line_id)
    AND rctl.org_id = ool.org_id
    AND ool.header_id = ooh.header_id
    AND ool.org_id = ooh.org_id
    AND mp.organization_id = ool.ship_from_org_id
    AND ooh.payment_term_id = rt.term_id
    AND xla_ael_sl_v.last_update_date >= NVL(p_last_update_date,xla_ael_sl_v.last_update_date)
    AND ooh.order_source_id = oos.order_source_id --Change based on testing on 19-May-2010
    AND oos.name = 'FASTRAQ' --Change based on testing on 19-May-2010
    AND ooh.org_id = g_org_id --Change based on testing on 19-May-2010
    AND ool.flow_status_code = 'CLOSED'
    AND xla_ael_sl_v.trx_hdr_id = ct.customer_trx_id
    AND trx_hdr_table = 'CT'
    AND xla_ael_sl_v.gl_transfer_status = 'Y'
    AND xla_ael_sl_v.accounted_dr IS NOT NULL
    AND xla_ael_sl_v.org_id = ct.org_id;
    -- AND ct.trx_number = '2000080';
    }

    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

  • CatSearch taking more time than full table scan

    Hi
    I have a table which has close to 140 million records. I had been exploring the option of using oracle text for search. So , I created an index(ctxcat) on the column Name by the following query.
    begin
         ctx_ddl.create_preference('FT_WL', 'BASIC_WORDLIST');
         ctx_ddl.set_attribute ('FT_WL', 'prefix-index','TRUE');
    end;
    create index history_namex on history(name) indextype is ctxsys.ctxcat parameters ('WORDLIST FT_WL');
    But when I executed the following query , I have found out that catsearch is taking more time. The queries and thier stats are :-
    1. select * from history where catsearch(name, 'Jake%', null) > 0 and rownum < 200;
    Elapsed : 00 : 00 : 00.13
    Statistics :
    112 recursive calls
    0 db block gets
    413 consistent gets
    28 physical reads
    0 redo size
    33168 bytes sent via SQL*Net to client
    663 bytes receuved via SQL*Net from client
    15 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    199 rows processed
    2. select * from history where name like 'Jake%' and rownum < 200;
    Elapsed : 00 : 00 : 00.05
    Statistics :
    1 recursive calls
    0 db block gets
    220 consistent gets
    383 physical reads
    0 redo size
    26148 bytes sent via SQL*Net to client
    663 bytes receuved via SQL*Net from client
    15 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    199 rows processed
    Can anyone explain why this is happening?
    PS : there is no conventional index on the name column.
    Edited by: 976934 on Dec 14, 2012 3:32 AM

    The asterisk (*) is simply the correct syntax for a wildcard using catsearch. If you use % instead, then you will not get the same results. Please see the section of the online documentation below, that shows that the asterisk is the wildcard for catsearch.
    http://docs.oracle.com/cd/E11882_01/text.112/e24436/csql.htm#CHDJBGHE
    Additionally, if you want to limit the rows, then you need to get the matching results in an inner sub-query, then use the rownum in an outer query. The way that you were doing it, it first limits the rows to the first 200, then checks which of those meet the criteria, instead of the other way around. So, the correct syntax should be the following, which should also be the most efficient.
    select * from  
           (select * from history
            where  catsearch (name, 'Jake*', null) > 0)
    where  rownum < 200;

  • In SQL Trace how to see which statement getting more time .

    Hi Expart,
    In SQL Trace (T-code ST05) . I am running the standard transaction . how to see which statement
    running more time and less time . suppose one statement running more time so how resolve the
    performance .
    Plz. reply me
    Regards
    Razz

    > The ones in 'RED' color are the statement which are taking a lot of time and you need to
    > optimise the same.
    No, that is incorrect, the red ones show only the ones which need several hundret milliseconds in one execution. This can even be correct for hard tasks. And there are lots of problem, which you will not see
    I have said everything here:
    SQL trace:
    /people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy
    Go to 'Tracelist' -> Summarize by SQL statements', this is the view which you want to see!
    I summarizes all executions of the same statement.
    There are even the checks explained, the slow ones are the one which need a lot of time per record!
    See MinTime/Rec > 10.000 microseconds.
    Check all number of records, executions, buffer, identicals.
    The SE30 Tipps and Tricks will not help much.
    Siegfried

  • INSTR() function is taking more time

    im using the below query select query in my procedure.
    select distinct SUPPLIER_CIRCUIT_ID from SUPPLIER_DATA
    where INSTR(i.SYSTEM_CIRCUIT_ID,SUPPLIER_CIRCUIT_ID) > 0;
    I am taking SYSTEM_CIRCUIT_ID in cursor.
    This query is taking more time. Is that possiblt to create function based index and speed up the query?

    Hi,
    Welcome to the forum!
    993620 wrote:
    im using the below query select query in my procedure.
    select distinct SUPPLIER_CIRCUIT_ID from SUPPLIER_DATA
    where INSTR(i.SYSTEM_CIRCUIT_ID,SUPPLIER_CIRCUIT_ID) > 0;
    I am taking SYSTEM_CIRCUIT_ID in cursor.Show exactly what you're doing.
    Whenever you have a problem, post a complete test script that people can run to re-create the problem and test their ideas.
    See te forum FAQ {message:id=9360002}
    This query is taking more time. Is that possiblt to create function based index and speed up the query?Sorry, unless you doing something very specific (such as alwyas looking for the same sub-string) then a function-based index won't help.
    Oracle sells a separate product, called Oracle Text, for this kind of searching.
    You might try LIKE:
    WHERE  i.SYSTEM_CIRCUIT_ID LIKE  '%' || SUPPLIER_CIRCUIT_ID || '%'If you're using a cursor, then that's probably slowing the process down much more than the part you're showing.

Maybe you are looking for

  • Unable to install File Upload Utility in AIX system

    Hello, I installed the Forms File Upload Utility, through CGI, following the steps described in the html document provided with the utility. That is: - i copied the files UploadClient.jar.sig and UploadServer.jar to the directory /ias102/6iserver/for

  • EFT Set up and

    Hi, Please can anyone mail me EFT documentation ( setup and run as well) thanks Narendra email address  [email protected]

  • I'm unable to connect my Gmail accounts to Apple Mail.

    All - I've been working on this for hours. All I want to do is connect my gmail accounts to Apple Mail.  I'm running a new Macbook Air w Mountain Lion, Apple Mail 6.5.  I can access the accounts on my ipad and iphone.  I've spent hours reading forums

  • RE: Camera Raw and Smart Objects

    Hello Everyone. I have a question please. Inside the Camera Raw 8.1, Inside the Workflow Options, I Checked the Box for Open In Photoshop as a Smart Objects. I noticed Inside the Camera Raw, Open Image box turn to, Open Object box.  I click on open,

  • Icons disappearing and apps not opening

    FCP, Motion, Soundtrack, Pages, Keynote, Numbers won't open but other apps will like Word, Live Type etc. Also, clicked on Pages and Keynote in dock and they disappeared but the pop up of their name still is there and click again and the icon comes b