Select query taking Much time

Dear all ,
I am fetching data from pool table a006.  The select query is mentioned below.
select * from a005 into table i_a005 for all wntries in it_table
             where  kappl  = 'V'
             and      kschl   IN  s_kschl
             and     vkorg   in   s_vkorg
             and     vtweg  in   s_vtgew
             and     matnr   in s_matnr
             and    knumh  =  it_table-knumh .
here every fields are primary key fields except one field knumh which is comparing with table it_table. Because of these field this query is taking too much time as KNUMH is not primary key. And a005 is pool table . So , i cant create index for same. If there is alternate solutions , than please let me know..
Thank You ,
And in technical setting of table ITS Metioned as Fully buffered and size category is 0 .. But data are around 9000000. Is it issue or What ?  Can somebody tell some genual reason ? Or improvement in my select query.........
Edited by: TVC6784 on Jun 30, 2011 3:31 PM

TVC6784 wrote:
Hi Yuri ,
>
> Thanks for your reply....I will check as per your comment...
> bUT if i remove field KNUMH  From selection condition and also for all entries in it_itab ,  than data fetch very fast As KNUMH is not primary key..
> .  the example is below
>
> select * from a005 into table i_a005
> where kappl = 'V'
> and kschl IN s_kschl
> and vkorg in s_vkorg
> and vtweg in s_vtgew
> and matnr in s_matnr.
>
> Can you comment anything about it ?
>
> And can you please say how can i check its size as you mention that is  2-3 Mb More   ?
>
> Edited by: TVC6784 on Jun 30, 2011 7:37 PM
I cannot see the trace and other information about the table so I cannot judge why the select w/o KNUMH is faster.
Basically, if the table is buffered and it's contents is in the SAP application server memory, the access should be really fast. Does not really matter if it is with KNUMH or without.
I would really like to see at least ST05 trace of your report that is doing this select. This would clarify many things.
You can check the size by multiplying the entries in A005 table by 138. This is (in my test system) the ABAP width of the structure.
If you have 9.000.000 records in A005, then it would take 1,24 Gb in the buffer (which is a clear sign to unbuffer).

