About select data performance

hi experts:
   about performance when select data from table
    if i use index to slect data,it can run fast,but costomer tell me can't use index,
for exmple: internel table itab_01[] has 2000 data, ztable has 1,000,000 data
then  select vbeln from ztable into table itab_02
for all entriesin itab_01
where vbeln = itab_01-vbeln.
it runs very slowly....
i try to use select vbeln from ztable into table itab_02.then use loop read ...
it runs ok. can i use this method?
does it increase memory???
chen xinrong

Hi,
You can see a report performance in SE30(Runtime analysis)and
SQLtrace(ST05).
ST05 tells you the list of selected statements.
You should remember some points when you tuning the code
- Use the GET RUN TIME command to help evaluate performance. It's
hard to know whether that optimization technique REALLY helps unless you
test it out. Using this tool can help you know what is effective, under what
kinds of conditions. The GET RUN TIME has problems under multiple CPUs, so
you should use it to test small pieces of your program, rather than the
whole program.
- *Generally, try to reduce I/O first, then memory, then CPU activity.
*I/O operations that read/write to hard disk are always the most
expensive operations. Memory, if not controlled, may have to be written to
swap space on the hard disk, which therefore increases your I/O read/writes
to disk. CPU activity can be reduced by careful program design, and by using
commands such as SUM (SQL) and COLLECT (ABAP/4).
- Avoid 'SELECT *', especially in tables that have a lot of fields.
Use SELECT A B C INTO instead, so that fields are only read if they are
used. This can make a very big difference.
- Field-groups can be useful for multi-level sorting and displaying.
However, they write their data to the system's paging space, rather than to
memory (internal tables use memory). For this reason, field-groups are only
appropriate for processing large lists (e.g. over 50,000 records). If
you have large lists, you should work with the systems administrator to
decide the maximum amount of RAM your program should use, and from that,
calculate how much space your lists will use. Then you can decide whether to
write the data to memory or swap space.
- Use as many table keys as possible in the WHERE part of your select
statements.
- Whenever possible, design the program to access a relatively
constant number of records (for instance, if you only access the
transactions for one month, then there probably will be a reasonable range,
like 1200-1800, for the number of transactions inputted within that month).
Then use a SELECT A B C INTO TABLE ITAB statement.
- Get a good idea of how many records you will be accessing. Log into
your productive system, and use SE80 -> Dictionary Objects (press Edit),
enter the table name you want to see, and press Display. Go To Utilities ->
Table Contents to query the table contents and see the number of records.
This is extremely useful in optimizing a program's memory allocation.
- Try to make the user interface such that the program gradually
unfolds more information to the user, rather than giving a huge list of
information all at once to the user.
- Declare your internal tables using OCCURS NUM_RECS, where NUM_RECS
is the number of records you expect to be accessing. If the number of
records exceeds NUM_RECS, the data will be kept in swap space (not memory).
- Use SELECT A B C INTO TABLE ITAB whenever possible. This will read
all of the records into the itab in one operation, rather than repeated
operations that result from a SELECT A B C INTO ITAB... ENDSELECT statement.
Make sure that ITAB is declared with OCCURS NUM_RECS, where NUM_RECS is the
number of records you expect to access.
- If the number of records you are reading is constantly growing, you
may be able to break it into chunks of relatively constant size. For
instance, if you have to read all records from 1991 to present, you can
break it into quarters, and read all records one quarter at a time. This
will reduce I/O operations. Test extensively with GET RUN TIME when using
this method.
- Know how to use the 'collect' command. It can be very efficient.
- Use the SELECT SINGLE command whenever possible.
- Many tables contain totals fields (such as monthly expense totals).
Use these avoid wasting resources by calculatin
Rgds,
P.Naganjana Reddy

