How to reduce execution time of this SQL?

This SQL will output only 2 rows. I tried using hints (an index) but to no avail.
http://www.freeimagehosting.net/uploads/cf214afcf1.jpg
Or, is it NOT possible, limit of query optimization has reached?

Rakesh jayappa wrote:
Hi,
Run the sql tuning advisory.
Let me know recommendation.
Kind Regards,
Rakesh************************** Here is my tuning request **************************
1.) The following SQL statement has been identified to perform poorly. It currently takes up to 12 seconds to execute, but it's supposed to take a second at most.
This is the statement:
select DISTINCT trunc(c.sst_post_date) as post_date
from ac_t_sessn b , ac_t_ssntr c
where
       b.ses_status = 0
          and b.ses_profit_center = c.sst_profit_center
          and b.ses_acct_year = c.sst_acct_year
          and b.ses_acct_period = c.sst_acct_period
          and b.ses_sessn_no = c.sst_sessn_no
   AND
         C.sst_post_mtd||C.sst_post_TYPE IN
       (SELECT Y.pst_post_mtd||Y.pst_post_type
        FROM ac_r_post_functions Y
       WHERE Y.pst_post_status IN (0,'2'))
order by trunc(c.sst_post_date);It should return data from a table in a specific order.
2.) The version of the database is Oracle9i Enterprise Edition Release *9.2.0.6.0*
3.) These are the parameters relevant to the optimizer:
UAT_UML@umltest>show parameter optimizer
NAME                                 TYPE        VALUE
optimizer_dynamic_sampling           integer     1
optimizer_features_enable            string      9.2.0
optimizer_index_caching              integer     0
optimizer_index_cost_adj             integer     100
optimizer_max_permutations           integer     2000
optimizer_mode                       string      CHOOSE
UAT_UML@umltest>show parameter db_file_multi
NAME                                 TYPE        VALUE
db_file_multiblock_read_count        integer     16
UAT_UML@umltest>show parameter db_block_size
NAME                                 TYPE        VALUE
db_block_size                        integer     8192
UAT_UML@umltest>show parameter cursor_sharing
NAME                                 TYPE        VALUE
cursor_sharing                       string      EXACT
UAT_UML@umltest>column sname format a20
UAT_UML@umltest>column pname format a20
UAT_UML@umltest>column pval2 format a20
UAT_UML@umltest>select
  2             sname
  3           , pname
  4           , pval1
  5           , pval2
  6      from
  7           sys.aux_stats$;
no rows selected4.) Here is the output of EXPLAIN PLAN:
UAT_UML@umltest>select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
| Id  | Operation              |  Name                | Rows  | Bytes |TempSpc| Cost  |
|   0 | SELECT STATEMENT       |                      |   454 | 22700 |       |  5391 |
|   1 |  SORT UNIQUE           |                      |   454 | 22700 |       |  5072 |
|   2 |   HASH JOIN            |                      | 69384 |  3387K|  2592K|  4478 |
|   3 |    INDEX FAST FULL SCAN| INDX_AC_T_SESSN      |   110K|  1294K|       |   244 |
|   4 |    HASH JOIN           |                      |   416K|    15M|       |  3877 |
|   5 |     TABLE ACCESS FULL  | AC_R_POST_FUNCTIONS  |    23 |   253 |       |     2 |
|   6 |     TABLE ACCESS FULL  | AC_T_SSNTR           |  1790K|    46M|       |  3866 |
Note: cpu costing is off, PLAN_TABLE' is old version5.) Here is the output of SQL*Plus AUTOTRACE including the TIMING information:
UAT_UML@umltest>set autotrace traceonly arraysize 100
UAT_UML@umltest>
UAT_UML@umltest>select DISTINCT trunc(c.sst_post_date) as post_date
  2  from ac_t_sessn b , ac_t_ssntr c
  3  where
  4  b.ses_status = 0
  5  and b.ses_profit_center = c.sst_profit_center
  6  and b.ses_acct_year = c.sst_acct_year
  7  and b.ses_acct_period = c.sst_acct_period
  8  and b.ses_sessn_no = c.sst_sessn_no
  9  AND
10  C.sst_post_mtd||C.sst_post_TYPE IN (SELECT         Y.pst_post_mtd||Y.pst_post_type FROM ac_r_po
st_functions Y
11  WHERE Y.pst_post_status IN (0,'2'))
12  order by trunc(c.sst_post_date);
Execution Plan
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=5391 Card=454 Bytes=
          22700)
   1    0   SORT (UNIQUE) (Cost=5072 Card=454 Bytes=22700)
   2    1     HASH JOIN (Cost=4478 Card=69384 Bytes=3469200)
   3    2       INDEX (FAST FULL SCAN) OF 'INDX_AC_T_SESSN' (NON-UNIQU
          E) (Cost=244 Card=110433 Bytes=1325196)
   4    2       HASH JOIN (Cost=3877 Card=416304 Bytes=15819552)
   5    4         TABLE ACCESS (FULL) OF 'AC_R_POST_FUNCTIONS' (Cost=2
           Card=23 Bytes=253)
   6    4         TABLE ACCESS (FULL) OF 'AC_T_SSNTR' (Cost=3866 Card=
          1790555 Bytes=48344985)
Statistics
          0  recursive calls
          0  db block gets
      42741  consistent gets
        171  physical reads
          0  redo size
        425  bytes sent via SQL*Net to client
        507  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          1  sorts (memory)
          0  sorts (disk)
          2  rows processed
UAT_UML@umltest>DISCONNECT
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production6.) The TKPROF output snippet
TKPROF: Release 11.2.0.1.0 - Development on Wed Oct 27 12:47:35 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
Trace file: umltest_ora_1604.trc
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
select DISTINCT trunc(c.sst_post_date) as post_date
from ac_t_sessn b , ac_t_ssntr c
where
b.ses_status = 0
and b.ses_profit_center = c.sst_profit_center
and b.ses_acct_year = c.sst_acct_year
and b.ses_acct_period = c.sst_acct_period
and b.ses_sessn_no = c.sst_sessn_no
AND
C.sst_post_mtd||C.sst_post_TYPE IN (SELECT         Y.pst_post_mtd||Y.pst_post_type FROM ac_r_post_functions Y
WHERE Y.pst_post_status IN (0,'2'))
order by trunc(c.sst_post_date)
call     count       cpu    elapsed       disk      query    current        rows
Parse        1      0.01       0.00          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        2      3.20       4.38        171      42741          0           2
total        4      3.21       4.39        171      42741          0           2
Misses in library cache during parse: 1
Optimizer mode: CHOOSE
Parsing user id: 445 
Rows     Row Source Operation
      2  SORT UNIQUE
     24   HASH JOIN 
     11    INDEX FAST FULL SCAN OBJ#(62817) (object id 62817)
2293715    HASH JOIN 
     31     TABLE ACCESS FULL OBJ#(67305)
1790555     TABLE ACCESS FULL OBJ#(62828)
alter session set sql_trace true
call     count       cpu    elapsed       disk      query    current        rows
Parse        0      0.00       0.00          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        0      0.00       0.00          0          0          0           0
total        1      0.00       0.00          0          0          0           0
Misses in library cache during parse: 0
Misses in library cache during execute: 1
Optimizer mode: CHOOSE
Parsing user id: 445 
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call     count       cpu    elapsed       disk      query    current        rows
Parse        1      0.01       0.00          0          0          0           0
Execute      2      0.00       0.00          0          0          0           0
Fetch        2      3.20       4.38        171      42741          0           2
total        5      3.21       4.39        171      42741          0           2
Misses in library cache during parse: 1
Misses in library cache during execute: 1
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call     count       cpu    elapsed       disk      query    current        rows
Parse        0      0.00       0.00          0          0          0           0
Execute      0      0.00       0.00          0          0          0           0
Fetch        0      0.00       0.00          0          0          0           0
total        0      0.00       0.00          0          0          0           0
Misses in library cache during parse: 0
    2  user  SQL statements in session.
    0  internal SQL statements in session.
    2  SQL statements in session.
Trace file: umltest_ora_1604.trc
Trace file compatibility: 9.02.00
Sort options: prsela  exeela  fchela 
       1  session in tracefile.
       2  user  SQL statements in trace file.
       0  internal SQL statements in trace file.
       2  SQL statements in trace file.
       2  unique SQL statements in trace file.
      51  lines in trace file.
      10  elapsed seconds in trace file. Any help would be greatly appreciated?