Similar Messages

  • Query taking much time Orace 9i

    Hi,
    **How can we tune the sql query in oracle 9i.**
    The select query taking more than 1 and 30 min to throw the result.
    Due to this,
    We have created materialsed view on the select query and also we submitted a job to get Materilazed view refreshed daily in dba_jobs.
    When we tried to retrive the data from Materilased view getting result very quickly.
    But the job which we has been assisgned in Dbajobs taking equal  time to complete, as the query use to take.
    We feel since the job taking much time in the test Database and it may cause load if we move the same scripts in Production Environment.
    Please suggest how to resolvethe issue and also how to tune the sql
    With Regards,
    Srinivas
    Edited by: Srinivas.. on Dec 17, 2009 6:29 AM

    Hi Srinivas;
    Please follow this search and see its helpful
    Regard
    Helios

  • Query taking much time.

    Hi All,
    I have one query which is taking much time in dev envi where data size is very small and planning to implement this query in production database where database size is huge. Plz let me know how I can optimize this query.
    select count(*) from
    select /*+ full(tls) full(tlo) parallel(tls,2) parallel(tls, 2) */
    tls.siebel_ba, tls.msisdn
    from
    TDB_LIBREP_SIEBEL tls, TDB_LIBREP_ONDB tlo
    where
    tls.siebel_ba = tlo.siebel_ba (+) and
    tls.msisdn = tlo.msisdn (+) and
    tlo.siebel_ba is null and
    tlo.msisdn is null
    union
    select /*+ full(tls) full(tlo) parallel(tls,2) parallel(tls, 2) */
    tlo.siebel_ba, tlo.msisdn
    from
    TDB_LIBREP_SIEBEL tls, TDB_LIBREP_ONDB tlo
    where
    tls.siebel_ba (+) = tlo.siebel_ba and
    tls.msisdn (+) = tlo.msisdn and
    tls.siebel_ba is null and
    tls.msisdn is null
    explain plan of above query is
    | Id | Operation | Name | Rows | Bytes | Cost | TQ |IN-OUT| PQ Distrib |
    | 0 | SELECT STATEMENT | | 1 | | 14 | | | |
    | 1 | SORT AGGREGATE | | 1 | | | | | |
    | 2 | SORT AGGREGATE | | 1 | | | 41,04 | P->S | QC (RAND) |
    | 3 | VIEW | | 164 | | 14 | 41,04 | PCWP | |
    | 4 | SORT UNIQUE | | 164 | 14104 | 14 | 41,04 | PCWP | |
    | 5 | UNION-ALL | | | | | 41,03 | P->P | HASH |
    |* 6 | FILTER | | | | | 41,03 | PCWC | |
    |* 7 | HASH JOIN OUTER | | | | | 41,03 | PCWP | |
    | 8 | TABLE ACCESS FULL| TDB_LIBREP_SIEBEL | 82 | 3526 | 1 | 41,03 | PCWP | |
    | 9 | TABLE ACCESS FULL| TDB_LIBREP_ONDB | 82 | 3526 | 2 | 41,00 | S->P | BROADCAST |
    |* 10 | FILTER | | | | | 41,03 | PCWC | |
    |* 11 | HASH JOIN OUTER | | | | | 41,03 | PCWP | |
    | 12 | TABLE ACCESS FULL| TDB_LIBREP_ONDB | 82 | 3526 | 2 | 41,01 | S->P | HASH |
    | 13 | TABLE ACCESS FULL| TDB_LIBREP_SIEBEL | 82 | 3526 | 1 | 41,02 | P->P | HASH |
    Predicate Information (identified by operation id):
    6 - filter("TLO"."SIEBEL_BA" IS NULL AND "TLO"."MSISDN" IS NULL)
    7 - access("TLS"."SIEBEL_BA"="TLO"."SIEBEL_BA"(+) AND "TLS"."MSISDN"="TLO"."MSISDN"(+))
    10 - filter("TLS"."SIEBEL_BA" IS NULL AND "TLS"."MSISDN" IS NULL)
    11 - access("TLS"."SIEBEL_BA"(+)="TLO"."SIEBEL_BA" AND "TLS"."MSISDN"(+)="TLO"."MSISDN")

    user3479748 wrote:
    Hi All,
    I have one query which is taking much time in dev envi where data size is very small and planning to implement this query in production database where database size is huge. Plz let me know how I can optimize this query.
    select count(*) from
    select /*+ full(tls) full(tlo) parallel(tls,2) parallel(tls, 2) */
    tls.siebel_ba, tls.msisdn
    from
    TDB_LIBREP_SIEBEL tls, TDB_LIBREP_ONDB tlo
    where
    tls.siebel_ba = tlo.siebel_ba (+) and
    tls.msisdn = tlo.msisdn (+) and
    tlo.siebel_ba is null and
    tlo.msisdn is null
    union
    select /*+ full(tls) full(tlo) parallel(tls,2) parallel(tls, 2) */
    tlo.siebel_ba, tlo.msisdn
    from
    TDB_LIBREP_SIEBEL tls, TDB_LIBREP_ONDB tlo
    where
    tls.siebel_ba (+) = tlo.siebel_ba and
    tls.msisdn (+) = tlo.msisdn and
    tls.siebel_ba is null and
    tls.msisdn is null
    ) ;explain plan of above query is
    | Id  | Operation                |  Name              | Rows  | Bytes | Cost  |  TQ    |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT         |                    |     1 |       |    14 |        |      |            |
    |   1 |  SORT AGGREGATE          |                    |     1 |       |       |        |      |            |
    |   2 |   SORT AGGREGATE         |                    |     1 |       |       | 41,04  | P->S | QC (RAND)  |
    |   3 |    VIEW                  |                    |   164 |       |    14 | 41,04  | PCWP |            |
    |   4 |     SORT UNIQUE          |                    |   164 | 14104 |    14 | 41,04  | PCWP |            |
    |   5 |      UNION-ALL           |                    |       |       |       | 41,03  | P->P | HASH       |
    |*  6 |       FILTER             |                    |       |       |       | 41,03  | PCWC |            |
    |*  7 |        HASH JOIN OUTER   |                    |       |       |       | 41,03  | PCWP |            |
    |   8 |         TABLE ACCESS FULL| TDB_LIBREP_SIEBEL  |    82 |  3526 |     1 | 41,03  | PCWP |            |
    |   9 |         TABLE ACCESS FULL| TDB_LIBREP_ONDB    |    82 |  3526 |     2 | 41,00  | S->P | BROADCAST  |
    |* 10 |       FILTER             |                    |       |       |       | 41,03  | PCWC |            |
    |* 11 |        HASH JOIN OUTER   |                    |       |       |       | 41,03  | PCWP |            |
    |  12 |         TABLE ACCESS FULL| TDB_LIBREP_ONDB    |    82 |  3526 |     2 | 41,01  | S->P | HASH       |
    |  13 |         TABLE ACCESS FULL| TDB_LIBREP_SIEBEL  |    82 |  3526 |     1 | 41,02  | P->P | HASH       |
    Predicate Information (identified by operation id):
    6 - filter("TLO"."SIEBEL_BA" IS NULL AND "TLO"."MSISDN" IS NULL)
    7 - access("TLS"."SIEBEL_BA"="TLO"."SIEBEL_BA"(+) AND "TLS"."MSISDN"="TLO"."MSISDN"(+))
    10 - filter("TLS"."SIEBEL_BA" IS NULL AND "TLS"."MSISDN" IS NULL)
    11 - access("TLS"."SIEBEL_BA"(+)="TLO"."SIEBEL_BA" AND "TLS"."MSISDN"(+)="TLO"."MSISDN")
    I dunno, it looks like you are getting all the things that are null with an outer join, so won't that decide to full scan anyways? Plus the union means it will do it twice and do a distinct to get rid of dups - see how it does a union all and then sort unique. Somehow I have the feeling there might be a more trick way to do what you want, so maybe you should state exactly what you want in English.

  • Select query taking more time..

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

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

  • Select Query taking long time to run second time

    Hi All,
    I have Oracle 11gR1 in windows server 2008 R2 .
    I have some tables with 10 million records . When i run the select query for those tables first time it gives me result in 15 seconds but if i am running the same script second time from the same session I am getting the result in 15 minutes to complete ..
    Why it is happening? What may be the solution for this ?
    Thanks & Regards,
    Vikash jain(Junior DBA)

    Hi Mohamed,
    I just saw that both the times for the same query execution plan is different ..
    here are the details :
    First time Second Time
    g84m3qqjv2p3q g84m3qqjv2p3q
    2733045235 1310485984
    So plz tell me how should i force database to use the first execution plan ?
    I got this script for forcing the Db to use the same execution plan
    accept sql_id -
    prompt 'Enter value for sql_id: ' -
    default 'X0X0X0X0'
    accept plan_hash_value -
    prompt 'Enter value for plan_hash_value: ' -
    default 'X0X0X0X0'
    accept fixed -
    prompt 'Enter value for fixed (NO): ' -
    default 'NO'
    accept enabled -
    prompt 'Enter value for enabled (YES): ' -
    default 'YES'
    accept plan_name -
    prompt 'Enter value for plan_name (ID_sqlid_planhashvalue): ' -
    default 'X0X0X0X0'
    set feedback off
    set sqlblanklines on
    set serveroutput on
    declare
    l_plan_name varchar2(40);
    l_old_plan_name varchar2(40);
    l_sql_handle varchar2(40);
    ret binary_integer;
    l_sql_id varchar2(13);
    l_plan_hash_value number;
    l_fixed varchar2(3);
    l_enabled varchar2(3);
    major_release varchar2(3);
    minor_release varchar2(3);
    begin
    select regexp_replace(version,'\..*'), regexp_substr(version,'[0-9]+',1,2) into major_release, minor_release from v$instance;
    minor_release := 2;
    l_sql_id := '&&sql_id';
    l_plan_hash_value := to_number('&&plan_hash_value');
    l_fixed := '&&fixed';
    l_enabled := '&&enabled';
    ret := dbms_spm.load_plans_from_cursor_cache(
    sql_id=>l_sql_id,
    plan_hash_value=>l_plan_hash_value,
    fixed=>l_fixed,
    enabled=>l_enabled);
    if minor_release = '1' then
    -- 11gR1 has a bug that prevents renaming Baselines
    dbms_output.put_line(' ');
    dbms_output.put_line('Baseline created.');
    dbms_output.put_line(' ');
    else
    -- This statements looks for Baselines create in the last 4 seconds
    select sql_handle, plan_name,
    decode('&&plan_name','X0X0X0X0','SQLID_'||'&&sql_id'||'_'||'&&plan_hash_value','&&plan_name')
    into l_sql_handle, l_old_plan_name, l_plan_name
    from dba_sql_plan_baselines spb
    where created > sysdate-(1/24/60/15);
    ret := dbms_spm.alter_sql_plan_baseline(
    sql_handle=>l_sql_handle,
    plan_name=>l_old_plan_name,
    attribute_name=>'PLAN_NAME',
    attribute_value=>l_plan_name);
    dbms_output.put_line(' ');
    dbms_output.put_line('Baseline '||upper(l_plan_name)||' created.');
    dbms_output.put_line(' ');
    end if;
    end;
    undef sql_id
    undef plan_hash_value
    undef plan_name
    undef fixed
    set feedback on
    Output:
    Enter value for sql_id: g84m3qqjv2p3q
    Enter value for plan_hash_value: 2733045235
    Enter value for fixed (NO):
    Enter value for enabled (YES):
    Enter value for plan_name (ID_sqlid_planhashvalue): g84m3qqjv2p3q
    old 16: l_sql_id := '&&sql_id';
    new 16: l_sql_id := 'g84m3qqjv2p3q';
    old 17: l_plan_hash_value := to_number('&&plan_hash_value');
    new 17: l_plan_hash_value := to_number('2733045235');
    old 18: l_fixed := '&&fixed';
    new 18: l_fixed := 'NO';
    old 19: l_enabled := '&&enabled';
    new 19: l_enabled := 'YES';
    old 40: decode('&&plan_name','X0X0X0X0','SQLID_'||'&&sql_id'||'_'||'&&plan_hash_value','&&plan_name')
    new 40: decode('g84m3qqjv2p3q','X0X0X0X0','SQLID_'||'g84m3qqjv2p3q'||'_'||'2733045235','g84m3qqjv2p3q')
    declare
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at line 39
    Kindly help me to resolve the issue ..
    Thanks & Regards,
    Vikash Jain(Junior DBA)

  • ABAP QUERY taking much time after ERP Upgrade from 4.6 to 6.0

    Hi All,
    I have an ABAP QUERY which uses the INFOSET INVOICE_INBOUND and the USER GROUP InvoiceVerif. The INFOSET is using the tables RBKP and RSEG connected using a JOIN on BELNR and GJAHR fields.
    The query was working fine in 4.6 C Version.  Now the system has been upgraded to 6.0 version.
    Now it takes so much time that the processing is not getting completed. Do we have to make any changes to the existing queries for an upgrade?
    Thanks a lot in advance.
    Gautham.

    Did u regenrated the query & Infoset & Program  before transporting it to ECC6.0?

  • SELECT query taking long time

    Hi All,
    I am trying to run one SELECT statement which uses 6 tables. That query generally take 25-30 minutes to generate output.
    Today it is running from more than 2 hours. I have checked there are no locks on those tables and no other process is using them.
    What else I should check in order to figure out why my SELECT statement is taking time?
    Any help will be much appreciated.
    Thanks!

    Please let me know if you still want me to provide all the information mentioned in the link.Yes, please.
    Before you can even start optimizing, it should be clear what parts of the query are running slow.
    The links contains the steps to take regarding how to identify the things that make the query run slow.
    Ideally you post a trace/tkprof report with wait events, it'll show on what time is being spent, give an execution plan and a database version all in once...
    Today it is running from more than 2 hours. I have checked there are no locks on those tables and no other process is using them.Well, something must have changed.
    And you must indentify what exactly has changed, but it's a broad range you have to check:
    - it could be outdated table statistics
    - it could be data growth or skewness that makes Optimizer choose a wrong plan all of a sudden
    - it could be a table that got modified with some bad index
    - it could be ...
    So, by posting the information in the link, you'll leave less room for guesses from us, so you'll get an explanation that makes sense faster or, while investigating by following the steps in the link, you'll get the explanation yourself.

  • Query taking much time to execute

    The following query is taking more than 4hrs to execute.
    select  l_extendedprice , count(l_extendedprice) from dbo.lineitem group by  l_extendedprice
    Cardinality of table : 6001215 ( > 6 million)
    Index on l_extendedprice is there
    ReadAheadLobThreshold = 500
    Database version 7.7.06.09
    I need to optimize this query. Kindly suggest way out.
    Thanks
    Priyank

    Data Cache :      80296 KB
    Ok, that's 8 Gigs for cache.
    The index takes 16335 pages à 8 KB = 130.680 KB = 128 MB.
    Fits completely into RAM - the same is true for the additional temp resultset.
    So once the index has been read to cache I assume the query is a lot quicker than 4 hours.
    6 Data Volumes
    first 3 of size 51.200 KB
    other 3 of size  1,048,576 KB
    Well, that's not the smartest thing to do.
    That way the larger volumes will get double the I/O requests which eventually saturates the I/O channel.
    Yes looking at the cardinality of the table lots of I/O required but still more than 4 hrs is quite unrealistic. Some tuning is required.
    We're not talking about the cardinality here - you want all the data.
    We talk pages then.
    And as we've seen, the table is not touched for this query.
    Instead the smaller index is completely read in a index only strategy.
    Loading 128MB from disk, creating temporary data in the same size and spilling out the information (and thereby reading the 128 MB temp size again) in 4 hours add up to ca. 384 MB/4 hours = 96 MB/hour = 1,6 MB/minute.
    Not too good really - I suspect that the I/O system here is not the quickest one.
    You may want to activate the time measurement and set the DB Analyzer interval to 120 secs.
    Then activate Command and Resourcemonitor and look for statements taking longer than 10 minutes.
    Now run your statement again and let us know the information from Command/Resourcemonitor and check for warnings in the DBanalyzer output.
    regards,
    Lars

  • Select query taking long time (more then 6 min)

    Dear experts,
    DATA:IT_CHEQ2 TYPE TABLE OF TY_BSAS,
         WA_CHEQ2 LIKE LINE OF IT_CHEQ2.
    DATA : IT_CHEQ3 TYPE STANDARD TABLE OF TY_BSAS WITH HEADER LINE.
    TYPES:BEGIN OF TY_BSAS,
           BUKRS TYPE BSAS-BUKRS,
           HKONT TYPE BSAS-HKONT,
           AUGDT TYPE BSAS-AUGDT,
           AUGBL TYPE BSAK-AUGBL,
           ZUONR TYPE BSAK-ZUONR,
           GJAHR TYPE BSAK-GJAHR,
           BELNR TYPE BSAK-BELNR,
           BUZEI TYPE BSAK-BUZEI,
           BUDAT TYPE BSAK-BUDAT,
           XBLNR TYPE BSAK-XBLNR,
           BLART TYPE BSAK-BLART,
           SHKZG TYPE BSAK-SHKZG,
           DMBTR TYPE BSAK-DMBTR,
           WMWST TYPE BSAK-WMWST,
          AUGGJ TYPE BSAK-AUGGJ, " CLEARING FYSICAL YEAR
           OT_TAX TYPE BSAK-DMBTR,
           TDS   TYPE BSAK-DMBTR,
           VAT    TYPE BSAK-DMBTR, "Vat amount
           WCT   TYPE BSAK-DMBTR,
           ADV    TYPE BSAK-DMBTR,  "Advance
           CHAMT TYPE BSAK-DMBTR,
           CHNO  TYPE PAYR-CHECT,
           CHDATE TYPE PAYR-ZALDT,
           DBIT_NOTE TYPE BSAK-DMBTR,
           PAY_ADJ   TYPE BSAK-DMBTR,
           PEND_SES TYPE BSAK-DMBTR, "PENDING SES
           CR_PARTY(50)  TYPE C,
          END OF TY_BSAS.
    SELECT BUKRS HKONT AUGDT AUGBL ZUONR GJAHR BELNR BUZEI BUDAT XBLNR BLART SHKZG
                      DMBTR WMWST
                      FROM BSAS INTO " APPENDING
               CORRESPONDING FIELDS OF TABLE IT_CHEQ3
                      FOR ALL ENTRIES IN IT_CHEQ2
                      WHERE AUGBL = IT_CHEQ2-AUGBL and
                        BUKRS = IT_CHEQ2-BUKRS   AND
    *                  AUGBL = IT_CHEQ2-AUGBL
                          GJAHR = IT_CHEQ2-GJAHR
                      AND  XBLNR = IT_CHEQ2-XBLNR.
    line company code  hkont       augdt               augbl               zuonr              gjahr        belnr                 buzei  budat
    1     1018     0012100030     20110831     2100009710     20110831     2011     2100009710     005     20110831
    xblnr       blart        shkzg
    RA03     KZ         H            37067.00         0.00     2011     0.00     0.00
    2     1018     0012100030     20110831     2100009710     20110831     2011     2100009710     006     20110831
         RA03     KZ     H     393850.00     0.00     2011     0.00     0.00
    3     1018     0012100030     20110831     2100009710     20110831     2011     2100009710     004     20110831     RA03     KZ     S     723589.13     0.00     2011     0.00     0.00
    4     1018     0012100030     20110831     2100009710     20110823     2011     3900001250     001     20110823     RA03     RS     H     712921.13     0.00     2011     0.00     0.00
    5     1018     0023200000     20110831     2100009710     20110831     2011     2100009710     008     20110831     RA03     KZ     H     21788.00     0.00     2011     0.00     0.00
    6     1018     0023200000     20110831     2100009710     20110831     2011     2100009710     007     20110831     RA03     KZ     H     1162821.00     0.00     2011     0.00     0.00
    if i put same entry in se11 for bsas it takes 7 second
    and in query takes  more then 6 min ,kindly tell why
    help me gurus
    regards
    victor

    Tested point 2.
    There is no difference.
    REPORT  Z_YZ_SELECT_ORDER.
    types: begin of t_orderadm,
             description type CRMT_PROCESS_DESCRIPTION,
             created_at type COMT_CREATED_AT_USR,
             LOGICAL_SYSTEM type CRMT_LOGSYS,
             TEMPLATE_TYPE type CRMT_TEMPLATE_TYPE_DB,
             VERIFY_DATE type CRMT_VERIFY_DATE,
             GUID type CRMT_OBJECT_GUID,
           end of t_orderadm.
    types: begin of t_orderadm_1,
             GUID type CRMT_OBJECT_GUID,
             description type CRMT_PROCESS_DESCRIPTION,
             LOGICAL_SYSTEM type CRMT_LOGSYS,
             TEMPLATE_TYPE type CRMT_TEMPLATE_TYPE_DB,
             created_at type COMT_CREATED_AT_USR,
             VERIFY_DATE type CRMT_VERIFY_DATE,
           end of t_orderadm_1.
    data: lt_orders type table of t_orderadm,
          lt_orders_1 type table of t_orderadm_1.
    select description created_at logical_system template_type verify_date guid
      into table lt_orders
      from crmd_orderadm_h.
    select guid description logical_system template_type created_at verify_date
      into table lt_orders_1
      from crmd_orderadm_h.
    write 'done'.
    First select - mixed order of fields. Response time: 82.155 microseconds for 39380 records selected.
    Second select - fields in the order of the table. Response time: 81.061 microseconds for the same 39380 records selected.
    Then I changed the order of SELECT statements. I have put first the select with ordered fields, and second - select with mixed order of fields. The runtimes were the following:
    Ordered fields - 82.649 microseconds
    Mixed order of fields - 80.270 microseconds.
    So I'm going to change the Wiki page in order to avoid  in future advices that make no sense.

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

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

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

  • Request for the reasons of Query taking much time

    Hi,
    I have one SQL query.When i execute that query from TOAD it is taking some 120 sec,but the same query when i execute from Forms(Front End) it is taking nearly 5 mints.I don't understand where the problem is.Can any one please help me on this with the resons & solutions(Steps to the overcome).
    Regards,
    Rao.

    Can you do an explain plan of the query in Toad?
    And a sql_trace of the form when it executes the query?
    If you have dba-rights you can enable sql-trace in the forms session by using:
    dbms_system.set_sql_trace_in_session(..sid.., ..serial#.., true);where sid and serial# are the values of the forms session (can be found in v$session).
    Toon

  • Request for query taking much time

    Hi,
    I have one SQL query.When i execute that query from TOAD it is taking some 120 sec,but the same query when i execute from Forms(Front End) it is taking nearly 5 mints.I don't understand where the problem is.Can any one please help me on this with the resons & solutions(Steps to the overcome).
    Regards,
    Rao.

    Hi,
    There are many factors involved in this.
    user11312630 wrote:
    Hi,
    I have one SQL query.When i execute that query from TOAD it is taking some 120 sec,but the same query when i execute from Forms(Front End) it is taking nearly 5 mints.I don't understand where the problem is.Can any one please help me on this with the resons & solutions(Steps to the overcome).Because, Toad is directly contacting the database, but, for forms, the request goes to the server, server sends the query to database, gets the rows, pass back the response to the client.
    >
    Regards,
    Rao.So, the factors like, network latency etc., will also play a part in the performance.
    Take at a look at the performance tuning guides.
    http://www.oracle.com/technology/products/forms/pdf/275191.pdf
    http://download.oracle.com/docs/cd/B25527_01/doc/frs/forms/B14032_02/tuning.htm
    -Arun

  • LOV is slow after selecting a value its taking much time to default

    Hi,
    I have a dependent LOV. Master LOV is executing fine and its populatin into the field fastly. But Child LOV is very slow after selecting a value its taking much time to default.
    Can any one please help me if there is any way to default the value fast after selecting a value?
    Thanks,
    Mahesh

    Hi Gyan,
    Same issues in TST and PROD instances.
    In my search criteria if i get 1 record, even after selecting that value its taking much time to default that value into the field.
    Please advice. Thanks for your quick resp.
    Thanks,
    Mahesh

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

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

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

  • Discoverer report is taking much time to open

    Hi
    All the discoverer report are taking much time to open,even query in lov is taking 20 -25 min.s.We have restart the services but on result found.
    Please suggest what can be done ,my application is on 12.0.6.
    Regards

    This topic was discussed many times in the forum before, please see old threads for details and for the docs you need to refer to -- https://forums.oracle.com/forums/search.jspa?threadID=&q=Discoverer+AND+Slow&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

Maybe you are looking for

  • How are some guys running an Athlon 3800+ X2 chip on the K8N Neo4 Platinum SLI?

    I see many people running an AMD Athlon 64 3800+ X2 Dual Core proccessor on a K8N Neo4 Platinum SLI board, but mine dosen't work.  I don't get any signal to my monitor (don't know if this is the cause).  MSI says the 3800+X2 dosen't support the SLI b

  • Trying to delete shopping cart via GUI (not web) tran BBP_MON_SC

    In the GUI I'm entering "/n" to get out of the Easy Access menu and then running tran BBP_MON_SC.  I'm then entering a specific shopping cart number and clicking the Start button.  On the results screen if I just click the "Delete Shopping Cart" butt

  • Adobe 9 Pro purchased as download. How do I reinstall after deletions?

    My Adobe 9 Pro started giving me an error message that I could not continue unless I uninstalled my software and reinstalled it. I uninstalled, thinking the program which was downloaded and purchased, would remain in the Adobe folder. IT DID NOT. How

  • Latest episode of Podcast still not appearing in iTunes, after a 10 day wait

    Hi folks, So far four episodes from my feedburner feed have sucessfuly been published to itunes. But the fifth episode, published on the 24th of August has not appeared in iTunes. The feed is this:- http://3dartdirect.com/feed/podcast/ The Feed valid

  • Parked doc in New GL

    Hi all of you, Is there any possibility to add the parked documents in New GL reporting vide no. "S_PL0_86000030 - GL Account balances New", as we are uploading the legacy transaction data using Segment and profit center reporting, for which the data