Similar Messages

  • Selective data load and transformations

    Hi,
    Can youu2019ll pls clarify me this
    1.Selective data load and transformations can be done in
        A.     Data package
        B.     Source system
        C.     Routine
        D.     Transformation Library-formulas
        E.     BI7 rule details
        F.     Anywhere else?
    If above is correct what is the order in performance wise
    2.Can anyone tell me why not all the fields are not appear in the data package data selection tab even though many include in datasource and data target.
    Tks in advance
    Suneth

    Hi Wijey,
    1.If you are talking about selective data load, you need to write a ABAP Program in the infopackage for the field for which you want to select. Otherway is to write a start routine in the transformations and delete all the records which you do not want. In the second method, you get all the data but delete unwanted data so that you process only the required data. Performancewise, you need to observe. If the selection logic is complicated and taks a lot of time, the second option is better.You try both and decide yourself as to which is better.
    2. Only the fields that are marked as available for selection in the DS are available as selection in the data package. That is how the system is.
    Thanks and Regards
    Subray Hegde

  • SELECT query performance : One big table Vs many small tables

    Hello,
    We are using BDB 11g with SQLITE support. I have a query about 'select' query performance when we have one huge table vs. multiple small tables.
    Basically in our application, we need to run select query multiple times and today we have one huge table. Do you guys think breaking them into
    multiple small tables will help ?
    For test purposes we tried creating multiple tables but performance of 'select' query was more or less same. Would that be because all tables will map to only one database in backed with key/value pair and when we run lookup (select query) on small table or big table it wont make difference ?
    Thanks.

    Hello,
    There is some information on this topic in the FAQ at:
    http://www.oracle.com/technology/products/berkeley-db/faq/db_faq.html#9-63
    If this does not address your question, please just let me know.
    Thanks,
    Sandra

  • VL01 selection date

    Hi,
    I have a question about T-code VL01N....In VL01N, default value for selection date is currently the date of "Today".
    I'd like it to be 2months behind at least.
    Does anyone know about this?
    Thank you so much about your help in advance.

    Thanks for the reply, Mana..
    As you said, users can change the selection date manually...
    But the only things to be controlled for creating shipping document for our business are shipping points and sales order #.
    So i'd like to extend the selection date as further as possible so that users don't have to worry about selection date...
    If you know how to set up IMG regarding this, pleases let me know...
    Thanks in advance.

  • Performance issue in selecting data from a view because of not in condition

    Hi experts,
    I have a requirement to select data in a view which is not available in a fact with certain join conditions. but the fact table contains 2 crore rows of data. so this view is not working at all. it is running for long time. im pasting query here. please help me to tune it. whole query except prior to not in is executing in 15 minutes. but when i add not in condition it is running for so many hours as the second table has millions of records.
    CREATE OR REPLACE FORCE VIEW EDWOWN.MEDW_V_GIEA_SERVICE_LEVEL11
       SYS_ENT_ID,
       SERVICE_LEVEL_NO,
       CUSTOMER_NO,
       BILL_TO_LOCATION,
       PART_NO,
       SRCE_SYS_ID,
       BUS_AREA_ID,
       CONTRACT,
       WAREHOUSE,
       ORDER_NO,
       LINE_NO,
       REL_NO,
       REVISED_DUE_DATE,
       REVISED_QTY_DUE,
       QTY_RESERVED,
       QTY_PICKED,
       QTY_SHIPPED,
       ABBREVIATION,
       ACCT_WEEK,
       ACCT_MONTH,
       ACCT_YEAR,
       UPDATED_FLAG,
       CREATE_DATE,
       RECORD_DATE,
       BASE_WAREHOUSE,
       EARLIEST_SHIP_DATE,
       LATEST_SHIP_DATE,
       SERVICE_DATE,
       SHIP_PCT,
       ALLOC_PCT,
       WHSE_PCT,
       ABC_CLASS,
       LOCATION_ID,
       RELEASE_COMP,
       WAREHOUSE_DESC,
       MAKE_TO_FLAG,
       SOURCE_CREATE_DATE,
       SOURCE_UPDATE_DATE,
       SOURCE_CREATED_BY,
       SOURCE_UPDATED_BY,
       ENTITY_CODE,
       RECORD_ID,
       SRC_SYS_ENT_ID,
       BSS_HIERARCHY_KEY,
       SERVICE_LVL_FLAG
    AS
       SELECT SL.SYS_ENT_ID,
                 SL.ENTITY_CODE
              || '-'
              || SL.order_no
              || '-'
              || SL.LINE_NO
              || '-'
              || SL.REL_NO
                 SERVICE_LEVEL_NO,
              SL.CUSTOMER_NO,
              SL.BILL_TO_LOCATION,
              SL.PART_NO,
              SL.SRCE_SYS_ID,
              SL.BUS_AREA_ID,
              SL.CONTRACT,
              SL.WAREHOUSE,
              SL.ORDER_NO,
              SL.LINE_NO,
              SL.REL_NO,
              SL.REVISED_DUE_DATE,
              SL.REVISED_QTY_DUE,
              NULL QTY_RESERVED,
              NULL QTY_PICKED,
              SL.QTY_SHIPPED,
              SL.ABBREVIATION,
              NULL ACCT_WEEK,
              NULL ACCT_MONTH,
              NULL ACCT_YEAR,
              NULL UPDATED_FLAG,
              SL.CREATE_DATE,
              SL.RECORD_DATE,
              SL.BASE_WAREHOUSE,
              SL.EARLIEST_SHIP_DATE,
              SL.LATEST_SHIP_DATE,
              SL.SERVICE_DATE,
              SL.SHIP_PCT,
              0 ALLOC_PCT,
              0 WHSE_PCT,
              SL.ABC_CLASS,
              SL.LOCATION_ID,
              NULL RELEASE_COMP,
              SL.WAREHOUSE_DESC,
              SL.MAKE_TO_FLAG,
              SL.source_create_date,
              SL.source_update_date,
              SL.source_created_by,
              SL.source_updated_by,
              SL.ENTITY_CODE,
              SL.RECORD_ID,
              SL.SRC_SYS_ENT_ID,
              SL.BSS_HIERARCHY_KEY,
              'Y' SERVICE_LVL_FLAG
         FROM (  SELECT SL_INT.SYS_ENT_ID,
                        SL_INT.CUSTOMER_NO,
                        SL_INT.BILL_TO_LOCATION,
                        SL_INT.PART_NO,
                        SL_INT.SRCE_SYS_ID,
                        SL_INT.BUS_AREA_ID,
                        SL_INT.CONTRACT,
                        SL_INT.WAREHOUSE,
                        SL_INT.ORDER_NO,
                        SL_INT.LINE_NO,
                        MAX (SL_INT.REL_NO) REL_NO,
                        SL_INT.REVISED_DUE_DATE,
                        SUM (SL_INT.REVISED_QTY_DUE) REVISED_QTY_DUE,
                        SUM (SL_INT.QTY_SHIPPED) QTY_SHIPPED,
                        SL_INT.ABBREVIATION,
                        MAX (SL_INT.CREATE_DATE) CREATE_DATE,
                        MAX (SL_INT.RECORD_DATE) RECORD_DATE,
                        SL_INT.BASE_WAREHOUSE,
                        MAX (SL_INT.LAST_SHIPMENT_DATE) LAST_SHIPMENT_DATE,
                        MAX (SL_INT.EARLIEST_SHIP_DATE) EARLIEST_SHIP_DATE,
                        MAX (SL_INT.LATEST_SHIP_DATE) LATEST_SHIP_DATE,
                        MAX (
                           CASE
                              WHEN TRUNC (SL_INT.LAST_SHIPMENT_DATE) <=
                                      TRUNC (SL_INT.LATEST_SHIP_DATE)
                              THEN
                                 TRUNC (SL_INT.LAST_SHIPMENT_DATE)
                              ELSE
                                 TRUNC (SL_INT.LATEST_SHIP_DATE)
                           END)
                           SERVICE_DATE,
                        MIN (
                           CASE
                              WHEN TRUNC (SL_INT.LAST_SHIPMENT_DATE) >=
                                      TRUNC (SL_INT.EARLIEST_SHIP_DATE)
                                   AND TRUNC (SL_INT.LAST_SHIPMENT_DATE) <=
                                          TRUNC (SL_INT.LATEST_SHIP_DATE)
                                   AND SL_INT.QTY_SHIPPED = SL_INT.REVISED_QTY_DUE
                              THEN
                                 100
                              ELSE
                                 0
                           END)
                           SHIP_PCT,
                        SL_INT.ABC_CLASS,
                        SL_INT.LOCATION_ID,
                        SL_INT.WAREHOUSE_DESC,
                        SL_INT.MAKE_TO_FLAG,
                        MAX (SL_INT.source_create_date) source_create_date,
                        MAX (SL_INT.source_update_date) source_update_date,
                        SL_INT.source_created_by,
                        SL_INT.source_updated_by,
                        SL_INT.ENTITY_CODE,
                        SL_INT.RECORD_ID,
                        SL_INT.SRC_SYS_ENT_ID,
                        SL_INT.BSS_HIERARCHY_KEY
                   FROM (SELECT SL_UNADJ.*,
                                DECODE (
                                   TRIM (TIMA.DAY_DESC),
                                   'saturday',   SL_UNADJ.REVISED_DUE_DATE
                                               - 1
                                               - early_ship_days,
                                   'sunday',   SL_UNADJ.REVISED_DUE_DATE
                                             - 2
                                             - early_ship_days,
                                   SL_UNADJ.REVISED_DUE_DATE - early_ship_days)
                                   EARLIEST_SHIP_DATE,
                                DECODE (
                                   TRIM (TIMB.DAY_DESC),
                                   'saturday',   SL_UNADJ.REVISED_DUE_DATE
                                               + 2
                                               + LATE_SHIP_DAYS,
                                   'sunday',   SL_UNADJ.REVISED_DUE_DATE
                                             + 1
                                             + LATE_SHIP_DAYS,
                                   SL_UNADJ.REVISED_DUE_DATE + LATE_SHIP_DAYS)
                                   LATEST_SHIP_DATE
                           FROM (SELECT NVL (s2.sys_ent_id, '00') SYS_ENT_ID,
                                        cust.customer_no CUSTOMER_NO,
                                        cust.bill_to_loc BILL_TO_LOCATION,
                                        cust.early_ship_days,
                                        CUST.LATE_SHIP_DAYS,
                                        ord.PART_NO,
                                        ord.SRCE_SYS_ID,
                                        ord.BUS_AREA_ID,
                                        ord.BUS_AREA_ID CONTRACT,
                                        NVL (WAREHOUSE, ord.entity_code) WAREHOUSE,
                                        ORDER_NO,
                                        ORDER_LINE_NO LINE_NO,
                                        ORDER_REL_NO REL_NO,
                                        TRUNC (REVISED_DUE_DATE) REVISED_DUE_DATE,
                                        REVISED_ORDER_QTY REVISED_QTY_DUE,
                                        --   NULL QTY_RESERVED,
                                        --    NULL QTY_PICKED,
                                        SHIPPED_QTY QTY_SHIPPED,
                                        sold_to_abbreviation ABBREVIATION,
                                        --        NULL ACCT_WEEK,
                                        --      NULL ACCT_MONTH,
                                        --    NULL ACCT_YEAR,
                                        --  NULL UPDATED_FLAG,
                                        ord.CREATE_DATE CREATE_DATE,
                                        ord.CREATE_DATE RECORD_DATE,
                                        NVL (WAREHOUSE, ord.entity_code)
                                           BASE_WAREHOUSE,
                                        LAST_SHIPMENT_DATE,
                                        TRUNC (REVISED_DUE_DATE)
                                        - cust.early_ship_days
                                           EARLIEST_SHIP_DATE_UnAdj,
                                        TRUNC (REVISED_DUE_DATE)
                                        + CUST.LATE_SHIP_DAYS
                                           LATEST_SHIP_DATE_UnAdj,
                                        --0 ALLOC_PCT,
                                        --0 WHSE_PCT,
                                        ABC_CLASS,
                                        NVL (LOCATION_ID, '000') LOCATION_ID,
                                        --NULL RELEASE_COMP,
                                        WAREHOUSE_DESC,
                                        NVL (
                                           DECODE (MAKE_TO_FLAG,
                                                   'S', 0,
                                                   'O', 1,
                                                   '', -1),
                                           -1)
                                           MAKE_TO_FLAG,
                                        ord.CREATE_DATE source_create_date,
                                        ord.UPDATE_DATE source_update_date,
                                        ord.CREATED_BY source_created_by,
                                        ord.UPDATED_BY source_updated_by,
                                        ord.ENTITY_CODE,
                                        ord.RECORD_ID,
                                        src.SYS_ENT_ID SRC_SYS_ENT_ID,
                                        ord.BSS_HIERARCHY_KEY
                                   FROM EDW_DTL_ORDER_FACT ord,
                                        edw_v_maxv_cust_dim cust,
                                        edw_v_maxv_part_dim part,
                                        EDW_WAREHOUSE_LKP war,
                                        EDW_SOURCE_LKP src,
                                        MEDW_PLANT_LKP s2,
                                        edw_v_incr_refresh_ctl incr
                                  WHERE ord.BSS_HIERARCHY_KEY =
                                           cust.BSS_HIERARCHY_KEY(+)
                                        AND ord.record_id = part.record_id(+)
                                        AND ord.part_no = part.part_no(+)
                                        AND NVL (ord.WAREHOUSE, ord.entity_code) =
                                               war.WAREHOUSE_code(+)
                                        AND ord.entity_code = war.entity_code(+)
                                        AND ord.record_id = src.record_id
                                        AND src.calculate_back_order_flag = 'Y'
                                        AND NVL (cancel_order_flag, 'N') != 'Y'
                                        AND UPPER (part.source_plant) =
                                               UPPER (s2.location_code1(+))
                                        AND mapping_name = 'MEDW_MAP_GIEA_MTOS_STG'
                                      --  AND NVL (ord.UPDATE_DATE, SYSDATE) >=
                                      --         MAX_SOURCE_UPDATE_DATE
                                        AND UPPER (
                                               NVL (ord.order_status, 'BOOKED')) NOT IN
                                               ('ENTERED', 'CANCELLED')
                                        AND TRUNC (REVISED_DUE_DATE) <= SYSDATE) SL_UNADJ,
                                EDW_TIME_DIM TIMA,
                                EDW_TIME_DIM TIMB
                          WHERE TRUNC (SL_UNADJ.EARLIEST_SHIP_DATE_UnAdj) =
                                   TIMA.ACCOUNT_DATE
                                AND TRUNC (SL_UNADJ.LATEST_SHIP_DATE_Unadj) =
                                       TIMB.ACCOUNT_DATE) SL_INT
                  WHERE TRUNC (LATEST_SHIP_DATE) <= TRUNC (SYSDATE)
               GROUP BY SL_INT.SYS_ENT_ID,
                        SL_INT.CUSTOMER_NO,
                        SL_INT.BILL_TO_LOCATION,
                        SL_INT.PART_NO,
                        SL_INT.SRCE_SYS_ID,
                        SL_INT.BUS_AREA_ID,
                        SL_INT.CONTRACT,
                        SL_INT.WAREHOUSE,
                        SL_INT.ORDER_NO,
                        SL_INT.LINE_NO,
                        SL_INT.REVISED_DUE_DATE,
                        SL_INT.ABBREVIATION,
                        SL_INT.BASE_WAREHOUSE,
                        SL_INT.ABC_CLASS,
                        SL_INT.LOCATION_ID,
                        SL_INT.WAREHOUSE_DESC,
                        SL_INT.MAKE_TO_FLAG,
                        SL_INT.source_created_by,
                        SL_INT.source_updated_by,
                        SL_INT.ENTITY_CODE,
                        SL_INT.RECORD_ID,
                        SL_INT.SRC_SYS_ENT_ID,
                        SL_INT.BSS_HIERARCHY_KEY) SL
        WHERE (SL.BSS_HIERARCHY_KEY,
               SL.ORDER_NO,
               Sl.line_no,
               sl.Revised_due_date,
               SL.PART_NO,
               sl.sys_ent_id) NOT IN
                 (SELECT BSS_HIERARCHY_KEY,
                         ORDER_NO,
                         line_no,
                         revised_due_date,
                         part_no,
                         src_sys_ent_id
                    FROM MEDW_MTOS_DTL_FACT
                   WHERE service_lvl_flag = 'Y');
                   thanks
    asn

    Also 'NOT IN' + nullable columns can be an expensive combination - and may not give the expected results. For example, compare these:
    with test1 as ( select 1 as key1 from dual )
       , test2 as ( select null as key2 from dual )
    select * from test1
    where  key1 not in
           ( select key2 from test2 );
    no rows selected
    with test1 as ( select 1 as key1 from dual )
       , test2 as ( select null as key2 from dual )
    select * from test1
    where  key1 not in
           ( select key2 from test2
             where  key2 is not null );
          KEY1
             1
    1 row selected.Even if the columns do contain values, if they are nullable Oracle has to perform a resource-intensive filter operation in case they are null. An EXISTS construction is not concerned with null values and can therefore use a more efficient execution plan, leading people to think it is inherently faster in general.

  • Select data from database tables with high performance

    hi all,
    how to select data from different database tables with high performance.
    im using for all entries instead of inner joins, even though burden on data base tables is going very high ( 90 % in se30)
    hw to increase the performance.
    kindly, reply.
    thnks

    Also Check you are not using open sql much like distict order by group by , use abap techniques on internal table to acive the same.
    also Dont use select endselect.
    if possible use up to n rows claus....
    taht will limit the data base hits.
    also dont run select in siode any loops.
    i guess these are some of the trics oyu can use to avoid frequent DATA BASE HITS AND ABVOID THE DATA BASE LAOD.

  • Doubt about select performance and keys in Select.

    Hi Gurus.
    I need select data from VBAK with key Vbeln (VBFA has value then i can use your vbelv i think)  then with VBAK-BSTNK and VBAK-KUNNR i goin to select data from KNA1 , only field ADRNR , then i going to ADRC table with field ADRNR  like key, then i could select CITY1, STREET, HOUSE_NUM1, HOUSE_NUM2, CITY2, POST_CODE1 e CITY1.
    1- I know that tables has many data then i need advices for a good performance. suggests is welcome.
    2- If i write any thing wrong please tell me .
    3-If anybody know any key that i don´t write please tell me.
    4-If anybody know other way .suggests is welcome.
    Thanks comunitty for help.

    Hi Ronaldo,
    It seems you have everything you need. You have primary keys for VBAK, KNA1 and ADRC, so the best option in my opinion is one select from vbak inner join KNA1. As fopr ADRC it may be tricy because of the date from / to, so this might be worth going FAE. But test both posibilities before settling for one.  I don't know why you need BSTNK though
    By the way, this I assume you are writing a report? cause if you only need one record at a time I suggest you use BAPIs for customer/address.
    Cheers,
    Custodio

  • How to select date in which no transaction perform

    Suppose ive a tablE T1
    Dated date,
    Empno varchar2(10),
    status varchar2(1));
    WHEN I PASS THIS QUERY
    select date,empno from t1 where dated between '1-may-2007' and '30-may-2007'
    it will results all the dates in which transactions are performed,and skipping the dated in which that empno is null...
    my query is that query will return all the dated between passed parameter and if status is found null display 'A' .
    regards
    Danish Hayder

    You can create a second table with any range of dates that you require and cartesian join them;
    SQL> with t1 as (
       select to_date('04-may-2007', 'dd-mon-yyyy') Dated, 1 Empno, 'a' status from dual union all
       select to_date('06-may-2007', 'dd-mon-yyyy'), 1, 'b' from dual)
    select
       t2.dt,
       t1.empno,
       nvl(t1.status, 'a') status  
    from t1,
       (select trunc(sysdate)-200 +rownum dt
       from dual
       connect by rownum <= 365) t2
    where t2.dt = t1.dated(+)
    and t2.dt between to_date('01-may-2007', 'dd-mon-yyyy')
                  and to_date('30-may-2007', 'dd-mon-yyyy')
    order by t2.dt
    DT            EMPNO S
    07-05-01            a
    07-05-02            a
    07-05-03            a
    07-05-04          1 a
    07-05-05            a
    07-05-06          1 b
    07-05-07            a
    07-05-29            a
    07-05-30            a
    30 rows selected.Message was edited by:
    MScallion
    Forgot the NVL

  • A question about select where date =

    I want to select data from a table which has a date column and has the time format like "2009-11-30 00:00:00.0".
    I try using the sql-script as follow but failed.
    select * from mytable
    where begin_date = to_date ('2009-11-30', 'yyyy.mm.dd ');
    Someone knows the format?

    Hi,
    user10501597 wrote:
    I want to select data from a table which has a date column and has the time format like "2009-11-30 00:00:00.0". All DATE columns have the same format; only strings have a format like that. A lot of people say they have a DATE column when they actually have a VARCHAR2 that is supposed to store a date. Post a CREATE TABLE statement to remove any doubt.
    I try using the sql-script as follow but failed.
    select * from mytable
    where begin_date = to_date ('2009-11-30', 'yyyy.mm.dd ');That looks okay. The extra space after dd shouldn't matter.
    What you wrote is equivalent to:
    select  *
    from    mytable
    where   begin_date = to_date ('2009-11-30 00:00:00', 'yyyy.mm.dd hh24:mi:ss');Are you sure you have rows with that value?
    Whenever you have a problem, post some sample data (CREATE TABLE and INSERT statements) so people can re-create the problem.

  • Comparing SELECTs for performance

    I have a long-running function module and through SAT, I've identified its SELECT from BSEG as a potential hotspot and way that I can improve the run time, etc.
    Through some research in SCN, I found I can/should use one of the component tables (BSID) to improve performance, but I don't know *how much* of an improvement it will be.
    Rather than change the code of the FM and transport it to QA just to analyze performance gains, I was hoping there was some sort of tool that I could use to analyze separate code comparatively.
    I thought of making 2 Quickviewer queries (one for BSEG and one for BSID) and then using ST05 to analyze each.  Is there a better way?
    Basically in PRD, I'd like to compare isolated SELECTs for performance to see what gains I could make.
    Thanks
    Jeremy H.

    You can find some interesting discussions linked here, some also talk about index access:
    FAQ's, intros and memorable discussions in the ABAP Testing and Troubleshooting Space
    Regarding your point 4), make sure your WHERE-condition contains as many fields of the index top down without gaps.
    Looking at BSID~4:
    MANDT
    Client
    BUKRS
    Company Code
    REBZG
    Number of the Invoice the Transaction Belongs to
    REBZJ
    Fiscal Year of the Relevant Invoice (for Credit Memo)
    REBZZ
    Line Item in the Relevant Invoice
    KUNNR
    Customer Number
    UMSKS
    Special G/L Transaction Type
    REBZT
    Follow-On Document Type
    MANDT will be included automatically. BUKRS is not very selective (not many distinct values), but you must include it since it is the leading field of the index. REBZG sounds like a selective field, so you can likely use the index effectively by having just BUKRS and REBZG in your WHERE-condition, but the more the better.
    Also have a look at transactions DB05 and TAANA which can give you a good idea about the actual data distribution.
    Thomas

  • Add Command when selecting data tables

    I've been playing with the Add Command option that allows you to enter an SQL statement to select data for the report.  I was wondering what people use this type of command for?  I've used Crystal over 10 years but while I've been using Crystal XI for only about 3 years, I have never used this option.
    So what advantages does it have over the graphically selection and linking of data tables?
    What types of reporting is usually done with them?
    TIA, rasinc

    You have to know your database well and have fairly good SQL skills, but I've found that there are things I can't do directly in Crystal that I can do when I use a command as the data source.  A couple of examples are:
    1.  When I want to use cross-server joins (MS SQL) or dbLinks (Oracle) to get data from a second (or third!) database, this is the only way to do it short of using a stored procedure, which has it's own issues.
    2.  When I want to do something complex in the SQL, such as using a set of selects with Unions to "pivot" data without using a cross-tab.
    Also, Crystal doesn't always create the most efficient SQL so if I'm having problems with query performance in a report, I'll re-write it using a command so that I can tweak the performance.
    -Dell

  • SELECT call performance increase through archiving...

    Hi all,
    Short description : SELECT call performance increase through archiving records that satisfy a particular criteria like a cut off date. Is there any way i can intercept a select call on the real table and make it return records from the real or archive table based on the criteria (dates) issued in the call.
    Long description:
    I've been given the job of decreasing the execution time of a select statement on a particular database consisting of a few lakh records. the premise is that not all of these records need to be searched through for a normal query. only audit reports need access to the entire table. the additional premise is that the separation of tables should be transparent to the program (no changes can be made to the code). given these premises, i've been toying with some ideas that have not helped me out.
    * Read about Fine Grained Auditing that kind of allow a trigger on select which would change the sql query to select from either the real or archive table( not sure if this will work either). But my production system uses oracle 8i. so no FGA :-(
    * thought of create/replace a view that would restrict the rows based on a cut off date. but this would require code changes to make select calls on the actual table whenever an audit is required.
    Is there any way i can intercept a select call and make it select from one/ both of the tables based on the criteria (dates) issued in the call.
    any other suggestions on this kind off transperant archiving is welcomed.

    Do your queries have a WHERE clause? If so, and the table is partitioned by date, Oracle can implicitly eliminate all the older partitions.
    If your queries are not currently limiting themselves to a particular date range, you could also create a parameterized view with sys_context. Without changing your application, you would need to ensure that there were different users for different roles (i.e. an audit user would have a login trigger that set up a different context than a login trigger for a normal user). If you can make small changes to your application, you could add a call to set the context whenever you want to change roles.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Dynamically select data with 20 input parameters

    Hi Experts,
    Now i have created a subscreen with more than 20 fields on it. these fields are defined by parameters, not select options. user can input any fileds for these input parameters.
    So now i should write codes to select data from database according the user input. Is there any easy way for me to write it? I heard about dynamically SQLs, but i don't know how to use it.
    Thanks a lot!

    you forgot to mention why you needed dynamic SQL : I guess that when user lets a field blank, you must not perform selection on it.
    The easiest is ( FIELD1 = P_FIELD1 OR FIELD1 = space ) AND ( FIELD2 = P_FIELD2 OR FIELD2 = space ) AND etc. Even if it seems repetitive, I advise you to keep the SQL static instead of dynamic, because in this latter case, I think the code will be a little bit less clear.
    Of course, if you argue that there are other requirements, then maybe it's worth re-evaluating the solution.
    If you need more information, just look at ABAP examples in your system (SE38, Environment, Examples, ABAP examples -> ... -> Dynamic conditions)

  • Data Error in the Query/Report after selective data deletion for infocube

    Hi Experts,
    Please advise what i was missing and what went wrong...
    I got a Query (Forecast) on a Multicube...which is based on 2 Infocubes with Aggregates...
    As i identified some data discrepency..yesteraday i performed selective data deleation on one of the Infocube
    and executed report yesteraday and the results in the query are correct...
    When today i executed the same report i am getting different results..
    When i compared the results of the report with that of data in cube they are not matching
    The report is not displaying the data in cube..for some rows it is displaying the data in the cube but for some rows it is just displaying same as the above row
    there is no data loaded into info cube after selective deleation
    Do i need to perform request compression and fill the aggregated after selective deleation
    Please advise what went wrong

    Hi Venkat,
    No i haven't done anything on aggregates before or after selective delete
    As there is not data load after the selective delete according to SAP Manual we don't need to perform any thing on aggregates...as selective data deletion on cube will delete data from aggregates as well
    Please update how to identify error

  • Can you help me about change data captures in 10.2.0.3

    Hi,
    I made research about Change Data Capture and I try to implement it between two databases for two small tables in 10g release 2.MY CDC implementation uses archive logs to replicate data.
    Change Data Capture Mode Asynchronous autolog archive mode..It works correctly( except for ddl).Now I have some questions about CDC implementation for large tables.
    I have one senario to implement but I do not find exactly how can I do it correctly.
    I have one table (name test) that consists of 100 000 000 rows , everyday 1 000 000 transections occurs on this table and I archive the old
    data more than one year manually.This table is in the source db.I want to replicate this table by using Change Data Capture to other stage database.
    There are some questions about my senario in the following.
    1.How can I make the first load operations? (test table has 100 000 000 rows in the source db)
    2.In CDC, it uses change table (name test_ch) it consists of extra rows related to opearations for stage table.But, I need the orjinal table (name test) for applicaton works in stage database.How can I move the data from change table (test_ch) to orjinal table (name test) in stage database? (I don't prefer to use view for test table)
    3.How can I remove some data from change table(name test_ch) in stage db?It cause problem or not?
    4.There is a way to replicate ddl operations between two database?
    5. How can I find the last applied log on stage db in CDC?How can I find archive gap between source db and stage db?
    6.How can I make the maintanence of change tables in stage db?

    Asynchronous CDC uses Streams to generate the change records. Basically, it is a pre-packaged DML Handler that converts the changes into inserts into the change table. You indicated that you want the changes to be written to the original table, which is the default behavior of Streams replication. That is why I recommended that you use Streams directly.
    <p>
    Yes, it is possible to capture changes from a production redo/archive log at another database. This capability is called "downstream" capture in the Streams manuals. You can configure this capability using the MAINTAIN_* procedures in DBMS_STREAMS_ADM package (where * is one of TABLES, SCHEMAS, or GLOBAL depending on the granularity of change capture).
    <p>
    A couple of tips for using these procedures for downstream capture:
    <br>1) Don't forget to set up log shipping to the downstream capture database. Log shipping is setup exactly the same way for Streams as for Data Guard. Instructions can be found in the Streams Replication Administrator's Guide. This configuration has probably already been done as part of your initial CDC setup.
    <br>2) Run the command at the database that will perform the downstream capture. This database can also be the destination (or target) database where the changes are to be applied.
    <br>3) Explicitly define the parameters capture_queue_name and apply_queue_name to be the same queue name. Example:
    <br>capture_queue_name=>'STRMADMIN.STREAMS_QUEUE'
    <br>apply_queue_name=>'STRMADMIN.STREAMS_QUEUE'