Similar Messages

  • How to reduce execution time ?

    Hi friends...
    I have created a report to display vendor opening balances,
    total debit ,total credit , total balance & closing balance for the given date range. it is working fine .But it takes more time to execute . How can I reduce execution time ?
    Plz help me. It's a very urgent report...
    The coding is as below.....
    report  yfiin_rep_vendordetail no standard page heading.
    tables : bsik,bsak,lfb1,lfa1.
    type-pools : slis .
    --TABLE STRUCTURE--
    types : begin of tt_bsik,
            bukrs type bukrs,
            lifnr type lifnr,
            budat type budat,
            augdt type augdt,
            dmbtr type dmbtr,
            wrbtr type wrbtr,
            shkzg type shkzg,
            hkont type hkont,
            bstat type bstat_d ,
            prctr type prctr,
            name1 type name1,
         end of tt_bsik,
         begin of tt_lfb1,
             lifnr type lifnr,
             mindk type mindk,
         end of tt_lfb1,
        begin of tt_lfa1,
            lifnr type lifnr,
            name1 type name1,
            ktokk type ktokk,
        end of tt_lfa1,
        begin of tt_opbal,
            bukrs type bukrs,
            lifnr type lifnr,
            gjahr type gjahr,
            belnr type belnr_d,
            budat type budat,
            bldat type bldat,
            waers type waers,
            dmbtr type dmbtr,
            wrbtr type wrbtr,
            shkzg type shkzg,
            blart type blart,
            monat type monat,
            hkont type hkont,
            bstat type bstat_d ,
            prctr type prctr,
            name1 type name1,
            tdr type  dmbtr,
            tcr type  dmbtr,
            tbal type  dmbtr,
          end of tt_opbal,
         begin of tt_bs ,
            bukrs type bukrs,
            lifnr type lifnr,
            name1 type name1,
            prctr type prctr,
            tbal type dmbtr,
            bala type dmbtr,
            balb type dmbtr,
            balc type dmbtr,
            bald type dmbtr,
            bale type dmbtr,
            gbal type dmbtr,
        end of tt_bs.
    ************WORK AREA DECLARATION *********************
    data :  gs_bsik type tt_bsik,
            gs_bsak type tt_bsik,
            gs_lfb1 type tt_lfb1,
            gs_lfa1 type tt_lfa1,
            gs_ageing  type tt_ageing,
            gs_bs type tt_bs,
            gs_opdisp type tt_bs,
            gs_final type tt_bsik,
            gs_opbal type tt_opbal,
            gs_opfinal type tt_opbal.
    ************INTERNAL TABLE DECLARATION*************
    data :  gt_bsik type standard table of tt_bsik,
            gt_bsak type standard table of tt_bsik,
            gt_lfb1 type standard table of tt_lfb1,
            gt_lfa1 type standard table of tt_lfa1,
            gt_ageing type standard table of tt_ageing,
            gt_bs type standard table of tt_bs,
            gt_opdisp type standard table of tt_bs,
            gt_final type standard table of tt_bsik,
            gt_opbal type standard table of tt_opbal,
            gt_opfinal type standard table of tt_opbal.
    ALV DECLARATIONS *******************
    data : gs_fcat type slis_fieldcat_alv ,
           gt_fcat type slis_t_fieldcat_alv ,
           gs_sort type slis_sortinfo_alv,
           gs_fcats type slis_fieldcat_alv ,
           gt_fcats type slis_t_fieldcat_alv.
    **********global data declration***************
    data :   kb type dmbtr ,
              return like  bapireturn ,
              balancespgli like  bapi3008-bal_sglind,
              noteditems like  bapi3008-ntditms_rq,
              keybalance type table of  bapi3008_3 with header line,
             opbalance type p.
    SELECTION SCREEN DECLARATIONS *********************
    selection-screen begin of block b1 with frame .
    select-options : so_bukrs for bsik-bukrs obligatory,
                     so_lifnr for bsik-lifnr,
                     so_hkont for bsik-hkont,
                     so_prctr for bsik-prctr ,
                     so_mindk for lfb1-mindk,
                     so_ktokk for lfa1-ktokk.
    selection-screen end of block b1.
    selection-screen : begin of block b1 with frame.
    parameters       : p_rb1 radiobutton group rad1 .
    select-options   : so_date for sy-datum .
    selection-screen : end of block b1.
    ********************************ASSIGNING ALV GRID
    ****field catalog for balance report
    gs_fcats-col_pos = 1.
    gs_fcats-fieldname = 'BUKRS'.
    gs_fcats-seltext_m =  text-001.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 2 .
    gs_fcats-fieldname = 'LIFNR'.
    gs_fcats-seltext_m = text-002.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 3.
    gs_fcats-fieldname = 'NAME1'.
    gs_fcats-seltext_m =  text-003.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 4.
    gs_fcats-fieldname = 'BALC'.
    gs_fcats-seltext_m =  text-016.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 5.
    gs_fcats-fieldname = 'BALA'.
    gs_fcats-seltext_m =  text-012.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 6.
    gs_fcats-fieldname = 'BALB'.
    gs_fcats-seltext_m =  text-013.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 7.
    gs_fcats-fieldname = 'TBAL'.
    gs_fcats-seltext_m =  text-014.
    append gs_fcats to gt_fcats .
    gs_fcats-col_pos = 8.
    gs_fcats-fieldname = 'GBAL'.
    gs_fcats-seltext_m =  text-015.
    append gs_fcats to gt_fcats .
    data : repid1 type sy-repid.
    repid1 = sy-repid.
    INITIALIZATION EVENTS ******************************
    initialization.
    *Clearing the work area.
    clear gs_bsik.
    Refreshing the internal tables.
    refresh gt_bsik.
    ******************START OF  SELECTION EVENTS **************************
    start-of-selection.
    *get data for balance report.
      perform sub_openbal.
      perform sub_openbal_display.
    *&      Form  sub_openbal
          text
    -->  p1        text
    <--  p2        text
    form sub_openbal .
      if   so_date-low > sy-datum or so_date-high > sy-datum .
          message i005(yfi02).
         leave screen.
    endif.
         select bukrs lifnr gjahr belnr budat bldat
           waers dmbtr wrbtr shkzg blart monat hkont prctr
           from bsik into table gt_opbal
           where bukrs in so_bukrs and lifnr in so_lifnr
           and hkont in so_hkont and prctr in so_prctr
           and budat in so_date .
        select bukrs lifnr gjahr belnr budat bldat
           waers dmbtr wrbtr shkzg blart monat hkont prctr
           from bsak appending table gt_opbal
           for all entries in gt_opbal
           where lifnr = gt_opbal-lifnr
           and budat in so_date .
    if sy-subrc <> 0.
      message i007(yfi02).
      leave screen.
      endif.
    select lifnr mindk from lfb1 into table gt_lfb1
      for all entries in gt_opbal
        where lifnr = gt_opbal-lifnr and mindk in so_mindk.
    select lifnr name1 ktokk from lfa1 into table gt_lfa1
      for all entries in gt_opbal
       where lifnr = gt_opbal-lifnr and ktokk in so_ktokk.
       loop at gt_opbal into gs_opbal .
         loop at gt_lfb1 into gs_lfb1 where lifnr = gs_opbal-lifnr.
           loop at gt_lfa1 into gs_lfa1 where lifnr = gs_opbal-lifnr.
            gs_opfinal-bukrs = gs_opbal-bukrs.
            gs_opfinal-lifnr = gs_opbal-lifnr.
            gs_opfinal-gjahr = gs_opbal-gjahr.
            gs_opfinal-belnr = gs_opbal-belnr.
            gs_opfinal-budat = gs_opbal-budat.
            gs_opfinal-bldat = gs_opbal-bldat.
            gs_opfinal-waers = gs_opbal-waers.
            gs_opfinal-dmbtr = gs_opbal-dmbtr.
            gs_opfinal-wrbtr = gs_opbal-wrbtr.
            gs_opfinal-shkzg = gs_opbal-shkzg.
            gs_opfinal-blart = gs_opbal-blart.
            gs_opfinal-monat = gs_opbal-monat.
            gs_opfinal-hkont = gs_opbal-hkont.
            gs_opfinal-prctr = gs_opbal-prctr.
            gs_opfinal-name1 = gs_lfa1-name1.
        if gs_opbal-shkzg    = 'H'.
            gs_opfinal-tcr   =  gs_opbal-dmbtr * -1.
            gs_opfinal-tdr   =  '000000'.
        else.
            gs_opfinal-tdr   =  gs_opbal-dmbtr.
            gs_opfinal-tcr   =  '000000'.
        endif.
           append gs_opfinal to gt_opfinal.
           endloop.
           endloop.
           endloop.
    sort gt_opfinal by bukrs lifnr prctr .
    so_date-low = so_date-low - 1 .
    loop at gt_opfinal into gs_opfinal.
    call function 'BAPI_AP_ACC_GETKEYDATEBALANCE'
      exporting
        companycode        = gs_opfinal-bukrs
        vendor             =  gs_opfinal-lifnr
        keydate            = so_date-low
       balancespgli        = ' '
       noteditems          = ' '
      importing
        return             = return
      tables
        keybalance         = keybalance.
    clear kb .
    loop at keybalance .
       kb = keybalance-lc_bal + kb .
    endloop.
          gs_opdisp-balc = kb.
          gs_opdisp-bukrs =  gs_opfinal-bukrs.
          gs_opdisp-lifnr =  gs_opfinal-lifnr.
          gs_opdisp-name1 =  gs_opfinal-name1.
        at new lifnr .
          sum .
          gs_opfinal-tbal =  gs_opfinal-tdr + gs_opfinal-tcr  .
          gs_opdisp-tbal = gs_opfinal-tbal.
          gs_opdisp-bala = gs_opfinal-tdr .
          gs_opdisp-balb = gs_opfinal-tcr .
          gs_opdisp-gbal = keybalance-lc_bal + gs_opfinal-tbal .
          append gs_opdisp to gt_opdisp.
        endat.
        clear gs_opdisp.
        clear keybalance .
      endloop.
      delete adjacent duplicates from gt_opdisp.
    endform.                    " sub_openbal
    *&      Form  sub_openbal_display
          text
    -->  p1        text
    <--  p2        text
    form sub_openbal_display .
    call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
          i_callback_program              =  repid1
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
          it_fieldcat                     = gt_fcats
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = 'X'
      IS_VARIANT                        =
       it_events                        =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
         tables
           t_outtab                       = gt_opdisp
      exceptions
        program_error                     = 1
        others                            = 2
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    endform.                    " sub_openbal_display

    I think you are using for all entries statement in almost all select statements but i didnt see any condtion before you are using for all entries statement.
    If you are using for all entries in gt_opbal ... make sure that gt_opbal has some records other wise it will try to read all records from the data base tables.
    Try to check before using for all entries in the select statement like
    if gt_opbal is not initial.
    select adfda adfadf afdadf into table
      for all entries in gt_opbal.
    else.
    select abdf afad into table
    from abcd
    where a = 1
        and b = 2.
    endif.
    i didnt see anything wrong in your report but this is major time consuming when you dont have records in the table which you are using for all entries.

  • How to reduce Parse time in dynamic SQL

    I'm using for a part of my code dynamic SQL with DBMS_SQL Package, this dynamic SQL code is located in a loop with say 1000 repeatations, if we trace the code we see that this sql statement is parsed 1000 times and this causes
    a serios performance issue. If i convert this part of code into static PLSQL code , the statement is parsed only one time as expected. i would like
    to know how i can resolve this problem in the dynamic SQL code.
    Why in case of static SQL, despite it is inside the loop, it is parsed
    only one time by ORACLE and in case of dynamic SQL as many as the upper limit of counter.
    Why the ORACLE has different behaviour to parse them? Is there any way or trick
    to force ORACLE to parse it only one time like static SQL?

    despite the open cursor is also inside the loop but oracle parse it only one time.That is because PL/SQL is caching your cursor and resuing it. With DBMS_SQL you are opening a new cursor area in the loop for each iteration (DBMS_SQL.OPEN_CURSOR).
    what you need to do is open/parse once and bind the value each time through the loop:
    DECLARE
        expr      VARCHAR2(1000);
        check_cur PLS_INTEGER;
        nDummy    PLS_INTEGER;
        nFetched  PLS_INTEGER;
    BEGIN
        -- Open Cursor
        check_cur := dbms_sql.open_cursor;
        expr      := 'select 1 from dual where ' || ':bindvar1 ' || '=' ||
                     ' ''bindvar1'' ';
        -- Parse Cursor
        dbms_sql.parse(check_cur,
                       expr,
                       1);
        FOR counter IN 1 .. 1000
        LOOP
            -- Define Column
            DBMS_SQL.define_column(check_cur,
                                   1,
                                   1);
            -- Do Binding
            dbms_sql.bind_variable(check_cur,
                                   ':bindvar1',
                                   'bindname1');
            -- Execute Cursor
            nDummy := DBMS_SQL.EXECUTE(check_cur);
            -- Fetch Rows
            nFetched := DBMS_SQL.fetch_rows(check_cur);
        END LOOP;
        -- Close Cursor
        dbms_sql.close_cursor(check_cur);
    END;
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.21       0.23          0          0          0           0
    Execute   1000      0.11       0.10          0          0          0           0
    Fetch     1000      0.03       0.01          0          0          0           0
    total     2001      0.35       0.35          0          0          0           0

  • How to reduce execution time of SQL Query

    hi ,
    i'm working on oracle ERP application i wanna to create an OAF page that shows some data on tables .
    i've wirte the query but it take long time . .
    any body can help :
    SELECT *
    FROM (SELECT person_id,
    transaction_id,
    segment1 AS TA_number,
    segment9 AS Travel_Distination,
    SUBSTR (segment5, 0, 10) AS Travel_Date,
    creation_date AS request_date,
    status,
    full_name AS Current_Approver
    FROM ( (SELECT PPF.PERSON_ID,
    ht.TRANSACTION_ID,
    pac.segment1,
    pac.segment2,
    pac.segment3,
    pac.segment4,
    pac.segment5,
    pac.segment6,
    pac.segment7,
    pac.segment8,
    pac.segment9,
    pac.creation_date,
    DECODE (al.approval_status,
    NULL, 'Pending For Approval',
    'APPROVE', 'Finally Approved',
    al.approval_status)
    status,
    al.order_number,
    almin.order_number approver_order,
    ppf2.full_name
    FROM HR_API_TRANSACTION_Values htv,
    HR_API_TRANSACTIONS ht,
    HR_API_TRANSACTION_STEPS hts,
    PER_ANALYSIS_CRITERIA pac,
    hr.Ame_Approvals_History ah,
    per_people_f ppf,
    per_people_f ppf2,
    apps.fnd_user fu,
    apps.AME_TEMP_OLD_APPROVER_LISTS al,
    apps.AME_TEMP_OLD_APPROVER_LISTS almin
    WHERE al.application_id = '-81'
    AND al.transaction_id = ht.TRANSACTION_ID
    AND (al.approval_status NOT LIKE '%REP%'
    OR al.approval_status IS NULL)
    AND al.order_number =
    (SELECT MAX (ao.order_number)
    FROM apps.AME_TEMP_OLD_APPROVER_LISTS ao
    WHERE ao.transaction_id =
    ht.TRANSACTION_ID
    AND (ao.approval_status NOT LIKE
    '%REP%'
    OR ao.approval_status IS NULL))
    AND ht.creator_person_id = PPF.PERSON_ID
    AND ht.TRANSACTION_ID = ah.transaction_id
    AND HT.TRANSACTION_ID = HTS.TRANSACTION_ID
    AND fu.employee_id = PPF2.person_id
    AND almin.order_number =
    (SELECT MIN (aomin.order_number)
    FROM apps.AME_TEMP_OLD_APPROVER_LISTS aomin
    WHERE aomin.transaction_id =
    ht.TRANSACTION_ID
    AND aomin.approval_status IS NULL)
    AND almin.transaction_id = ht.TRANSACTION_ID
    AND almin.name = fu.user_name
    AND hts.TRANSACTION_STEP_ID =
    HTV.TRANSACTION_STEP_ID
    AND HTV.NAME = 'P_ANALYSIS_CRITERIA_ID'
    AND HTV.NUMBER_VALUE =
    PAC.ANALYSIS_CRITERIA_ID
    AND SYSDATE BETWEEN ppf.effective_start_date
    AND ppf.effective_end_date
    AND PROCESS_NAME = 'TA_AEC')
    UNION
    (SELECT PPF.PERSON_ID,
    ht.TRANSACTION_ID,
    pac.segment1,
    pac.segment2,
    pac.segment3,
    pac.segment4,
    pac.segment5,
    pac.segment6,
    pac.segment7,
    pac.segment8,
    pac.segment9,
    pac.creation_date,
    DECODE (al.approval_status,
    NULL, 'Pending For Approval',
    'APPROVE', 'Finally Approved',
    al.approval_status)
    status,
    al.order_number,
    al.order_number AS approver_order,
    '' AS name
    FROM HR_API_TRANSACTION_Values htv,
    HR_API_TRANSACTIONS ht,
    HR_API_TRANSACTION_STEPS hts,
    PER_ANALYSIS_CRITERIA pac,
    hr.Ame_Approvals_History ah,
    per_people_f ppf,
    per_people_f ppf2,
    apps.fnd_user fu,
    apps.AME_TEMP_OLD_APPROVER_LISTS al,
    apps.AME_TEMP_OLD_APPROVER_LISTS almin
    WHERE al.application_id = '-81'
    AND al.approval_status IS NOT NULL
    AND al.transaction_id = ht.TRANSACTION_ID
    AND ht.creator_person_id = PPF.PERSON_ID
    AND ht.TRANSACTION_ID = ah.transaction_id
    AND HT.TRANSACTION_ID = HTS.TRANSACTION_ID
    AND PROCESS_NAME = 'TA_AEC'
    AND fu.employee_id = PPF2.person_id
    AND al.order_number =
    (SELECT MAX (ao.order_number)
    FROM apps.AME_TEMP_OLD_APPROVER_LISTS ao
    WHERE ao.transaction_id =
    ht.TRANSACTION_ID
    AND (ao.approval_status NOT LIKE
    '%REP%'
    OR ao.approval_status IS NULL))
    AND al.name = fu.user_name
    AND almin.transaction_id = ht.TRANSACTION_ID
    AND hts.TRANSACTION_STEP_ID =
    HTV.TRANSACTION_STEP_ID
    AND HTV.NAME = 'P_ANALYSIS_CRITERIA_ID'
    AND HTV.NUMBER_VALUE = PAC.ANALYSIS_CRITERIA_ID
    AND SYSDATE BETWEEN ppf.effective_start_date
    AND ppf.effective_end_date
    AND PROCESS_NAME = 'TA_AEC'))) QRSLT
    WHERE (person_id = 26773)
    ORDER BY request_date DESC

    see also this . .
    Optimizer Environment (10053)
    #     Is
    Default     Parameter     Current
    Value
    1     N     _sort_elimination_cost_ratio     5
    2     N     _pga_max_size     838860 KB
    3     N     _b_tree_bitmap_plans     false
    4     N     _fast_full_scan_enabled     false
    5     N     _like_with_bind_as_equality     true
    6     N     optimizer_secure_view_merging     false
    7     Y     optimizer_mode_hinted     false
    8     Y     optimizer_features_hinted     0.0.0
    9     Y     parallel_execution_enabled     true
    10     Y     parallel_query_forced_dop     0
    11     Y     parallel_dml_forced_dop     0
    12     Y     parallel_ddl_forced_degree     0
    13     Y     parallel_ddl_forced_instances     0
    14     Y     _query_rewrite_fudge     90
    15     Y     optimizer_features_enable     10.2.0.4
    16     Y     _optimizer_search_limit     5
    17     Y     cpu_count     4
    18     Y     active_instance_count     1
    19     Y     parallel_threads_per_cpu     2
    20     Y     hash_area_size     131072
    21     Y     bitmap_merge_area_size     1048576
    22     Y     sort_area_size     65536
    23     Y     sort_area_retained_size     0
    24     Y     _optimizer_block_size     8192
    25     Y     _sort_multiblock_read_count     2
    26     Y     _hash_multiblock_io_count     0
    27     Y     _db_file_optimizer_read_count     8
    28     Y     _optimizer_max_permutations     2000
    29     Y     pga_aggregate_target     4194304 KB
    30     Y     _query_rewrite_maxdisjunct     257
    #     Is
    Default     Parameter     Current
    Value
    31     Y     _smm_auto_min_io_size     56 KB
    32     Y     _smm_auto_max_io_size     248 KB
    33     Y     _smm_min_size     1024 KB
    34     Y     _smm_max_size     419430 KB
    35     Y     _smm_px_max_size     2097152 KB
    36     Y     _cpu_to_io     0
    37     Y     _optimizer_undo_cost_change     10.2.0.4
    38     Y     parallel_query_mode     enabled
    39     Y     parallel_dml_mode     disabled
    40     Y     parallel_ddl_mode     enabled
    41     Y     optimizer_mode     all_rows
    42     Y     sqlstat_enabled     false
    43     Y     _optimizer_percent_parallel     101
    44     Y     _always_anti_join     choose
    45     Y     _always_semi_join     choose
    46     Y     _optimizer_mode_force     true
    47     Y     _partition_view_enabled     true
    48     Y     _always_star_transformation     false
    49     Y     _query_rewrite_or_error     false
    50     Y     _hash_join_enabled     true
    51     Y     cursor_sharing     exact
    52     Y     star_transformation_enabled     false
    53     Y     _optimizer_cost_model     choose
    54     Y     _new_sort_cost_estimate     true
    55     Y     _complex_view_merging     true
    56     Y     _unnest_subquery     true
    57     Y     _eliminate_common_subexpr     true
    58     Y     _pred_move_around     true
    59     Y     _convert_set_to_join     false
    60     Y     _push_join_predicate     true
    #     Is
    Default     Parameter     Current
    Value
    61     Y     _push_join_union_view     true
    62     Y     _optim_enhance_nnull_detection     true
    63     Y     _parallel_broadcast_enabled     true
    64     Y     _px_broadcast_fudge_factor     100
    65     Y     _ordered_nested_loop     true
    66     Y     _no_or_expansion     false
    67     Y     optimizer_index_cost_adj     100
    68     Y     optimizer_index_caching     0
    69     Y     _system_index_caching     0
    70     Y     _disable_datalayer_sampling     false
    71     Y     query_rewrite_enabled     true
    72     Y     query_rewrite_integrity     enforced
    73     Y     _query_cost_rewrite     true
    74     Y     _query_rewrite_2     true
    75     Y     _query_rewrite_1     true
    76     Y     _query_rewrite_expression     true
    77     Y     _query_rewrite_jgmigrate     true
    78     Y     _query_rewrite_fpc     true
    79     Y     _query_rewrite_drj     true
    80     Y     _full_pwise_join_enabled     true
    81     Y     _partial_pwise_join_enabled     true
    82     Y     _left_nested_loops_random     true
    83     Y     _improved_row_length_enabled     true
    84     Y     _index_join_enabled     true
    85     Y     _enable_type_dep_selectivity     true
    86     Y     _improved_outerjoin_card     true
    87     Y     _optimizer_adjust_for_nulls     true
    88     Y     _optimizer_degree     0
    89     Y     _use_column_stats_for_function     true
    90     Y     _subquery_pruning_enabled     true
    #     Is
    Default     Parameter     Current
    Value
    91     Y     _subquery_pruning_mv_enabled     false
    92     Y     _or_expand_nvl_predicate     true
    93     Y     _table_scan_cost_plus_one     true
    94     Y     _cost_equality_semi_join     true
    95     Y     _default_non_equality_sel_check     true
    96     Y     _new_initial_join_orders     true
    97     Y     _oneside_colstat_for_equijoins     true
    98     Y     _optim_peek_user_binds     true
    99     Y     _minimal_stats_aggregation     true
    100     Y     _force_temptables_for_gsets     false
    101     Y     workarea_size_policy     auto
    102     Y     _smm_auto_cost_enabled     true
    103     Y     _gs_anti_semi_join_allowed     true
    104     Y     _optim_new_default_join_sel     true
    105     Y     optimizer_dynamic_sampling     2
    106     Y     _pre_rewrite_push_pred     true
    107     Y     _optimizer_new_join_card_computation     true
    108     Y     _union_rewrite_for_gs     yes_gset_mvs
    109     Y     _generalized_pruning_enabled     true
    110     Y     _optim_adjust_for_part_skews     true
    111     Y     _force_datefold_trunc     false
    112     Y     statistics_level     typical
    113     Y     _optimizer_system_stats_usage     true
    114     Y     skip_unusable_indexes     true
    115     Y     _remove_aggr_subquery     true
    116     Y     _optimizer_push_down_distinct     0
    117     Y     _dml_monitoring_enabled     true
    118     Y     _optimizer_undo_changes     false
    119     Y     _predicate_elimination_enabled     true
    120     Y     _nested_loop_fudge     100
    #     Is
    Default     Parameter     Current
    Value
    121     Y     _project_view_columns     true
    122     Y     _local_communication_costing_enabled     true
    123     Y     _local_communication_ratio     50
    124     Y     _query_rewrite_vop_cleanup     true
    125     Y     _slave_mapping_enabled     true
    126     Y     _optimizer_cost_based_transformation     linear
    127     Y     _optimizer_mjc_enabled     true
    128     Y     _right_outer_hash_enable     true
    129     Y     _spr_push_pred_refspr     true
    130     Y     _optimizer_cache_stats     false
    131     Y     _optimizer_cbqt_factor     50
    132     Y     _optimizer_squ_bottomup     true
    133     Y     _fic_area_size     131072
    134     Y     _optimizer_skip_scan_enabled     true
    135     Y     _optimizer_cost_filter_pred     false
    136     Y     _optimizer_sortmerge_join_enabled     true
    137     Y     _optimizer_join_sel_sanity_check     true
    138     Y     _mmv_query_rewrite_enabled     true
    139     Y     _bt_mmv_query_rewrite_enabled     true
    140     Y     _add_stale_mv_to_dependency_list     true
    141     Y     _distinct_view_unnesting     false
    142     Y     _optimizer_dim_subq_join_sel     true
    143     Y     _optimizer_disable_strans_sanity_checks     0
    144     Y     _optimizer_compute_index_stats     true
    145     Y     _push_join_union_view2     true
    146     Y     _optimizer_ignore_hints     false
    147     Y     _optimizer_random_plan     0
    148     Y     _query_rewrite_setopgrw_enable     true
    149     Y     _optimizer_correct_sq_selectivity     true
    150     Y     _disable_function_based_index     false
    #     Is
    Default     Parameter     Current
    Value
    151     Y     _optimizer_join_order_control     3
    152     Y     _optimizer_cartesian_enabled     true
    153     Y     _optimizer_starplan_enabled     true
    154     Y     _extended_pruning_enabled     true
    155     Y     _optimizer_push_pred_cost_based     true
    156     Y     _sql_model_unfold_forloops     run_time
    157     Y     _enable_dml_lock_escalation     false
    158     Y     _bloom_filter_enabled     true
    159     Y     _update_bji_ipdml_enabled     0
    160     Y     _optimizer_extended_cursor_sharing     udo
    161     Y     _dm_max_shared_pool_pct     1
    162     Y     _optimizer_cost_hjsmj_multimatch     true
    163     Y     _optimizer_transitivity_retain     true
    164     Y     _px_pwg_enabled     true
    165     Y     _optimizer_join_elimination_enabled     true
    166     Y     flashback_table_rpi     non_fbt
    167     Y     _optimizer_cbqt_no_size_restriction     true
    168     Y     _optimizer_enhanced_filter_push     true
    169     Y     _optimizer_filter_pred_pullup     true
    170     Y     _rowsrc_trace_level     0
    171     Y     _simple_view_merging     true
    172     Y     _optimizer_rownum_pred_based_fkr     true
    173     Y     _optimizer_better_inlist_costing     all
    174     Y     _optimizer_self_induced_cache_cost     false
    175     Y     _optimizer_min_cache_blocks     10
    176     Y     _optimizer_or_expansion     depth
    177     Y     _optimizer_order_by_elimination_enabled     true
    178     Y     _optimizer_outer_to_anti_enabled     true
    179     Y     _selfjoin_mv_duplicates     true
    180     Y     _dimension_skip_null     true
    #     Is
    Default     Parameter     Current
    Value
    181     Y     _force_rewrite_enable     false
    182     Y     _optimizer_star_tran_in_with_clause     true
    183     Y     _optimizer_complex_pred_selectivity     true
    184     Y     _optimizer_connect_by_cost_based     true
    185     Y     _gby_hash_aggregation_enabled     true
    186     Y     _globalindex_pnum_filter_enabled     true
    187     Y     _fix_control_key     0
    188     Y     _optimizer_skip_scan_guess     false
    189     Y     _enable_row_shipping     false
    190     Y     _row_shipping_threshold     80
    191     Y     _row_shipping_explain     false
    192     Y     _optimizer_rownum_bind_default     10
    193     Y     _first_k_rows_dynamic_proration     true
    194     Y     _px_ual_serial_input     true
    195     Y     _optimizer_native_full_outer_join     off
    196     Y     _optimizer_star_trans_min_cost     0
    197     Y     _optimizer_star_trans_min_ratio     0
    198     Y     _optimizer_fkr_index_cost_bias     10
    199     Y     _optimizer_connect_by_combine_sw     true
    200     Y     _optimizer_use_subheap     true
    201     Y     _optimizer_or_expansion_subheap     true
    202     Y     _optimizer_sortmerge_join_inequality     true
    203     Y     _optimizer_use_histograms     true
    204     Y     _optimizer_enable_density_improvements     false

  • How to reduce performance time.

    Hi,
    Any body guide me how to reduce performance time for this report.
    It’s taking to much time for execution.
    *& Report  ZEOU_CST_CLAIM_REP                                          *
    REPORT  zeou_cst_claim_rep.
    *& Program Name    : ZEOU_CST_CLAIM_REP                                *
    *& Title           : CST Claim Report                                  *
    *& Module Name     : EOU                                               *
    *& Author          : Chandra Vangoor                                   *
    *& Create Date     : 05.05.2006                                        *
    *& Logical DB      : None                                              *
    *& Program Type    : On-Line.                                          *
    *& SAP Release     : 4.7                                               *
    *& Description     :                                                   *
    *& Log    Date    Author        Reason of change
    TABLES
    TABLES : a363,
             mara,
             marc,
             makt,
             ekko,
             ekpo,
             mkpf,
             mseg,
             konp,
             konh.
    SELECTION-SCREEN
    SELECTION-SCREEN   :   BEGIN OF BLOCK cst WITH FRAME TITLE text-001.
    SELECT-OPTIONS :   s_matnr FOR mara-matnr,                            "Material Number
                       s_lifnr FOR ekko-lifnr,                            "Account Number of the Vendor
                       s_bedat FOR ekko-bedat,                            "Purchasing Document Date
                       s_kschl FOR konh-kschl OBLIGATORY NO INTERVALS,    "Condition type
                       s_bwart FOR mseg-bwart OBLIGATORY NO INTERVALS.    "Movement Type (Inventory Management)
    PARAMETERS     :   p_werks LIKE marc-werks OBLIGATORY.                "Plant
    SELECTION-SCREEN   :   END OF BLOCK cst.
    INCLUDES
    INCLUDE zalv_data.
    DATA - INTERNAL TABLES AND FIELD LISTS
    DATA :  BEGIN    OF     a363_itab  OCCURS 0,
            matnr    LIKE   a363-matnr,                    "Material Number
            lifnr    LIKE   a363-lifnr,                    "Account Number of the Vendor
            werks    LIKE   a363-werks,                    "Plant
            kschl    LIKE   a363-kschl,                    "Condition type
            knumh    LIKE   a363-knumh,                    "Condition record number
            kbetr    LIKE   konp-kbetr,                    "Rate (condition amount or percentage) where no scale exists
            END      OF     a363_itab.
    DATA :  BEGIN    OF     konp_itab  OCCURS 0,
            knumh    LIKE   a363-knumh,                    "Condition record number
            kbetr    LIKE   konp-kbetr,                    "Rate (condition amount or percentage) where no scale exists
            lifnr    LIKE   a363-lifnr,                    "Account Number of the Vendor
            END      OF     konp_itab.
    DATA :  BEGIN    OF     ekko_itab  OCCURS 0,
            ebeln    LIKE   ekko-ebeln,                    "Purchasing Document Number
            lifnr    LIKE   ekko-lifnr,                    "Account Number of the Vendor
            bedat    LIKE   ekko-bedat,                    "Purchasing Document Date
            END      OF     ekko_itab.
    DATA :  BEGIN    OF     ekpo_itab  OCCURS 0,
            ebeln    LIKE   ekpo-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   ekpo-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   ekpo-matnr,                    "Material Number
            werks    LIKE   ekpo-werks,                    "Plant
            menge    LIKE   ekpo-menge,                    "Purchase order quantity
            END      OF     ekpo_itab.
    DATA :  BEGIN    OF     v_po_det  OCCURS 0,            "VENDOR + PLANT + PO DEATILS
            lifnr    LIKE   ekko-lifnr,                    "Account Number of the Vendor
            ebeln    LIKE   ekko-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   ekpo-ebelp,                    "Item Number of Purchasing Document
            bedat    LIKE   ekko-bedat,                    "Purchasing Document Date
            matnr    LIKE   ekpo-matnr,                    "Material Number
            werks    LIKE   ekpo-werks,                    "Plant
            menge    LIKE   ekpo-menge,                    "Purchase order quantity
            kbetr    LIKE   konp-kbetr,                    "Rate (condition amount or percentage) where no scale exists
            END      OF     v_po_det.
    DATA :  BEGIN    OF     mseg_itab  OCCURS 0,
            mblnr    LIKE   mseg-mblnr,                    "Number of Material Document
            ebeln    LIKE   mseg-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   mseg-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   mseg-matnr,                    "Material Number
            lifnr    LIKE   mseg-lifnr,                    "Account Number of the Vendor
            werks    LIKE   mseg-werks,                    "Plant
            menge    LIKE   mseg-menge,                    "Quantity
            dmbtr    LIKE   mseg-dmbtr,                    "Amount in local currency
            bwart    LIKE   mseg-bwart,                    "Movement Type (Inventory Management)
            END      OF     mseg_itab.
    DATA :  BEGIN    OF     mkpf_itab  OCCURS 0,
            mblnr    LIKE   mkpf-mblnr,                    "Number of Material Document
            bldat    LIKE   mkpf-bldat,                    "Document Date in Document
            END      OF     mkpf_itab.
    DATA :  BEGIN    OF     zeou_pcrdtl_itab  OCCURS 0,
            matnr    LIKE   zeou_pcrdtl-matnr,             "Material Number
            lifnr    LIKE   zeou_pcrdtl-lifnr,             "Account Number of the Vendor
            mblnr    LIKE   zeou_pcrdtl-mblnr,             "Number of Material Document
            whssn    LIKE   zeou_pcrdtl-whssn,             "Warehouse Records Entry Serial No.
            whsdt    LIKE   zeou_pcrdtl-whsdt,             "Warehouse Records Entry date
            END      OF     zeou_pcrdtl_itab.
    DATA :  BEGIN    OF     gr_wh_info  OCCURS 0,          "INFO OF GR & WH BASED ON MVMT TYPE & PO
            mblnr    LIKE   mseg-mblnr,                    "Number of Material Document
            bldat    LIKE   mkpf-bldat,                    "Document Date in Document
            ebeln    LIKE   mseg-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   ekpo-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   mseg-matnr,                    "Material Number
            lifnr    LIKE   mseg-lifnr,                    "Account Number of the Vendor
            werks    LIKE   mseg-werks,                    "Plant
            menge    LIKE   mseg-menge,                    "Quantity
            dmbtr    LIKE   mseg-dmbtr,                    "Amount in local currency
            bwart    LIKE   mseg-bwart,                    "Movement Type (Inventory Management)
            whssn    LIKE   zeou_pcrdtl-whssn,             "Warehouse Records Entry Serial No.
            whsdt    LIKE   zeou_pcrdtl-whsdt,             "Warehouse Records Entry date
            END      OF     gr_wh_info.
    DATA :  BEGIN    OF     bseg_itab  OCCURS 0,
            ebeln    LIKE   bseg-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   bseg-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   bseg-matnr,                    "Material Number
            lifnr    LIKE   bseg-lifnr,                    "Account Number of the Vendor
            werks    LIKE   bseg-werks,                    "Plant
            buzid    LIKE   bseg-buzid,                    "Identification of the Line Item
            bschl    LIKE   bseg-bschl,                    "Posting Key
            wrbtr    LIKE   bseg-wrbtr,                    "Amount in document currency
            bukrs    LIKE   bseg-bukrs,                    "Company Code
            belnr    LIKE   bseg-belnr,                    "Accounting Document Number
            gjahr    LIKE   bseg-gjahr,                    "Fiscal Year
            END      OF     bseg_itab.
    DATA :  BEGIN    OF     bkpf_itab  OCCURS 0,
            bukrs    LIKE   bkpf-bukrs,                    "Company Code
            belnr    LIKE   bkpf-belnr,                    "Accounting Document Number
            gjahr    LIKE   bkpf-gjahr,                    "Fiscal Year
            xblnr    LIKE   bkpf-xblnr,                    "Reference Document Number
            bldat    LIKE   bkpf-bldat,                    "Document Date in Document
            END      OF     bkpf_itab.
    DATA :  BEGIN    OF     vend_inv  OCCURS 0,            "VENDOR INVOICE DETAILS
            ebeln    LIKE   bseg-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   bseg-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   bseg-matnr,                    "Material Number
            lifnr    LIKE   bseg-lifnr,                    "Account Number of the Vendor
            werks    LIKE   bseg-werks,                    "Plant
            buzid    LIKE   bseg-buzid,                    "Identification of the Line Item
            bschl    LIKE   bseg-bschl,                    "Posting Key
            wrbtr    LIKE   bseg-wrbtr,                    "Amount in document currency
            bukrs    LIKE   bseg-bukrs,                    "Company Code
            belnr    LIKE   bseg-belnr,                    "Accounting Document Number
            gjahr    LIKE   bseg-gjahr,                    "Fiscal Year
            xblnr    LIKE   bkpf-xblnr,                    "Reference Document Number
            bldat    LIKE   bkpf-bldat,                    "Document Date in Document
            END      OF     vend_inv.
    DATA :  BEGIN    OF     chckinit  OCCURS 0,            "CHEQUE INIT INFO
            ebeln    LIKE   bseg-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   bseg-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   bseg-matnr,                    "Material Number
            lifnr    LIKE   bseg-lifnr,                    "Account Number of the Vendor
            werks    LIKE   bseg-werks,                    "Plant
            buzid    LIKE   bseg-buzid,                    "Identification of the Line Item
            bschl    LIKE   bseg-bschl,                    "Posting Key
            bukrs    LIKE   bkpf-bukrs,                    "Company Code
            belnr    LIKE   bkpf-belnr,                    "Accounting Document Number
            gjahr    LIKE   bkpf-gjahr,                    "Fiscal Year
            koart    LIKE   bseg-koart,                    "Account type
            augbl    LIKE   bseg-augbl,                    "Document Number of the Clearing Document
            END      OF     chckinit.
    DATA :  BEGIN    OF     chckpayer  OCCURS 0,           "CHEQUE BANK DETAILS
            vblnr    LIKE   payr-vblnr,                    "Document Number of the Payment Document
            zbukr    LIKE   payr-zbukr,                    "Paying company code
            gjahr    LIKE   payr-gjahr,                    "Fiscal Year
            chect    LIKE   payr-chect,                    "Check Number
            zaldt    LIKE   payr-zaldt,                    "Probable Payment Date (Cash Discount 1 Due)
            hbkid    LIKE   payr-hbkid,                    "Short key for a house bank
            END      OF     chckpayer.
    DATA :  chckpayer_u LIKE chckpayer OCCURS 0 WITH HEADER LINE.      "UNIQUE CHEQUE DETAILS
    DATA :  BEGIN    OF     chckfinal  OCCURS 0,           "CHEQUE FINAL INFO
            ebeln    LIKE   bseg-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   bseg-ebelp,                    "Item Number of Purchasing Document
            matnr    LIKE   bseg-matnr,                    "Material Number
            lifnr    LIKE   bseg-lifnr,                    "Account Number of the Vendor
            werks    LIKE   bseg-werks,                    "Plant
            buzid    LIKE   bseg-buzid,                    "Identification of the Line Item
            bschl    LIKE   bseg-bschl,                    "Posting Key
            bukrs    LIKE   bkpf-bukrs,                    "Company Code
            belnr    LIKE   bkpf-belnr,                    "Accounting Document Number
            gjahr    LIKE   bkpf-gjahr,                    "Fiscal Year
            koart    LIKE   bseg-koart,                    "Account type
            augbl    LIKE   bseg-augbl,                    "Document Number of the Clearing Document
            vblnr    LIKE   payr-vblnr,                    "Document Number of the Payment Document
            zbukr    LIKE   payr-zbukr,                    "Paying company code
            chect    LIKE   payr-chect,                    "Check Number
            zaldt    LIKE   payr-zaldt,                    "Probable Payment Date (Cash Discount 1 Due)
            hbkid    LIKE   payr-hbkid,                    "Short key for a house bank
            END      OF     chckfinal.
    DATA :  BEGIN    OF     mat_desc OCCURS 0,
            matnr    LIKE   mara-matnr,
            maktx    LIKE   makt-maktx,
            END      OF     mat_desc.
    DATA :  BEGIN      OF     vend_det OCCURS 0,
            lifnr      LIKE   lfa1-lifnr,
            name1      LIKE   lfa1-name1,
            j_1icstno  LIKE   j_1imovend-j_1icstno,
            END        OF     vend_det.
    DATA :  BEGIN    OF     cst_rep  OCCURS 0,             "FINAL CST REPORT
            lifnr    LIKE   a363-lifnr,                    "Account Number of the Vendor
            name1    LIKE   lfa1-name1,                    "Vendor Name
            j_1icstno  LIKE   j_1imovend-j_1icstno,        " Vendor CST No.
            werks    LIKE   a363-werks,                    "Plant
           kschl    LIKE   a363-kschl,                    "Condition type
            ebeln    LIKE   ekko-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   ekpo-ebelp,                    "Item Number of Purchasing Document
            bedat    LIKE   ekko-bedat,                    "Purchasing Document Date
            matnr    LIKE   ekpo-matnr,                    "Material Number
            maktx    LIKE   makt-maktx,                    "Material Description.
            kbetr    LIKE   konp-kbetr,                    "Rate (condition amount or percentage) where no scale exists
            mblnr    LIKE   mseg-mblnr,                    "Number of Material Document
            bldat    LIKE   mkpf-bldat,                    "Document Date in Document
            menge    LIKE   mseg-menge,                    "Quantity
            dmbtr    LIKE   mseg-dmbtr,                    "Amount in local currency
            cst_dmbtr LIKE  mseg-dmbtr,                    "CST Amount in local currency
            bwart    LIKE   mseg-bwart,                    "Movement Type (Inventory Management)
            whssn    LIKE   zeou_pcrdtl-whssn,             "Warehouse Records Entry Serial No.
            whsdt    LIKE   zeou_pcrdtl-whsdt,             "Warehouse Records Entry date
            buzid    LIKE   bseg-buzid,                    "Identification of the Line Item
            bschl    LIKE   bseg-bschl,                    "Posting Key
            wrbtr    LIKE   bseg-wrbtr,                    "Amount in document currency
            cst_wrbtr LIKE  bseg-wrbtr,                    "CST Amount in document currency
            belnr    LIKE   bseg-belnr,                    "Accounting Document Number
            gjahr    LIKE   bseg-gjahr,                    "Fiscal Year
            xblnr    LIKE   bkpf-xblnr,                    "Reference Document Number
            koart    LIKE   bseg-koart,                    "Account type
            augbl    LIKE   bseg-augbl,                    "Document Number of the Clearing Document
            vblnr    LIKE   payr-vblnr,                    "Document Number of the Payment Document
            zbukr    LIKE   payr-zbukr,                    "Paying company code
            chect    LIKE   payr-chect,                    "Check Number
            zaldt    LIKE   payr-zaldt,                    "Probable Payment Date (Cash Discount 1 Due)
            hbkid    LIKE   payr-hbkid,                    "Short key for a house bank
            END      OF     cst_rep.
    DATA :  BEGIN    OF     gt_output  OCCURS 0,              "ALV OUTPUT
            slno     LIKE   sy-tabix,                      "Serial Number
            lifnr    LIKE   a363-lifnr,                    "Account Number of the Vendor
            name1    LIKE   lfa1-name1,                    "Vendor Name
            j_1icstno  LIKE   j_1imovend-j_1icstno,        " Vendor CST No.
            werks    LIKE   a363-werks,                    "Plant
           kschl    LIKE   a363-kschl,                    "Condition type
            ebeln    LIKE   ekko-ebeln,                    "Purchasing Document Number
            ebelp    LIKE   ekpo-ebelp,                    "Item Number of Purchasing Document
            bedat    LIKE   ekko-bedat,                    "Purchasing Document Date
            matnr    LIKE   ekpo-matnr,                    "Material Number
            maktx    LIKE   makt-maktx,                    "Material Description
            mblnr    LIKE   mseg-mblnr,                    "Number of Material Document
            bldat    LIKE   mkpf-bldat,                    "Document Date in Document
            menge    LIKE   mseg-menge,                    "Quantity
            dmbtr    LIKE   mseg-dmbtr,                    "Amount in local currency
            cst_dmbtr LIKE  mseg-dmbtr,                    "CST Amount in local currency
            bwart    LIKE   mseg-bwart,                    "Movement Type (Inventory Management)
            whssn    LIKE   zeou_pcrdtl-whssn,             "Warehouse Records Entry Serial No.
            whsdt    LIKE   zeou_pcrdtl-whsdt,             "Warehouse Records Entry date
            buzid    LIKE   bseg-buzid,                    "Identification of the Line Item
            bschl    LIKE   bseg-bschl,                    "Posting Key
            wrbtr    LIKE   bseg-wrbtr,                    "Amount in document currency
            cst_wrbtr LIKE  bseg-wrbtr,                    "CST Amount in document currency
            belnr    LIKE   bseg-belnr,                    "Accounting Document Number
            gjahr    LIKE   bseg-gjahr,                    "Fiscal Year
            xblnr    LIKE   bkpf-xblnr,                    "Reference Document Number
            koart    LIKE   bseg-koart,                    "Account type
            augbl    LIKE   bseg-augbl,                    "Document Number of the Clearing Document
            vblnr    LIKE   payr-vblnr,                    "Document Number of the Payment Document
            zbukr    LIKE   payr-zbukr,                    "Paying company code
            chect    LIKE   payr-chect,                    "Check Number
            zaldt    LIKE   payr-zaldt,                    "Probable Payment Date (Cash Discount 1 Due)
            hbkid    LIKE   payr-hbkid,                    "Short key for a house bank
            usr_txt1(20) TYPE c,
            usr_txt2(20) TYPE c,
            END      OF     gt_output.
    *Working Variables
    DATA : cst_gr  LIKE  mseg-dmbtr,
           cst_inv LIKE  bseg-wrbtr,
           usr_txt1(20) TYPE c,
           usr_txt2(20) TYPE c.
    START-OF-SELECTION.
    *Retreiving Data from a363 table for the given input
      SELECT  matnr
              lifnr
              werks
              kschl
              knumh
              FROM a363
              INTO TABLE a363_itab
              WHERE matnr IN s_matnr AND lifnr IN s_lifnr AND werks EQ p_werks AND kschl IN s_kschl.
    *rakesh ***************************
    SELECT  *
             FROM konp
             INTO CORRESPONDING FIELDS OF TABLE konp_itab
             FOR ALL ENTRIES IN a363_itab
             WHERE knumh EQ a363_itab-knumh.
      IF  a363_itab[] IS NOT INITIAL.
        SELECT knumh
               kbetr
               lifnr
               FROM konp INTO TABLE konp_itab
               FOR ALL ENTRIES IN a363_itab
               WHERE knumh EQ a363_itab-knumh.
      ENDIF.
      LOOP AT a363_itab.
        READ TABLE konp_itab WITH KEY knumh = a363_itab-knumh.
        IF sy-subrc EQ 0.
          MOVE : konp_itab-kbetr TO a363_itab-kbetr.
          MODIFY a363_itab.
        ENDIF.
        CLEAR : a363_itab, konp_itab.
      ENDLOOP.
    rakesh****************************
    SELECT *
            FROM makt
            INTO CORRESPONDING FIELDS OF TABLE mat_desc
            FOR ALL ENTRIES IN a363_itab
            WHERE matnr EQ a363_itab-matnr.
      SELECT matnr
             maktx
             FROM makt INTO TABLE mat_desc
             FOR ALL ENTRIES IN a363_itab
             WHERE matnr EQ a363_itab-matnr.
      SELECT a~lifnr
             a~name1
             b~j_1icstno
             INTO TABLE vend_det
             FROM lfa1 AS a JOIN j_1imovend AS b
             ON alifnr EQ blifnr
             FOR ALL ENTRIES IN a363_itab
             WHERE a~lifnr EQ a363_itab-lifnr.
    Retreiving Data from EKKO & EKPO table for the given input
    And Populating the V_PO_DETAILS itab
    SELECT  *
             FROM ekko
             INTO CORRESPONDING FIELDS OF TABLE ekko_itab
             FOR ALL ENTRIES IN a363_itab
             WHERE lifnr EQ a363_itab-lifnr AND bedat IN s_bedat.
      IF  a363_itab[] IS NOT INITIAL.
        SELECT ebeln
               lifnr
               bedat
               FROM ekko INTO TABLE ekko_itab
               FOR ALL ENTRIES IN a363_itab
                WHERE lifnr EQ a363_itab-lifnr AND bedat IN s_bedat.
      ENDIF.
    SELECT  *
             FROM ekpo
             INTO CORRESPONDING FIELDS OF TABLE ekpo_itab
             FOR ALL ENTRIES IN a363_itab
             WHERE matnr EQ a363_itab-matnr AND werks EQ a363_itab-werks AND mwskz NE 'V0'.
      IF  a363_itab[] IS NOT INITIAL.
        SELECT ebeln
               ebelp
               matnr
               werks
               menge
               FROM ekpo INTO TABLE ekpo_itab
               FOR ALL ENTRIES IN a363_itab
               WHERE matnr EQ a363_itab-matnr AND werks EQ a363_itab-werks AND mwskz NE 'V0'.
      ENDIF.
      LOOP AT ekpo_itab.
        MOVE :   ekpo_itab-ebelp TO v_po_det-ebelp,
                 ekpo_itab-matnr TO v_po_det-matnr,
                 ekpo_itab-werks TO v_po_det-werks,
                 ekpo_itab-menge TO v_po_det-menge.
        READ TABLE ekko_itab WITH KEY ebeln = ekpo_itab-ebeln.
        IF sy-subrc EQ 0.
          MOVE  :  ekko_itab-lifnr TO v_po_det-lifnr,
                   ekko_itab-ebeln TO v_po_det-ebeln,
                   ekko_itab-bedat TO v_po_det-bedat.
          APPEND : v_po_det.
        ENDIF.
        CLEAR  : ekko_itab, ekpo_itab, v_po_det.
      ENDLOOP.
      LOOP AT v_po_det.
        READ TABLE a363_itab WITH KEY matnr = v_po_det-matnr lifnr = v_po_det-lifnr werks = v_po_det-werks.
        IF sy-subrc EQ 0.
          MOVE : a363_itab-kbetr TO v_po_det-kbetr.
          MODIFY v_po_det.
        ENDIF.
        CLEAR : a363_itab, v_po_det.
      ENDLOOP.
    Retreiving Data from MKPF & MSEG & ZEOU_PCRDTL table for the given input
    And Populating the GR_WH_info itab
    SELECT  *
             FROM mseg
             INTO CORRESPONDING FIELDS OF TABLE mseg_itab
             FOR ALL ENTRIES IN v_po_det
             WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND bwart IN s_bwart.
      IF v_po_det[] IS NOT INITIAL.
        SELECT mblnr
               ebeln
               ebelp
               matnr
               lifnr
               werks
               menge
               dmbtr
               bwart
               FROM mseg INTO TABLE mseg_itab
               FOR ALL ENTRIES IN v_po_det
               WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND bwart IN s_bwart.
      ENDIF.
      IF mseg_itab[] IS NOT INITIAL.
    SELECT  *
             FROM mkpf
             INTO CORRESPONDING FIELDS OF TABLE mkpf_itab
             FOR ALL ENTRIES IN mseg_itab
             WHERE mblnr EQ mseg_itab-mblnr.
        SELECT  mblnr
                bldat
                FROM mkpf INTO TABLE mkpf_itab
                FOR ALL ENTRIES IN mseg_itab
                WHERE mblnr EQ mseg_itab-mblnr.
      SELECT  *
             FROM zeou_pcrdtl
             INTO CORRESPONDING FIELDS OF TABLE zeou_pcrdtl_itab
             FOR ALL ENTRIES IN mseg_itab
             WHERE mblnr EQ mseg_itab-mblnr AND matnr EQ mseg_itab-matnr.
        SELECT matnr
               lifnr
               mblnr
               whssn
               whsdt
               FROM zeou_pcrdtl INTO TABLE zeou_pcrdtl_itab
                 FOR ALL ENTRIES IN mseg_itab
                 WHERE mblnr EQ mseg_itab-mblnr AND matnr EQ mseg_itab-matnr.
      ENDIF.
      LOOP AT mseg_itab.
        MOVE  :  mseg_itab-mblnr TO gr_wh_info-mblnr,
                 mseg_itab-ebeln TO gr_wh_info-ebeln,
                 mseg_itab-ebelp TO gr_wh_info-ebelp,
                 mseg_itab-matnr TO gr_wh_info-matnr,
                 mseg_itab-lifnr TO gr_wh_info-lifnr,
                 mseg_itab-werks TO gr_wh_info-werks,
                 mseg_itab-menge TO gr_wh_info-menge,
                 mseg_itab-dmbtr TO gr_wh_info-dmbtr,
                 mseg_itab-bwart TO gr_wh_info-bwart.
        READ TABLE mkpf_itab WITH KEY mblnr = mseg_itab-mblnr.
        IF sy-subrc EQ 0.
          MOVE  :  mkpf_itab-bldat TO gr_wh_info-bldat.
        ENDIF.
        READ TABLE zeou_pcrdtl_itab WITH KEY mblnr = mseg_itab-mblnr.
        IF sy-subrc EQ 0.
          MOVE  :  zeou_pcrdtl_itab-whssn TO gr_wh_info-whssn,
                   zeou_pcrdtl_itab-whsdt TO gr_wh_info-whsdt.
        ENDIF.
        APPEND : gr_wh_info.
        CLEAR : mseg_itab, mkpf_itab, gr_wh_info.
      ENDLOOP.
    Retreiving Data from BSEG & BKPF table
    And Populating the Vendor Invoice Details
      IF v_po_det[] IS NOT INITIAL.
    SELECT  *
             FROM bseg
             INTO CORRESPONDING FIELDS OF TABLE bseg_itab
             FOR ALL ENTRIES IN v_po_det
             WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '96'.
        SELECT  ebeln
                ebelp
                matnr
                lifnr
                werks
                buzid
                bschl
                wrbtr
                bukrs
                belnr
                gjahr
                FROM bseg INTO TABLE bseg_itab
                  FOR ALL ENTRIES IN v_po_det
                  WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '96'.
      ENDIF.
      IF bseg_itab[] IS NOT INITIAL.
    SELECT  *
             FROM bkpf
             INTO CORRESPONDING FIELDS OF TABLE bkpf_itab
             FOR ALL ENTRIES IN bseg_itab
             WHERE bukrs EQ bseg_itab-bukrs AND belnr EQ bseg_itab-belnr AND gjahr EQ bseg_itab-gjahr.
        SELECT  bukrs
                belnr
                gjahr
                xblnr
                bldat
                FROM bkpf INTO TABLE bkpf_itab
                FOR ALL ENTRIES IN bseg_itab
                WHERE bukrs EQ bseg_itab-bukrs AND belnr EQ bseg_itab-belnr AND gjahr EQ bseg_itab-gjahr.
      ENDIF.
      LOOP AT bseg_itab.
        MOVE  :  bseg_itab-ebeln TO vend_inv-ebeln,
                 bseg_itab-ebelp TO vend_inv-ebelp,
                 bseg_itab-matnr TO vend_inv-matnr,
                 bseg_itab-lifnr TO vend_inv-lifnr,
                 bseg_itab-werks TO vend_inv-werks,
                 bseg_itab-buzid TO vend_inv-buzid,
                 bseg_itab-bschl TO vend_inv-bschl,
                 bseg_itab-wrbtr TO vend_inv-wrbtr,
                 bseg_itab-bukrs TO vend_inv-bukrs,
                 bseg_itab-belnr TO vend_inv-belnr,
                 bseg_itab-gjahr TO vend_inv-gjahr.
        READ TABLE bkpf_itab WITH KEY bukrs = bseg_itab-bukrs belnr = bseg_itab-belnr gjahr = bseg_itab-gjahr.
        IF sy-subrc EQ 0.
          MOVE  :  bkpf_itab-xblnr TO vend_inv-xblnr,
                   bkpf_itab-bldat TO vend_inv-bldat.
          APPEND  :  vend_inv.
        ENDIF.
        CLEAR : vend_inv, bseg_itab, bkpf_itab.
      ENDLOOP.
    Retreiving Data from BSEG & BKPF table
    And Populating the Cheque Info Details
      IF v_po_det[] IS NOT INITIAL.
    SELECT  *
             FROM bseg
             INTO CORRESPONDING FIELDS OF TABLE chckinit
             FOR ALL ENTRIES IN v_po_det
             WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '86' AND koart EQ 'K'.
        SELECT  ebeln
                ebelp
                matnr
                lifnr
                werks
                buzid
                bschl
                bukrs
                belnr
                gjahr
                koart
                augbl
                FROM bseg INTO TABLE chckinit
                  FOR ALL ENTRIES IN v_po_det
                  WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '86' AND koart EQ 'K'.
      ENDIF.
      IF chckinit[] IS NOT INITIAL.
    SELECT  *
             FROM payr
             INTO CORRESPONDING FIELDS OF TABLE chckpayer
             FOR ALL ENTRIES IN chckinit
             WHERE vblnr EQ chckinit-augbl.
        SELECT  vblnr
                zbukr
                gjahr
                chect
                zaldt
                hbkid
                FROM payr INTO TABLE chckpayer
                FOR ALL ENTRIES IN chckinit
                WHERE vblnr EQ chckinit-augbl.
      ENDIF.
      SORT chckpayer BY vblnr DESCENDING.
      LOOP AT chckpayer.
        ON CHANGE OF chckpayer-vblnr.
          MOVE   : chckpayer TO chckpayer_u.
          APPEND : chckpayer_u.
          CLEAR  : chckpayer_u, chckpayer.
        ENDON.
      ENDLOOP.
      LOOP AT chckinit.
        MOVE  :  chckinit-ebeln TO chckfinal-ebeln,
                 chckinit-ebelp TO chckfinal-ebelp,
                 chckinit-matnr TO chckfinal-matnr,
                 chckinit-lifnr TO chckfinal-lifnr,
                 chckinit-werks TO chckfinal-werks,
                 chckinit-buzid TO chckfinal-buzid,
                 chckinit-bschl TO chckfinal-bschl,
                 chckinit-bukrs TO chckfinal-bukrs,
                 chckinit-gjahr TO chckfinal-gjahr,
                 chckinit-koart TO chckfinal-koart,
                 chckinit-augbl TO chckfinal-augbl.
        READ TABLE chckpayer_u WITH KEY vblnr = chckinit-augbl gjahr = chckinit-gjahr.
        IF sy-subrc EQ 0.
          MOVE  :  chckpayer_u-vblnr TO chckfinal-vblnr,
                   chckpayer_u-zbukr TO chckfinal-zbukr,
                   chckpayer_u-chect TO chckfinal-chect,
                   chckpayer_u-zaldt TO chckfinal-zaldt,
                   chckpayer_u-hbkid TO chckfinal-hbkid.
          APPEND : chckfinal.
        ENDIF.
        CLEAR : chckfinal, chckpayer_u, chckinit.
      ENDLOOP.
    Populating the final CST TABLE
      LOOP AT v_po_det.
        MOVE  :   v_po_det-lifnr TO cst_rep-lifnr,
                  v_po_det-werks TO cst_rep-werks,
                  v_po_det-ebeln TO cst_rep-ebeln,
                  v_po_det-ebelp TO cst_rep-ebelp,
                  v_po_det-bedat TO cst_rep-bedat,
                  v_po_det-matnr TO cst_rep-matnr,
                  v_po_det-kbetr TO cst_rep-kbetr.
        READ TABLE gr_wh_info WITH KEY ebeln = v_po_det-ebeln ebelp = v_po_det-ebelp."matnr = v_po_det-matnr.
        IF sy-subrc EQ 0.
          MOVE :  gr_wh_info-mblnr TO cst_rep-mblnr,
                  gr_wh_info-bldat TO cst_rep-bldat,
                  gr_wh_info-menge TO cst_rep-menge,
                  gr_wh_info-dmbtr TO cst_rep-dmbtr,
                  gr_wh_info-bwart TO cst_rep-bwart,
                  gr_wh_info-whssn TO cst_rep-whssn,
                  gr_wh_info-whsdt TO cst_rep-whsdt.
        ENDIF.
        READ TABLE vend_inv WITH KEY ebeln = v_po_det-ebeln ebelp = v_po_det-ebelp."matnr = v_po_det-matnr.
        IF sy-subrc EQ 0.
          MOVE : vend_inv-buzid TO cst_rep-buzid,
                 vend_inv-bschl TO cst_rep-bschl,
                 vend_inv-wrbtr TO cst_rep-wrbtr,
                 vend_inv-belnr TO cst_rep-belnr,
                 vend_inv-gjahr TO cst_rep-gjahr,
                 vend_inv-xblnr TO cst_rep-xblnr.
        ENDIF.
        READ TABLE chckfinal WITH KEY ebeln = v_po_det-ebeln ebelp = v_po_det-ebelp."matnr = v_po_det-matnr.
        IF sy-subrc EQ 0.
          MOVE : chckfinal-augbl TO cst_rep-augbl,
                 chckfinal-vblnr TO cst_rep-vblnr,
                 chckfinal-zbukr TO cst_rep-zbukr,
                 chckfinal-chect TO cst_rep-chect,
                 chckfinal-zaldt TO cst_rep-zaldt,
                 chckfinal-hbkid TO cst_rep-hbkid.
        ENDIF.
        READ TABLE mat_desc WITH KEY matnr = v_po_det-matnr.
        IF sy-subrc EQ 0.
          MOVE : mat_desc-maktx TO cst_rep-maktx.
        ENDIF.
        READ TABLE vend_det WITH KEY lifnr = v_po_det-lifnr.
        IF sy-subrc EQ 0.
          MOVE : vend_det-name1 TO cst_rep-name1,
                 vend_det-j_1icstno TO cst_rep-j_1icstno.
        ENDIF.
        APPEND : cst_rep.
        CLEAR  : cst_rep, v_po_det, gr_wh_info, vend_inv, chckfinal.
      ENDLOOP.
    Populating GT_output
      LOOP AT cst_rep.
        cst_gr = cst_rep-dmbtr * ( cst_rep-kbetr / 1000 ).
        cst_inv = cst_rep-wrbtr * ( cst_rep-kbetr / 1000 ).
        MOVE : cst_gr  TO cst_rep-cst_dmbtr,
               cst_inv TO cst_rep-cst_wrbtr.
        MODIFY : cst_rep.
        CLEAR : cst_rep, cst_gr, cst_inv.
      ENDLOOP.
      LOOP AT cst_rep.
        MOVE :  sy-tabix TO gt_output-slno,
                cst_rep-lifnr TO gt_output-lifnr,
                cst_rep-name1 TO gt_output-name1,
                cst_rep-j_1icstno TO gt_output-j_1icstno,
                cst_rep-werks TO gt_output-werks,
                cst_rep-matnr TO gt_output-matnr,
                cst_rep-maktx TO gt_output-maktx,
                cst_rep-ebeln TO gt_output-ebeln,
                cst_rep-ebelp TO gt_output-ebelp,
                cst_rep-bedat TO gt_output-bedat,
                cst_rep-mblnr TO gt_output-mblnr,
                cst_rep-bldat TO gt_output-bldat,
                cst_rep-menge TO gt_output-menge,
                cst_rep-dmbtr TO gt_output-dmbtr,
                cst_rep-cst_dmbtr TO gt_output-cst_dmbtr,
                cst_rep-bwart TO gt_output-bwart,
                cst_rep-whssn TO gt_output-whssn,
                cst_rep-whsdt TO gt_output-whsdt,
                cst_rep-buzid TO gt_output-buzid,
                cst_rep-bschl TO gt_output-bschl,
                cst_rep-wrbtr TO gt_output-wrbtr,
                cst_rep-cst_wrbtr TO gt_output-cst_wrbtr,
                cst_rep-belnr TO gt_output-belnr,
                cst_rep-gjahr TO gt_output-gjahr,
                cst_rep-xblnr TO gt_output-xblnr,
                cst_rep-augbl TO gt_output-augbl,
                cst_rep-vblnr TO gt_output-vblnr,
                cst_rep-zbukr TO gt_output-zbukr,
                cst_rep-chect TO gt_output-chect,
                cst_rep-zaldt TO gt_output-zaldt,
                cst_rep-hbkid TO gt_output-hbkid.
        APPEND gt_output.
        CLEAR : cst_rep, gt_output, sy-tabix.
      ENDLOOP.
    END-OF-SELECTION.
    *-ALV Routine
      PERFORM alv_forms.
    *&      Form  alv_forms
    FORM alv_forms.
      PERFORM alv_routines.
      gx_variant = sy-repid.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save     = g_save
        CHANGING
          cs_variant = gx_variant
        EXCEPTIONS
          not_found  = 2.
      IF sy-subrc = 0.
        vari = gx_variant-variant.
      ENDIF.
      PERFORM comment_build  USING gt_list_top_of_page[].
      PERFORM fieldcat_init  USING gt_fieldcat[].
      PERFORM layout_build USING gs_layout.
      PERFORM print_build  USING gs_print.
      PERFORM alv_output.
    ENDFORM.                    " alv_forms
    *&      Form  alv_routines
    FORM alv_routines.
      PERFORM eventtab_build USING gt_events[].
      PERFORM e06_t_sort_build  USING gt_sort[].
      PERFORM sp_group_build USING gt_sp_group[].
      g_save = 'A'.
      PERFORM variant_init.
    ENDFORM.                    " alv_routines
    *&      Form  eventtab_build
    ----

    Hi Anu,
    These two statements taking to much time for execution what I can do for reducing execution time.
    Regards,
    Rakesh
    SELECT ebeln
    ebelp
    matnr
    lifnr
    werks
    buzid
    bschl
    wrbtr
    bukrs
    belnr
    gjahr
    FROM bseg INTO TABLE bseg_itab
    FOR ALL ENTRIES IN v_po_det
    WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '96'.
    ENDIF.
    SELECT ebeln
    ebelp
    matnr
    lifnr
    werks
    buzid
    bschl
    bukrs
    belnr
    gjahr
    koart
    augbl
    FROM bseg INTO TABLE chckinit
    FOR ALL ENTRIES IN v_po_det
    WHERE ebeln EQ v_po_det-ebeln AND matnr EQ v_po_det-matnr AND buzid EQ 'W' AND bschl EQ '86' AND koart EQ 'K'.
    ENDIF.

  • How to find out the execution time of a sql inside a function

    Hi All,
    I am writing one function. There is only one IN parameter. In that parameter, i will pass one SQL select statement. And I want the function to return the exact execution time of that SQL statement.
    CREATE OR REPLACE FUNCTION function_name (p_sql IN VARCHAR2)
    RETURN NUMBER
    IS
    exec_time NUMBER;
    BEGIN
    --Calculate the execution time for the incoming sql statement.
    RETURN exec_time;
    END function_name;
    /

    Please note that wrapping query in a "SELECT COUNT(*) FROM (<query>)" doesn't necessarily reflect the execution time of the stand-alone query because the optimizer is smart and might choose a completely different execution plan for that query.
    A simple test case shows the potential difference of work performed by the database:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    Session altered.
    SQL>
    SQL> drop table count_test purge;
    Table dropped.
    Elapsed: 00:00:00.17
    SQL>
    SQL> create table count_test as select * from all_objects;
    Table created.
    Elapsed: 00:00:02.56
    SQL>
    SQL> alter table count_test add constraint pk_count_test primary key (object_id)
    Table altered.
    Elapsed: 00:00:00.04
    SQL>
    SQL> exec dbms_stats.gather_table_stats(ownname=>null, tabname=>'COUNT_TEST')
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.29
    SQL>
    SQL> set autotrace traceonly
    SQL>
    SQL> select * from count_test;
    5326 rows selected.
    Elapsed: 00:00:00.10
    Execution Plan
    Plan hash value: 3690877688
    | Id  | Operation         | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |            |  5326 |   431K|    23   (5)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| COUNT_TEST |  5326 |   431K|    23   (5)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
            419  consistent gets
              0  physical reads
              0  redo size
         242637  bytes sent via SQL*Net to client
           4285  bytes received via SQL*Net from client
            357  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
           5326  rows processed
    SQL>
    SQL> select count(*) from (select * from count_test);
    Elapsed: 00:00:00.00
    Execution Plan
    Plan hash value: 572193338
    | Id  | Operation             | Name          | Rows  | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |               |     1 |     5   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE       |               |     1 |            |          |
    |   2 |   INDEX FAST FULL SCAN| PK_COUNT_TEST |  5326 |     5   (0)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
             16  consistent gets
              0  physical reads
              0  redo size
            412  bytes sent via SQL*Net to client
            380  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL>As you can see the number of blocks processed (consistent gets) is quite different. You need to actually fetch all records, e.g. using a PL/SQL block on the server to find out how long it takes to process the query, but that's not that easy if you want to have an arbitrary query string as input.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle:
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Query Database: reduce execution time

    Hi to all,
    I have Oracle 11g R2.
    I want reduce to max the execution time of this my select:
    SELECT a.ID, a.FULLNAME, a.L_AXON, a.R_AXON, a.L_LAXON, a.R_LAXON, a.L_F_F_ADD, a.R_F_F_ADD, a.L_T_F_ADD, a.R_T_F_ADD, a.L_PC, a.R_PC FROM ITALIA_GC a WHERE SDO_WITHIN_DISTANCE(a.GEOMETRY, MDSYS.SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(13.8268523, 41.491619, NULL) ,NULL, NULL), 'DISTANCE=100 UNIT=M') = 'TRUE' AND ROWNUM=1;
    This query returns the name, city, postal code and address of a street of Italy. These datas are in ITALIA_GC table.
    I already created an spatial index on GEOMETRY field of this table:
    CREATE INDEX ITALIA_GC_IDX ON ITALIA_GC(GEOMETRY) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    How can I see the execution time (i need to know the execution time in milliseconds) of this query and how can I reduce to max it?
    thank you very much in advance.
    Crystal

    Thank you.
    I used explain plan and SQL*Trace/tkprof method.
    What I would like to know is if the execution time are misured in seconds or milliseconds (I wish to know misure in millisecond).
    The result of SQL*Trace/tkprof method is:
    TKPROF: Release 11.2.0.1.0 - Development on Tue Jul 27 15:33:28 2010
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Trace file: dbuir_ora_29053.trc
    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
    SQL ID: 1bf1x0q79c1rm
    Plan Hash: 2374671442
    SELECT a.ID, a.FULLNAME, a.L_AXON, a.R_AXON, a.L_LAXON, a.R_LAXON,
      a.L_F_F_ADD, a.R_F_F_ADD, a.L_T_F_ADD, a.R_T_F_ADD, a.L_PC, a.R_PC
    FROM
    ITALIA_GC a WHERE SDO_WITHIN_DISTANCE(a.GEOMETRY, MDSYS.SDO_GEOMETRY(2001,
      8307, MDSYS.SDO_POINT_TYPE(13.8268523, 41.491619, NULL) ,NULL, NULL),
      'DISTANCE=100 UNIT=M') = 'TRUE' AND ROWNUM=1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.02          0         30          2           0
    Fetch        2      0.00       0.00          0         14          0           1
    total        4      0.00       0.02          0         44          2           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 85 
    Rows     Row Source Operation
          1  COUNT STOPKEY (cr=110 pr=0 pw=0 time=0 us)
          1   TABLE ACCESS BY INDEX ROWID ITALIA_GC (cr=110 pr=0 pw=0 time=0 us cost=0 size=4142 card=1)
          1    DOMAIN INDEX  ITALIA_GC_IDX (cr=109 pr=0 pw=0 time=0 us cost=0 size=0 card=0)
    SQL ID: 20y2xs9zmrbc5
    Plan Hash: 4105568395
    SELECT a."GEOMETRY"
    FROM
    "SPATIAL".ITALIA_GC a where a.rowid=:rid
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute     20      0.00       0.00          0          0          0           0
    Fetch       20      0.00       0.00          0         20          0          20
    total       41      0.00       0.00          0         20          0          20
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 85     (recursive depth: 1)
    Rows     Row Source Operation
          1  TABLE ACCESS BY USER ROWID ITALIA_GC (cr=1 pr=0 pw=0 time=0 us cost=1 size=3831 card=1)
    SQL ID: 9pxc8jgf3tj20
    Plan Hash: 1946957531
    SELECT diminfo, nvl(srid,-1)
    FROM
      ALL_SDO_GEOM_METADATA WHERE OWNER = :own AND TABLE_NAME = NLS_UPPER(:tab)
      AND '"'||COLUMN_NAME||'"' = :col
    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          9          0           1
    total        3      0.00       0.00          0          9          0           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 85     (recursive depth: 1)
    Rows     Row Source Operation
          1  VIEW  ALL_SDO_GEOM_METADATA (cr=9 pr=0 pw=0 time=0 us cost=25 size=654 card=2)
          1   UNION-ALL  (cr=9 pr=0 pw=0 time=0 us)
          1    MERGE JOIN CARTESIAN (cr=9 pr=0 pw=0 time=0 us cost=6 size=81 card=1)
          1     VIEW  ALL_OBJECTS (cr=7 pr=0 pw=0 time=0 us cost=5 size=45 card=1)
          1      FILTER  (cr=7 pr=0 pw=0 time=0 us)
          1       FILTER  (cr=7 pr=0 pw=0 time=0 us)
          1        NESTED LOOPS  (cr=7 pr=0 pw=0 time=0 us cost=5 size=124 card=1)
          1         NESTED LOOPS  (cr=6 pr=0 pw=0 time=0 us cost=4 size=102 card=1)
          1          TABLE ACCESS BY INDEX ROWID USER$ (cr=2 pr=0 pw=0 time=0 us cost=1 size=18 card=1)
          1           INDEX UNIQUE SCAN I_USER1 (cr=1 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 46)
          1          TABLE ACCESS BY INDEX ROWID OBJ$ (cr=4 pr=0 pw=0 time=0 us cost=3 size=84 card=1)
          1           INDEX RANGE SCAN I_OBJ5 (cr=3 pr=0 pw=0 time=0 us cost=2 size=0 card=1)(object id 40)
          1         INDEX RANGE SCAN I_USER2 (cr=1 pr=0 pw=0 time=0 us cost=1 size=22 card=1)(object id 47)
          0       TABLE ACCESS BY INDEX ROWID IND$ (cr=0 pr=0 pw=0 time=0 us cost=2 size=8 card=1)
          0        INDEX UNIQUE SCAN I_IND1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 41)
          0       HASH JOIN  (cr=0 pr=0 pw=0 time=0 us cost=3 size=24 card=1)
          0        INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us cost=2 size=11 card=1)(object id 62)
          0        FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us cost=0 size=1300 card=100)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=2 size=48 card=2)
          0        INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us cost=2 size=11 card=1)(object id 62)
          0        FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=2)
          0       HASH JOIN  (cr=0 pr=0 pw=0 time=0 us cost=3 size=24 card=1)
          0        INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us cost=2 size=11 card=1)(object id 62)
          0        FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us cost=0 size=1300 card=100)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us)
          0        NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=7 size=78 card=1)
          0         NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=5 size=68 card=1)
          0          NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=4 size=57 card=1)
          0           MERGE JOIN CARTESIAN (cr=0 pr=0 pw=0 time=0 us cost=3 size=53 card=1)
          0            INDEX RANGE SCAN I_OBJ5 (cr=0 pr=0 pw=0 time=0 us cost=3 size=40 card=1)(object id 40)
          0            BUFFER SORT (cr=0 pr=0 pw=0 time=0 us cost=0 size=1300 card=100)
          0             FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us cost=0 size=1300 card=100)
          0           INDEX RANGE SCAN I_USER2 (cr=0 pr=0 pw=0 time=0 us cost=1 size=4 card=1)(object id 47)
          0          INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=11 card=1)(object id 62)
          0         INDEX RANGE SCAN I_DEPENDENCY1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=0 card=3)(object id 106)
          0        TABLE ACCESS BY INDEX ROWID DEPENDENCY$ (cr=0 pr=0 pw=0 time=0 us cost=2 size=10 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=2 size=72 card=2)
          0        NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=2 size=23 card=1)
          0         TABLE ACCESS BY INDEX ROWID TRIGGER$ (cr=0 pr=0 pw=0 time=0 us cost=1 size=12 card=1)
          0          INDEX UNIQUE SCAN I_TRIGGER2 (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 162)
          0         INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=11 card=1)(object id 62)
          0        FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=2)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us)
          0        NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=7 size=78 card=1)
          0         NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=5 size=68 card=1)
          0          NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=4 size=57 card=1)
          0           MERGE JOIN CARTESIAN (cr=0 pr=0 pw=0 time=0 us cost=3 size=53 card=1)
          0            INDEX RANGE SCAN I_OBJ5 (cr=0 pr=0 pw=0 time=0 us cost=3 size=40 card=1)(object id 40)
          0            BUFFER SORT (cr=0 pr=0 pw=0 time=0 us cost=0 size=1300 card=100)
          0             FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us cost=0 size=1300 card=100)
          0           INDEX RANGE SCAN I_USER2 (cr=0 pr=0 pw=0 time=0 us cost=1 size=4 card=1)(object id 47)
          0          INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=11 card=1)(object id 62)
          0         INDEX RANGE SCAN I_DEPENDENCY1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=0 card=3)(object id 106)
          0        TABLE ACCESS BY INDEX ROWID DEPENDENCY$ (cr=0 pr=0 pw=0 time=0 us cost=2 size=10 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       VIEW  (cr=0 pr=0 pw=0 time=0 us cost=2 size=13 card=1)
          0        FAST DUAL  (cr=0 pr=0 pw=0 time=0 us cost=2 size=0 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=2 size=21 card=1)
          0        INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us cost=2 size=8 card=1)(object id 62)
          0        FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us cost=0 size=13 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=2 size=21 card=1)
          0        INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us cost=2 size=8 card=1)(object id 62)
          0        FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us cost=0 size=13 card=1)
          0       FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
          0       VIEW  (cr=0 pr=0 pw=0 time=0 us cost=1 size=16 card=1)
          0        SORT GROUP BY (cr=0 pr=0 pw=0 time=0 us cost=1 size=86 card=1)
          0         NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=1 size=86 card=1)
          0          MERGE JOIN CARTESIAN (cr=0 pr=0 pw=0 time=0 us cost=0 size=78 card=1)
          0           NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=0 size=65 card=1)
          0            INDEX UNIQUE SCAN I_OLAP_CUBES$ (cr=0 pr=0 pw=0 time=0 us cost=0 size=13 card=1)(object id 940)
          0            TABLE ACCESS BY INDEX ROWID OLAP_DIMENSIONALITY$ (cr=0 pr=0 pw=0 time=0 us cost=0 size=52 card=1)
          0             INDEX RANGE SCAN I_OLAP_DIMENSIONALITY$ (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 944)
          0           BUFFER SORT (cr=0 pr=0 pw=0 time=0 us cost=0 size=13 card=1)
          0            INDEX FULL SCAN I_OLAP_CUBE_DIMENSIONS$ (cr=0 pr=0 pw=0 time=0 us cost=0 size=13 card=1)(object id 928)
          0          INDEX RANGE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=8 card=1)(object id 36)
          0       NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=2 size=29 card=1)
          0        INDEX FULL SCAN I_USER2 (cr=0 pr=0 pw=0 time=0 us cost=1 size=20 card=1)(object id 47)
          0        INDEX RANGE SCAN I_OBJ4 (cr=0 pr=0 pw=0 time=0 us cost=1 size=9 card=1)(object id 39)
          1     BUFFER SORT (cr=2 pr=0 pw=0 time=0 us cost=6 size=36 card=1)
          1      TABLE ACCESS BY INDEX ROWID SDO_GEOM_METADATA_TABLE (cr=2 pr=0 pw=0 time=0 us cost=1 size=36 card=1)
          1       INDEX RANGE SCAN SDO_GEOM_IDX (cr=1 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 62259)
          0    FILTER  (cr=0 pr=0 pw=0 time=0 us)
          0     HASH JOIN  (cr=0 pr=0 pw=0 time=0 us cost=19 size=293 card=1)
          0      MERGE JOIN CARTESIAN (cr=0 pr=0 pw=0 time=0 us cost=18 size=238 card=1)
          0       NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us cost=18 size=225 card=1)
          0        NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us cost=17 size=221 card=1)
          0         NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us cost=16 size=213 card=1)
          0          NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us cost=15 size=209 card=1)
          0           NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us cost=14 size=201 card=1)
          0            NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us cost=13 size=196 card=1)
          0             NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=12 size=185 card=1)
          0              NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=11 size=181 card=1)
          0               NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=9 size=172 card=1)
          0                NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=8 size=144 card=1)
          0                 NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=7 size=123 card=1)
          0                  NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=6 size=120 card=1)
          0                   NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=5 size=90 card=1)
          0                    NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=2 size=54 card=1)
          0                     TABLE ACCESS BY INDEX ROWID USER$ (cr=0 pr=0 pw=0 time=0 us cost=1 size=18 card=1)
          0                      INDEX UNIQUE SCAN I_USER1 (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 46)
          0                     TABLE ACCESS BY INDEX ROWID SDO_GEOM_METADATA_TABLE (cr=0 pr=0 pw=0 time=0 us cost=1 size=36 card=1)
          0                      INDEX RANGE SCAN SDO_GEOM_IDX (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 62259)
          0                    TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us cost=3 size=36 card=1)
          0                     INDEX RANGE SCAN I_OBJ2 (cr=0 pr=0 pw=0 time=0 us cost=2 size=0 card=1)(object id 37)
          0                   TABLE ACCESS CLUSTER TAB$ (cr=0 pr=0 pw=0 time=0 us cost=1 size=30 card=1)
          0                    INDEX UNIQUE SCAN I_OBJ# (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 3)
          0                  TABLE ACCESS CLUSTER TS$ (cr=0 pr=0 pw=0 time=0 us cost=1 size=3 card=1)
          0                   INDEX UNIQUE SCAN I_TS# (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 7)
          0                 TABLE ACCESS CLUSTER COL$ (cr=0 pr=0 pw=0 time=0 us cost=1 size=21 card=1)
          0                TABLE ACCESS CLUSTER COLTYPE$ (cr=0 pr=0 pw=0 time=0 us cost=1 size=28 card=1)
          0               TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 pr=0 pw=0 time=0 us cost=2 size=9 card=1)
          0                INDEX RANGE SCAN I_OBJ3 (cr=0 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 38)
          0              INDEX RANGE SCAN I_USER2 (cr=0 pr=0 pw=0 time=0 us cost=1 size=4 card=1)(object id 47)
          0             TABLE ACCESS CLUSTER SEG$ (cr=0 pr=0 pw=0 time=0 us cost=1 size=11 card=1)
          0              INDEX UNIQUE SCAN I_FILE#_BLOCK# (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 9)
          0            INDEX RANGE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=5 card=1)(object id 36)
          0           INDEX RANGE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=8 card=1)(object id 36)
          0          INDEX RANGE SCAN I_USER2 (cr=0 pr=0 pw=0 time=0 us cost=1 size=4 card=1)(object id 47)
          0         INDEX RANGE SCAN I_OBJ1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=8 card=1)(object id 36)
          0        INDEX RANGE SCAN I_USER2 (cr=0 pr=0 pw=0 time=0 us cost=1 size=4 card=1)(object id 47)
          0       BUFFER SORT (cr=0 pr=0 pw=0 time=0 us cost=17 size=1300 card=100)
          0        FIXED TABLE FULL X$KSPPCV (cr=0 pr=0 pw=0 time=0 us cost=0 size=1300 card=100)
          0      FIXED TABLE FULL X$KSPPI (cr=0 pr=0 pw=0 time=0 us cost=0 size=55 card=1)
          0     NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=2 size=21 card=1)
          0      INDEX RANGE SCAN I_OBJAUTH1 (cr=0 pr=0 pw=0 time=0 us cost=2 size=8 card=1)(object id 62)
          0      FIXED TABLE FULL X$KZSRO (cr=0 pr=0 pw=0 time=0 us cost=0 size=13 card=1)
          0     FIXED TABLE FULL X$KZSPR (cr=0 pr=0 pw=0 time=0 us cost=0 size=26 card=1)
    ********************************************************************************The result of Explain plan method is:
    PLAN_TABLE_OUTPUT
    Plan hash value: 2374671442
    | Id  | Operation                    | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT             |               |     1 |  4142 |     0   (0)                | 00:00:01 |
    |*  1 |  COUNT STOPKEY               |               |       |       |         |          |
    |   2 |   TABLE ACCESS BY INDEX ROWID| ITALIA_GC     | 49989 |   197M|     0   (0)| 00:00:01 |
    |*  3 |    DOMAIN INDEX              | ITALIA_GC_IDX |       |       |     0   (0)               | 00:00:01 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       1 - filter(ROWNUM=1)
       3 - access("MDSYS"."SDO_WITHIN_DISTANCE"("A"."GEOMETRY","MDSYS"."SDO_GEOMETRY"(2001
    PLAN_TABLE_OUTPUT
                  ,8307,"MDSYS"."SDO_POINT_TYPE"(13.8268523,41.491619,NULL),NULL,NULL),'DISTANCE=100 UNIT=M')='TRUE')
    Note
       - dynamic sampling used for this statement (level=2)
    22 rows selected.thank you very much.

  • Reduce execution time

    How to reduce the execution time of this code? 
    Loop at porder1.
    SELECT aufnr bstmg hsdat sgtxt bwart charg FROM mseg INTO
    (porder-aufnr,porder-bstmg,porder-hsdat,porder-sgtxt,porder-bwart,
    porder-charg)
                                             WHERE matnr = porder1-matnr AND
                                                   aufnr = porder1-aufnr AND
                                                   werks = porder1-pwerk AND
                                                   ( bwart = '101' OR
                                                     bwart = '102' ).
    Endselect.
    Endloop.
    Regards
    Praju .

    Hi prajwal.
    I would like to suggest,
    It is possible to reduce the time of execution by Increasing the number of fields in the WHERE clause as only those specific number of records are fetched which results in comparatively less execution time.
    Also, SAP has designed such powerfull tools like Transactions - ST05,  ST07, ST30, and many more
    I would like to suggest you a couple of references relating to your case,
    [SDN - Reference for Long execution time during processing of a select query|/thread/477540 [original link is broken];
    [SDN - Reference for Reducing the Execution time of the program - Tools|How can i reduce time of execution;
    [SDN - Reference for solutions to reduce the execution time of a program|How to reduce my query execution time?;
    Hope that's usefull.
    Good Luck & Regards.
    Harsh Dave

  • How to extract execution time of a step

    how to extract execution time of a step ?
    This step calls another sequence, and
    I want to know how long it take to execute that seqeuence.
    I need this information during run time, not in the
    report.
    thanks.

    Hi,
    You could try.
    Enable the Record Result for the step in question.
    This will allow you to extract the TotalTime.
    Then you could use the RemoveElements(Locals.ResultList,"[0]",1) - this assumes you have only logged one result. This is the same as not recording results for that step.
    Otherwise you will have to workout the time yourself by calling the API Execution.SecondsExecuting() - API Execution.SecondsAtStart().
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How to reduce Boot time of 10.8.3

    How to reduce Boot time of 10.8.3(Mountain Lion),Have Upgraded from 10.6.x recently,
    Dont have any start up items, No Dual Boot, No user accounts not even guest(Turned off)
    I really Dont Know what to do, Please help me in this..

    Go to the Startup Disk system preferences and select your boot drive in there. This will ensure the system has your main boot drive set in the PRAM as a the default boot device. Without this, the system may pause while it searches for an available boot device.
    Do you have FileVault disk encryption enabled? If so then this may increase boot times a touch.
    Do you have any system monitors, firewalls, or security software installed? Again these may also increase boot times as they load in the background, especially if they use kernel extensions.
    Finally, boot to the OS X Recovery HD partition by holding the Command-R keys at startup. In here, launch Disk Utility and run a permissions fix on the boot drive, followed by running a repair on the boot drive (both done in the First Aid tab). If there are any access permissions or format structure issues on the boot drive then this should fix them.
    Is your hard drive relatively full? If you only have a few GB of space left on the drive then you might consider removing some files to give the system breathing room to better manage memory. Additionally, how much RAM do you have installed? If you have less than 4GB then consider upgrading. While older versions of OS X could get away with 1-2GB of RAM, this amount will only bog down Lion and Mountain Lion. 4GB is a recommended minimum.
    Some of these things could provide cumulative delays that you might find noticeable at bootup.

  • Web report for opening it takes long time how to reduce the time?

    HI Experts,
    I created report using webi. For next time while opening it takes more time. How to reduce the time.

    Hi Manikandan,
    There could be multiple reason behind the bad performance.
    1. Are you using supported JVM version to run Webi reports?
    2. Do the reports contain prompts? Are the LOVs set to "Automatic refresh before use"? If yes, uncheck it.
    3. How many queries do the report has? Can you run the queries one by one and check which query is taking much time?
    4. If it based on relational database, copy and run it against the database directly and check how much time it takes. If more, you may have to fix the issue at database level like using temporary tables, indices, etc.
    5. Also check if there are firewalls or proxy server between client and server communication. if yes, try to refresh the report directly on BO server and check.
    6. Check if there is any hinderance between BO server and Database server communcation.
    Hope it will help.
    Regards,
    Yuvraj

  • Can the format of a SQL Statement modify the execution time of an SQL ....

    Can the format of a SQL Statement modify the execution time of an SQL statement?
    Thanks in advance

    It depends on:
    1) What oracle version are you using
    2) What do you mean for "format"
    For example: if you're on Oracle9i and changing format means changing the order of the tables in the FROM clause and you're using Rule Based Optimizer then the execution plan and the execution time can be very different...
    Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2009/12/29/estrarre-i-dati-in-formato-xml-da-sql/]

  • How to reduce download time for intial swf?

    How to reduce download time for intial swf?
    There are a number of RPC calls but most of the data is cached at server end but still swf takes a lot of time to download completely.
    What all are the ways by which i can reuce the inital load time of my application?

    Reduce the size of the SWF by moving code and assets not needed for the
    first screen out into modules.

  • How to reduce the fetch time of this sql?

    Here is the SQL, three-table join and joining conditions are:
    ms_ets_cntrl.ims_cntrt_oid=ims_alctn.ims_alctn_oid
    ims_alctn.ims_trde_oid=ims_trde.ims_trde_oid
    SELECT 'MCH' Type, ims_ets_cntrl.STTS tp_stts, count(*) Count  FROM ims_ets_cntrl  where ims_ets_cntrl.ims_cntrt_oid in
    (select ims_alctn.ims_alctn_oid  FROM ims_alctn, ( select ims_trde.ims_trde_oid from ims_trde
    where ( IMS_TRDE.IMS_TRDE_RCPT_DTTM  >= TO_DATE('10/29/2009 00:00', 'MM/DD/YYYY HH24:MI') AND IMS_TRDE.IMS_TRDE_RCPT_DTTM <= (TO_DATE('11/5/2009 23:59', 'MM/DD/YYYY HH24:MI')) )
    AND (IMS_TRDE.GRS_TRX_TYPE IN ('INJECTION','WITHDRAWAL','PAYMENT') OR IMS_TRDE.SSC_INVST_TYPE = 'FC' AND  1=1  and IMS_TRDE.SERVICE_TYPE='FS' )) TRDE
    where IMS_ALCTN.IMS_TRDE_OID=TRDE.IMS_TRDE_OID) and ims_ets_cntrl.outbnd_dest = 'ETD' group by ims_ets_cntrl.STTSOptimizer and related parameter info:
    SQL> show parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_dynamic_sampling           integer     1
    optimizer_features_enable            string      9.2.0
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_max_permutations           integer     2000
    optimizer_mode                       string      CHOOSE
    SQL>select pname, pval1, pval2 from sys.aux_stats$ where sname='SYSSTATS_INFO';
    DSTART          11-16-2009 10:23
    DSTOP          11-16-2009 10:23
    FLAGS     1     
    STATUS          NOWORKLOADHere is autotrace output:
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE
       1    0   SORT (GROUP BY)
       2    1     VIEW
       3    2       SORT (UNIQUE)
       4    3         TABLE ACCESS (BY INDEX ROWID) OF 'IMS_ETS_CNTRL'
       5    4           NESTED LOOPS
       6    5             NESTED LOOPS
       7    6               TABLE ACCESS (BY INDEX ROWID) OF 'IMS_TRDE'
       8    7                 INDEX (RANGE SCAN) OF 'IMS_TRDE_INDX4' (NON- UNIQUE)
       9    6               TABLE ACCESS (BY INDEX ROWID) OF 'IMS_ALCTN'
      10    9                 INDEX (RANGE SCAN) OF 'IMS_ALCTN_INDX1' (NON  -UNIQUE)
      11    5             INDEX (RANGE SCAN) OF 'IMS_ETS_CNTRL_INDX1' (NON  -UNIQUE)
    Statistics
              0  recursive calls
              0  db block gets
         244608  consistent gets
          58856  physical reads
              0  redo size
            497  bytes sent via SQL*Net to client
            499  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              2  sorts (memory)
              0  sorts (disk)
              1  rows processedHere is TKPROF output:
    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      4.85     129.72      53863     244608          0           1
    total        4      4.85     129.72      53863     244608          0           1
    Misses in library cache during parse: 1
    Optimizer goal: CHOOSE
    Parsing user id: 63 
    Rows     Row Source Operation
          1  SORT GROUP BY
      12972   VIEW 
      12972    SORT UNIQUE
      12972     TABLE ACCESS BY INDEX ROWID IMS_ETS_CNTRL
      46236      NESTED LOOPS 
      19134       NESTED LOOPS 
      19744        TABLE ACCESS BY INDEX ROWID IMS_TRDE
    176922         INDEX RANGE SCAN IMS_TRDE_INDX4 (object id 34099)
      19134        TABLE ACCESS BY INDEX ROWID IMS_ALCTN
      19134         INDEX RANGE SCAN IMS_ALCTN_INDX1 (object id 34094)
      27101       INDEX RANGE SCAN IMS_ETS_CNTRL_INDX1 (object id 34101)
    ********************************************************************************Explain plan output:
    PLAN_TABLE_OUTPUT
    | Id  | Operation                         |  Name                | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT                  |                      |       |       |       |
    |   1 |  SORT GROUP BY                    |                      |       |       |       |
    |   2 |   VIEW                            |                      |       |       |       |
    |   3 |    SORT UNIQUE                    |                      |       |       |       |
    |*  4 |     TABLE ACCESS BY INDEX ROWID   | IMS_ETS_CNTRL        |       |       |       |
    |   5 |      NESTED LOOPS                 |                      |       |       |       |
    |   6 |       NESTED LOOPS                |                      |       |       |       |
    |*  7 |        TABLE ACCESS BY INDEX ROWID| IMS_TRDE             |       |       |       |
    |*  8 |         INDEX RANGE SCAN          | IMS_TRDE_INDX4       |       |       |       |
    |   9 |        TABLE ACCESS BY INDEX ROWID| IMS_ALCTN            |       |       |       |
    |* 10 |         INDEX RANGE SCAN          | IMS_ALCTN_INDX1      |       |       |       |
    |* 11 |       INDEX RANGE SCAN            | IMS_ETS_CNTRL_INDX1  |       |       |       |
    Predicate Information (identified by operation id):
       4 - filter("IMS_ETS_CNTRL"."OUTBND_DEST"='ETD')
       7 - filter("IMS_TRDE"."GRS_TRX_TYPE"='INJECTION' OR "IMS_TRDE"."GRS_TRX_TYPE"='WITHD
                  RAWAL' OR "IMS_TRDE"."GRS_TRX_TYPE"='PAYMENT' OR "IMS_TRDE"."SSC_INVST_TY
                  PE"='FC' AND "IMS_TRDE"."SERVICE_TYPE"='FS')
       8 - access("IMS_TRDE"."IMS_TRDE_RCPT_DTTM">=TO_DATE('2009-10-29 00:00:00', 'yyyy-mm-
                  dd hh24:mi:ss') AND "IMS_TRDE"."IMS_TRDE_RCPT_DTTM"<=TO_DATE('2009-11-05
                  23:59:00', 'yyyy-mm-dd hh24:mi:ss')
      10 - access("IMS_ALCTN"."IMS_TRDE_OID"="IMS_TRDE"."IMS_TRDE_OID")
      11 - access("IMS_ETS_CNTRL"."IMS_CNTRT_OID"="IMS_ALCTN"."IMS_ALCTN_OID")
    Note: rule based optimizationCould you please help tune this sql?
    How can I reduce the elapsed time? How can I reduce query read?
    If there is any other info that you need, please let me know!
    thank you very much!

    What exactly is this logic meant to do?
    AND    (ims_trde.grs_trx_type IN ('INJECTION', 'WITHDRAWAL', 'PAYMENT')
            OR ims_trde.ssc_invst_type = 'FC'
            AND ims_trde.service_type = 'FS')is that really:
    AND    (ims_trde.grs_trx_type IN ('INJECTION', 'WITHDRAWAL', 'PAYMENT')
            OR ims_trde.ssc_invst_type = 'FC')
    AND    ims_trde.service_type = 'FS'or is it maybe:
    AND   (ims_trde.grs_trx_type IN ('INJECTION', 'WITHDRAWAL', 'PAYMENT')
           OR (ims_trde.ssc_invst_type = 'FC'
               AND ims_trde.service_type = 'FS'))?

  • Reduce the execution time of catproc.sql

    how can i reduce the time of execution of catproc.sql, I have increased the size of redo log files from 5m to 40m, but still performance hasn't improved much,
    any suggestion
    regards
    asif

    Is it still running? Almost half an hour now.
    By the time we find a solution maybe it's already done :)
    I don't think you could do much after it's already started. As long as it's not hung, it will finish sooner or later. Make sure there are no other applications runing on the server to compete CPU and diskio with oracle.

Maybe you are looking for

  • Can several users post on the same blog (SLS 10.6.2)?

    On Snow Leopard Server 10.6.2 a user (let's say user A, defined in open directory) can have it's own blog. Is there a way to allow another user (user B, defined in open directory) to post entries on user A's blog? Or can I setup a company's blog wher

  • Connecting Web and the entire OTC cycle (Part 2)

    I am a .Net programmer and at the same time SAP SD Consultant but just new  to this SAP field. I will be creating a website where the customer orders will be recorded. Based on my research in this forum, connecting a website and SAP will be possible

  • Scanning Paper Copies of White and Black Photos:  in Grey scale or in color mode?

    I started to scan old black and white paper photos of my deceased father. He shot most of these photos around 1940. The photos are typically around 9.5cm x 6.5 cm (around 3.7 x 2.5 inches), sometimes they are even smaller. Typically, 4-6 photos are g

  • Can't download driver Photosmart D110

    I am trying to download printer driver and software to my new computer which has Windows 8 but when I click download nothing happens.  I have tried this with chrome and explorer.  No response to either.  I can't find the CD that came with the printer

  • New JavaDoc lookup tool

    There is an interesting "master index" to many JavaDoc projects - it lets you drill down to individual packages and classes, so you can get to virtually JavaDoc page, anywhere really quickly. The page says it is "a comprehensive index to the JavaDoc