Maybe you are looking for

  • Connecting to an ipv6 ad-hoc network

    hello I am tryin to connect to an ad-hoc network with the iPad (iOS 4.2). As far as I know, from iOS 4.2, the iPad should be ipv6 capable. As my ad-hoc network is an ipv6 net, I wa pretty happy. However, when I connect to the ad-hoc net, it doesn't s

  • 3014 error trying to update to 7.1.2 on iPhone 5c

    Using Windows 7 Home Premium 64 bit Spent a huge amount of time doing the usual (restart computer, restart iPhone) and various other rabbit trails leading nowhere. I got an outstanding Apple chat representative on the phone.  He convinced me to disab

  • IPhone 6 plus not possible to add recipient to messages

    I have an iPhone 6 Plus. A big display that I thought would add great possibilities to the iPhone. But among other issues there is one annoying issue that sticks out: when I try to forward a picture from another message, or try to send a picture from

  • How to use Smart cut and what are the restrictions to use this

    Hello, How to use Smartcut and what are the restrictions to use this. is it possible in version 9. and is it safer to use it in real iproject mplementation? Thanks in advance

  • Shooting multiple bullets

    Hello everyone, I'm trying to make my platform game character shoot a gun, my character and gun are one movieclip and the bullet is another. The bullet mc starts on a blank frame with a stop() function, when I press the space bar the bullet mc plays