PERFORMANCE OF INNER JIONS ..

HI,
SELECT LIFNR MBLNR MATNR WERKS SUM( MENGE ) SUM( DMBTR )
               CHARG BWART MJAHR INTO
               (ITAB-LIFNR, ITAB-MBLNR, ITAB-MATNR, ITAB-WERKS,
               ITAB-MENGE,ITAB-DMBTR, ITAB-CHARG, ITAB-BWART,
               ITAB-MJAHR)
               FROM MSEG
               WHERE ( WERKS IN WERKS AND
                       LIFNR IN LIFNR AND
                       CHARG IN CHARG AND
                       BWART BETWEEN '101' AND '102' AND
                       EBELN BETWEEN '4701000000' AND '4701999999' ) OR
                     ( WERKS IN WERKS AND
                       LIFNR IN LIFNR AND
                       CHARG IN CHARG AND
                       BWART BETWEEN '101' AND '102' AND
                       EBELN BETWEEN '4704000000' AND '4704999999' )
                     GROUP BY LIFNR MBLNR MATNR WERKS CHARG BWART MJAHR.
        SELECT BUDAT INTO (ITAB-BUDAT)
               FROM MKPF
               WHERE BUDAT IN BUDAT
                 AND MBLNR EQ ITAB-MBLNR
                 AND MJAHR EQ ITAB-MJAHR.
        SELECT SINGLE BKLAS INTO (TEMP_BKLAS)
          FROM MBEW WHERE BKLAS IN BKLAS AND
                          MATNR EQ ITAB-MATNR.
I HAVE TO COMBINE ALL THE ABOVE PROGRAMS IN 1 STMTS.
   INSTEAD OF GROUP BY WAT TO USE TO REDUCE PERFORMANCE ISSUE
CAN ANY ONE HELIP ME OUT?

CTUALLY GO THROUGH MKPF( I GUESS u MUST BE HAVING A DATE RANGE FOR SELECTION...IM WRITING ACCORDING TO THAT)
SELECT MBLNR MJAHR INTO TABLE IT_MKPF FROm MKPF WHERE BUDAT in SoBUDAT <-----THE DATE RANGE
sort IT_MKPF by mblnr mjahr ascending.
SELECT MJAHR MBLNR MATNR WERKS MENGE BWART LIFNR DMBTR CHARG 
INTO TABLE ITAB FOR ALL ENTRIES IN IT_MKPF WHERE MBLNR = it_MKPF-MBLNR
AND MJAHR = IT_MKPF-MJAHR
and matnr ge v_matnr     <---OPT TECHNIQUE
AND WERKS IN WERKS
AND BWART in ('101','102')
AND EBELN in RA_EBELN
and LIFNR in LIFNR
and charg in charg.
if ITAB[] is not initial.
sort itab by matnr ascending.
select matnr bklas into table it_bklas from mbew for all entries in ITAB
where matnr = ITAB-MATNR and bklas in bklas.
endif.
after selection is done loop through the needed  internal tables and join the records....

Similar Messages

  • Inner Join. How to improve the performance of inner join query

    Inner Join. How to improve the performance of inner join query.
    Query is :
    select f1~ablbelnr
             f1~gernr
             f1~equnr
             f1~zwnummer
             f1~adat
             f1~atim
             f1~v_zwstand
             f1~n_zwstand
             f1~aktiv
             f1~adatsoll
             f1~pruefzahl
             f1~ablstat
             f1~pruefpkt
             f1~popcode
             f1~erdat
             f1~istablart
             f2~anlage
             f2~ablesgr
             f2~abrdats
             f2~ableinh
                from eabl as f1
                inner join eablg as f2
                on f1ablbelnr = f2ablbelnr
                into corresponding fields of table it_list
                where f1~ablstat in s_mrstat
                %_HINTS ORACLE 'USE_NL (T_00 T_01) index(T_01 "EABLG~0")'.
    I wanted to modify the query, since its taking lot of time to load the data.
    Please suggest : -
    Treat this is very urgent.

    Hi Shyamal,
    In your program , you are using "into corresponding fields of ".
    Try not to use this addition in your select query.
    Instead, just use "into table it_list".
    As an example,
    Just give a normal query using "into corresponding fields of" in a program. Now go to se30 ( Runtime analysis), and give the program name and execute it .
    Now if you click on Analyze button , you can see, the analysis given for the query.The one given in "Red" line informs you that you need to find for alternate methods.
    On the other hand, if you are using "into table itab", it will give you an entirely different analysis.
    So try not to give "into corresponding fields" in your query.
    Regards,
    SP.

  • Poor Performance on Inner Join of VBUP and VBAK

    The following select is performing poorly, i.e., ST05 Execution is 1, Records is 246, but Time/Exec 94,499,272. Very poor.
    SELECT VBUPVBELN VBUPPOSNR VBAK~KUNNR
             FROM VBUP INNER JOIN VBAK
             ON VBUPVBELN = VBAKVBELN
             WHERE VBAK~VBTYP EQ 'C'     
               AND VBUP~LFSTA NE 'C'
               AND VBUP~LFGSA NE 'C'.
    VBUP has a custom index, Z01, on MANDT, LFSTA, LFGSA. There is no index on VBAK.
    The Explain under ST05 indicates an Est. I/O cost of 73.94 for a Clustered Index Seek on [VBAK].[VBAK0], and an Est. I/O cost of 81.34 for an Index Seek on [VBUP].[VBUPZ01].
    There is no index on VBAK, so I assume that's the first problem. But I don't understand why the index on VBUP does not appear to be helping. This the ST05 Explain: Index Seek WHERE: [PCI].[pci].[VBUP].[LFGSA] as [T_00].[LFGSA]<[@P4] OR [PCI].[pci].[VBUP].[LFGSA] as [T_00].[LFGSA]>[@P4] : [VBUP].MANDT EQ [@P1] ORDERED 1.
    Is my index even being used?  Any ideas how I can speed this up?
    Thanks in advance for your help.
    Beth

    tis the negative selection which is causing the problem..try to avoid selection using not equal to.
    try this.
    ranges : r_lfsta for vbup-lfsta.
    r_lfsta-sign = 'I'.
    r_lfsta-option = 'EQ'.
    r_lfsta-low = ' '.
    append r_lfsta.
    r_lfsta-low = 'A'.
    append r_lfsta.
    r_lfsta-low = 'B'.
    append r_lfsta.
    do similar for r_lfgsa also.
    SELECT VBUP~VBELN
                 VBUP~POSNR
                 VBAK~KUNNR
    FROM VBUP INNER JOIN VBAK
    into corresponding fields of table t_vbakvbup
    ON VBUPVBELN = VBAKVBELN
    WHERE VBAK~VBTYP EQ 'C'
    AND VBUP~LFSTA in r_lfsta
    AND VBUP~LFGSA in r_lfgsa. 
    or
    SELECT VBUP~VBELN
                 VBUP~POSNR
                 VBAK~KUNNR
    vbup~lfsta
    vbup~lfgsa
    FROM VBUP INNER JOIN VBAK
    into corresponding fields of table t_vbakvbup
    ON VBUPVBELN = VBAKVBELN
    WHERE VBAK~VBTYP EQ 'C' .
    delete t_vbakvbup where lfsta ne 'C'.
    delete t_vbakvbup where lfgsa ne 'C'.

  • Performance in Inner Join on VBAK

    HI,
    For a customized report the select statement was written like this which is giving time out error for large data. How one can improve performance of following Inner Joins.
      SELECT  *
          INTO CORRESPONDING FIELDS OF TABLE it_tab
           FROM vbak as A INNER JOIN vbuk as B
                  ON Avbeln = Bvbeln
                INNER JOIN vbkd as C
                 ON Avbeln = Cvbeln
      WHERE    A~vbeln      IN  so_vbeln
         AND   A~audat      IN  so_audat
         AND   A~auart      IN  so_auart
         AND   A~augru      IN  so_augru
         AND   A~faksk    IN  so_faksp
         AND   A~vkorg      IN  so_vkorg
         AND   A~vtweg      IN  so_vtweg
         AND   A~spart      IN  so_spart
         AND   A~vkbur      IN  so_vkbur
         AND   A~vkgrp      IN  so_vkgrp
         AND   A~vsbed      IN  so_vsbed
         AND   A~kunnr      IN  so_kunnr
         and   B~gbstk      IN  so_gbstx
         AND   C~posnr       =  '000000'.
    Thanks
    anya
    Moderator message: FAQ, it all depends on the content of the so_ ranges at runtime.
    Please Read before Posting in the Performance and Tuning Forum
    Edited by: Thomas Zloch on Nov 1, 2010 11:57 AM

    Others have already responded, and I would only like to dwell on the answers for a short while. Or maybe rather the question.
    This question is typical for the inexperienced developer. This particular question is actually a little different, because there is a straight answer: there is no difference. For most questions of this type the answer is "it depends", because one
    particular syntax can happen to perform better with one set of data and indexes, but with a different data/index profile another syntax gives better result.
    Ideally, as long as two queries are logically equivalent, the syntax should not matter at all, because the optimizer should always figure out the best way to achieve the result. In practice, this is not the case, because there are lots of limitaitons in
    an optimizer in an RDBMS.
    While it certainly can matter for performance how you write your queries, that is not what you should focus on. What you should focus is to express your query as clearly as possible, and make sure that you have the relevant indexes in place. There is one
    rule when it comes to query-writing you should take your heart: never entable a column in a condition in an expression, because that is likely to render index on that column useless.
    For this particular question, the answer is that as you long as you write code for SQL Server, use the JOIN syntax. But if you use that in the Oracle world, you may get funny looks from people. It's a different culture over there...
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Perform an Inner Join in Oracle 8

    We have to make our application (that runs with Oracle 9i) backward compatible with Oracle 8.
    There are certain SQL statements that were introduced in Oracle 9i, such as Inner Join (Oracle 9i now allows more of the ANSI standard SQL that MS SQL also uses)
    Does anyone know of the other differences I should look out for, or any documentation that lists the new 9i differences that we may already be using.
    I have trawled through lots of OTN documentation, but not been able to find anything that highlights even the Inner Join problem.
    If there are any documents that also suggest a solution, that would be even better.
    Thanks in advance for any help/suggestion
    Mark

    You have a parameter called "COMPATIBLE", and if you set to, for example 8.1.7 in your 9i database, then your application should be compatible with 8.1.7. It is that easy!
    Of course, by doing so, you renounce to use the 9i features.
    There is a book called "New Features" in the book list in your oracle documentation.
    Regards
    Laurent Schneider

  • HOW DEFINE INNER JIONS FOR MULTIPLE TABLE-FIELDS

    HI I  HAVE THE IMMEDIATE ISSUE TO RESOLVE...
    data: begin of it_jtab occurs 0,
    gsber like tgsb-gsber,
    gjahr like coss-gjahr,
    kostl like csks-kostl,
    posid like prps-posid,
    plfaz like proj-plfaz,
    plsez like proj-plsez,
    estat like tj30t-estat,
    perbl like coss-perbl,
    wkgbtr like coep-wkgbtr,
    end of it_jtab.
    HOW CAN I DO INNER JOIN FOR THE GIVEN TABLE??
    AM CURENTLY ON 4.0 VERSION HENCE HELP ME KNOW TO WORK ON JOINS ONLY.........

    Hi,
    Check this prog,
    Inner joins using 3 tables 
    Try this :-
    SELECT stpostlnr stpoidnrk mastmatnr maramtart stpo~menge 
    INTO CORRESPONDING FIELDS OF TABLE zmat1 FROM mast 
    JOIN stpo ON stpostlnr = maststlnr 
    JOIN mara ON maramatnr = mastmatnr 
    WHERE stpostlty = 'M' "AND stpoidnrk IN s_matnr 
    AND mast~werks = 1000. 
    Here s_matnr is a select-options on the selection-screen. 
    Or this. 
    Code: 
         Select single VbrkBukrs VbrkKunrg    Vbrk~Vbeln 
                       VbrkFkdat VbrkBstnk_Vf Vbrk~Zterm 
                       Tvzbt~Vtext 
                       VbakVbeln VbakBstdk 
                       LikpVbeln Likplfdat    Likp~Lfuhr 
           into w_vbrk 
           from vbrk 
          inner join       Tvzbt on TvzbtZterm        = VbrkZterm      and 
                                    Tvzbt~Spras        = sy-langu 
          Inner join       Vbfa  as SalesLnk 
                                 on SalesLnk~vbeln     = pu_vbeln        and 
                                    SalesLnk~vbtyp_v   = c_order 
                inner join Vbak  on VbakVbeln           = SalesLnkVbelv
          Inner join       Vbfa  as DeliveryLnk 
                                 on DeliveryLnk~vbeln   = pu_vbeln       and 
                                    DeliveryLnk~vbtyp_v = c_Delivery 
                inner join Likp  on LikpVbeln          = DeliveryLnkVbelv 
          where vbrk~vbeln = pu_Vbeln. 
    This code locates sales, delivery and payment terms info from a billing document number. 
    or
    Here, this one also works fine :
    select zfpcdcadivi zfpcdproforma zfpcdfactura zfpcdaniofactura 
    zfpcdmontousd zfpcdmontoap zfpcdebeln zfpcdinco1 
    zfpcdlifnr lfa1name1 zcdvsstatus zfpcdconint 
    into it_lista 
    from zfpcd inner join zcdvs 
    on zfpcdebeln = zcdvsebeln 
    and zfpcdproforma = zcdvsproforma 
    and zfpcdlifnr = zcdvslifnr 
    inner join lfa1 
    on zfpcdlifnr = lfa1lifnr 
    where zcdvs~status = '04'. 
    Regards,
    Arunsri

  • Inner join and select for all entries with respect to performance

    Hi Friends,
    I just want to know which is more efficient with respect to performance the Inner join or select for all entries?which is more efficient? and how? can you explain me in detail ?
    Regards,
    Dinesh

    INNER JOIN->
    The data that can be selected with a view depends primarily on whether the view implements an inner join or an outer join. With an inner join, you only get the records of the cross-product for which there is an entry in all tables used in the view. With an outer join, records are also selected for which there is no entry in some of the tables used in the view.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ec77446011d189700000e8322d00/content.htm
    FOR ALL ENTRIES->
    Outer join can be created using this addition to the where clause in a select statement. It speeds up the performance tremendously, but the cons of using this variation are listed below
    Duplicates are automatically removed from the resulting data set. Hence care should be taken that the unique key of the detail line items should be given in the select statement.
    If the table on which the For All Entries IN clause is based is empty, all rows are selected into the destination table. Hence it is advisable to check before-hand that the first table is not empty.
    If the table on which the For All Entries IN clause is based is very large, the performance will go down instead of improving. Hence attempt should be made to keep the table size to a moderate level.
    Not Recommended
    Loop at int_cntry.
    Select single * from zfligh into int_fligh
    where cntry = int_cntry-cntry.
    Append int_fligh.
    Endloop.
    Recommended
    Select * from zfligh appending table int_fligh
    For all entries in int_cntry
    Where cntry = int_cntry-cntry.

  • Inner join and select for all entries with respect to performance in SAP

    Hi Friends,
    I just want to know which is more efficient with respect to performance the Inner join or select for all entries?which is more efficient?
    Regards,
    Dinesh

    I did some testing a while ago and found that a JOIN is usually a bit more efficient than FOR ALL ENTRIES. This wasn't always the case though, so the best thing to do is to write it both ways and see which is faster.
    Rob

  • Performance difference between left outer join / inner join

    Hi,
    I've got a complex query which among other things accesses quite a large table. If I use inner join to join this table, the response is quite fast and execution plan shows it uses nested loops to gather the data.
    If I change inner join to left outer join, I get a big performance drop. Cost of query goes from 1441 to 28544.
    I don't uderstand why there's such a difference. For inner join, database has to remove all the rows that don't have match in inner-joined table. For left join it can keep all records and just return NULL values for records that don't have a match. In my mind left join should be faster, as it seems simpler. And the access plan could be the same, couldn't it?
    Execution plan for inner join:
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 288 | 1441 (1)| 00:00:18 |
    | 1 | HASH GROUP BY | | 1 | 288 | 1441 (1)| 00:00:18 |
    | 2 | NESTED LOOPS OUTER | | 1 | 288 | 1440 (1)| 00:00:18 |
    | 3 | NESTED LOOPS | | 1 | 261 | 1438 (1)| 00:00:18 |
    | 4 | NESTED LOOPS | | 318 | 74412 | 508 (1)| 00:00:07 |
    | 5 | NESTED LOOPS | | 318 | 51834 | 189 (0)| 00:00:03 |
    | 6 | TABLE ACCESS BY INDEX ROWID| RESURCE | 1 | 106 | 1 (0)| 00:00:01 |
    |* 7 | INDEX UNIQUE SCAN | RESURCE_PRINCIPAL_NAME_INDEX | 1 | | 0 (0)| 00:00:01 |
    | 8 | TABLE ACCESS BY INDEX ROWID| TASK_USES_RESURCE | 318 | 18126 | 188 (0)| 00:00:03 |
    |* 9 | INDEX RANGE SCAN | TASK_USES_RESUR_IDX$$_0CDC0002 | 318 | | 3 (0)| 00:00:01 |
    | 10 | TABLE ACCESS BY INDEX ROWID | TASK | 1 | 71 | 1 (0)| 00:00:01 |
    |* 11 | INDEX UNIQUE SCAN | TASK_PK | 1 | | 0 (0)| 00:00:01 |
    | 12 | TABLE ACCESS BY INDEX ROWID | TASK_WORK_HISTORY | 1 | 27 | 3 (0)| 00:00:01 |
    |* 13 | INDEX RANGE SCAN | TASK_WORK_HISTORY_INDEX1 | 1 | | 2 (0)| 00:00:01 |
    | 14 | TABLE ACCESS BY INDEX ROWID | TASK_USES_RESURCE | 1 | 27 | 2 (0)| 00:00:01 |
    |* 15 | INDEX UNIQUE SCAN | TASK_USES_RESURCE_UK1 | 1 | | 1 (0)| 00:00:01 |
    For left outer join:
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 318 | 1596K| | 28544 (2)| 00:05:43 |
    |* 1 | HASH JOIN OUTER | | 318 | 1596K| 1584K| 28544 (2)| 00:05:43 |
    | 2 | VIEW | | 318 | 1580K| | 508 (1)| 00:00:07 |
    | 3 | NESTED LOOPS | | 318 | 74412 | | 508 (1)| 00:00:07 |
    | 4 | NESTED LOOPS | | 318 | 51834 | | 189 (0)| 00:00:03 |
    | 5 | TABLE ACCESS BY INDEX ROWID| RESURCE | 1 | 106 | | 1 (0)| 00:00:01 |
    |* 6 | INDEX UNIQUE SCAN | RESURCE_PRINCIPAL_NAME_INDEX | 1 | | | 0 (0)| 00:00:01 |
    | 7 | TABLE ACCESS BY INDEX ROWID| TASK_USES_RESURCE | 318 | 18126 | | 188 (0)| 00:00:03 |
    |* 8 | INDEX RANGE SCAN | TASK_USES_RESUR_IDX$$_0CDC0002 | 318 | | | 3 (0)| 00:00:01 |
    | 9 | TABLE ACCESS BY INDEX ROWID | TASK | 1 | 71 | | 1 (0)| 00:00:01 |
    |* 10 | INDEX UNIQUE SCAN | TASK_PK | 1 | | | 0 (0)| 00:00:01 |
    | 11 | VIEW | | 1480K| 73M| | 23431 (2)| 00:04:42 |
    |* 12 | HASH JOIN RIGHT OUTER | | 1480K| 76M| 38M| 23431 (2)| 00:04:42 |
    | 13 | TABLE ACCESS FULL | TASK_USES_RESURCE | 1486K| 21M| | 2938 (2)| 00:00:36 |
    | 14 | VIEW | | 1445K| 53M| | 15031 (2)| 00:03:01 |
    | 15 | HASH GROUP BY | | 1445K| 37M| 110M| 15031 (2)| 00:03:01 |
    | 16 | TABLE ACCESS FULL | TASK_WORK_HISTORY | 1445K| 37M| | 3897 (2)| 00:00:47 |
    --------------------------------------------------------------------------------------------------------------------------

    ...continued
    Complete execution plan for left join:
    | Id  | Operation                       | Name                           | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |                                                                                                                                                                                  
    |   0 | SELECT STATEMENT                |                                |   318 |  1594K|       | 28544   (2)| 00:05:43 |                                                                                                                                                                                  
    |*  1 |  HASH JOIN OUTER                |                                |   318 |  1594K|  1584K| 28544   (2)| 00:05:43 |                                                                                                                                                                                  
    |   2 |   VIEW                          |                                |   318 |  1578K|       |   508   (1)| 00:00:07 |                                                                                                                                                                                  
    |   3 |    NESTED LOOPS                 |                                |   318 | 74412 |       |   508   (1)| 00:00:07 |                                                                                                                                                                                  
    |   4 |     NESTED LOOPS                |                                |   318 | 51834 |       |   189   (0)| 00:00:03 |                                                                                                                                                                                  
    |   5 |      TABLE ACCESS BY INDEX ROWID| RESURCE                        |     1 |   106 |       |     1   (0)| 00:00:01 |                                                                                                                                                                                  
    |*  6 |       INDEX UNIQUE SCAN         | RESURCE_PRINCIPAL_NAME_INDEX   |     1 |       |       |     0   (0)| 00:00:01 |                                                                                                                                                                                  
    |   7 |      TABLE ACCESS BY INDEX ROWID| TASK_USES_RESURCE              |   318 | 18126 |       |   188   (0)| 00:00:03 |                                                                                                                                                                                  
    |*  8 |       INDEX RANGE SCAN          | TASK_USES_RESUR_IDX$$_0CDC0002 |   318 |       |       |     3   (0)| 00:00:01 |                                                                                                                                                                                  
    |   9 |     TABLE ACCESS BY INDEX ROWID | TASK                           |     1 |    71 |       |     1   (0)| 00:00:01 |                                                                                                                                                                                  
    |* 10 |      INDEX UNIQUE SCAN          | TASK_PK                        |     1 |       |       |     0   (0)| 00:00:01 |                                                                                                                                                                                  
    |  11 |   VIEW                          |                                |  1480K|    73M|       | 23431   (2)| 00:04:42 |                                                                                                                                                                                  
    |* 12 |    HASH JOIN RIGHT OUTER        |                                |  1480K|    76M|    38M| 23431   (2)| 00:04:42 |                                                                                                                                                                                  
    |  13 |     TABLE ACCESS FULL           | TASK_USES_RESURCE              |  1486K|    21M|       |  2938   (2)| 00:00:36 |                                                                                                                                                                                  
    |  14 |     VIEW                        |                                |  1445K|    53M|       | 15031   (2)| 00:03:01 |                                                                                                                                                                                  
    |  15 |      HASH GROUP BY              |                                |  1445K|    37M|   110M| 15031   (2)| 00:03:01 |                                                                                                                                                                                  
    |  16 |       TABLE ACCESS FULL         | TASK_WORK_HISTORY              |  1445K|    37M|       |  3897   (2)| 00:00:47 |                                                                                                                                                                                  
    Query Block Name / Object Alias (identified by operation id):                                                                                                                                                                                                                                               
       1 - SEL$1AFB0324                                                                                                                                                                                                                                                                                         
       2 - SEL$58A6D7F6 / from$_subquery$_005@SEL$8                                                                                                                                                                                                                                                             
       3 - SEL$58A6D7F6                                                                                                                                                                                                                                                                                         
       5 - SEL$58A6D7F6 / RESURCEWORKER@SEL$2                                                                                                                                                                                                                                                                   
       6 - SEL$58A6D7F6 / RESURCEWORKER@SEL$2                                                                                                                                                                                                                                                                   
       7 - SEL$58A6D7F6 / TASKUSESRESURCE@SEL$1                                                                                                                                                                                                                                                                 
       8 - SEL$58A6D7F6 / TASKUSESRESURCE@SEL$1                                                                                                                                                                                                                                                                 
       9 - SEL$58A6D7F6 / TASK@SEL$1                                                                                                                                                                                                                                                                            
      10 - SEL$58A6D7F6 / TASK@SEL$1                                                                                                                                                                                                                                                                            
      11 - SEL$7EBCC247 / TRW@SEL$3                                                                                                                                                                                                                                                                             
      12 - SEL$7EBCC247                                                                                                                                                                                                                                                                                         
      13 - SEL$7EBCC247 / TUR@SEL$4                                                                                                                                                                                                                                                                             
      14 - SEL$6        / TRW_IN@SEL$5                                                                                                                                                                                                                                                                          
      15 - SEL$6                                                                                                                                                                                                                                                                                                
      16 - SEL$6        / TWH@SEL$6                                                                                                                                                                                                                                                                             
    Predicate Information (identified by operation id):                                                                                                                                                                                                                                                         
       1 - access("TRW"."RESURCE_ID"(+)="TASKUSESRESURCE"."RESURCE_ID" AND "TRW"."TASK_ID"(+)="TASK"."ID")                                                                                                                                                                                                      
       6 - access("RESURCEWORKER"."USER_PRINCIPAL_NAME"=U'jernej')                                                                                                                                                                                                                                              
       8 - access("TASKUSESRESURCE"."RESURCE_ID"="RESURCEWORKER"."ID")                                                                                                                                                                                                                                          
      10 - access("TASKUSESRESURCE"."TASK_ID"="TASK"."ID")                                                                                                                                                                                                                                                      
      12 - access("TUR"."RESURCE_ID"(+)="TRW_IN"."RESURCE_ID" AND "TUR"."TASK_ID"(+)="TRW_IN"."TASK_ID")                                                                                                                                                                                                         Jonathan, I've been to one of your workshops in Ljubljana. I'm still trying to understand everything you explained and use it, but there's much I have to learn and understand.
    The way I see this query it should fist join and filter the first three tables and only then join the trw subquery. The problem with this subqrey is task_work_history table, which is accessed in very different ways in different places, so there will always be many reads to gather required data. For now, however, I'd be hapy to just bring the performance of inner join to left join...

  • Relationship between tables while using inner joins.

    Hi,
    I had a few clarifications on "inner joins", and as i was going through the forum, i came across two points,
    1. In one of the threads it said " inner joins is applicable for tables that have a parent child relationship.
    2. In another thread it said " inner join is established from master table (the table on the left) to the transcation table (the table on the right)".
    I have two clarifications based on the above points.
    1. Is it necessary that the tables on which im performing an inner join should have a parent-child/children relationship or is it enough that the tables just have a common field.
    2.  Also is it necessary that the master table should come first, (or can i use any child table from where i can fetch the records when there is a mater table in my report) as shown below.
    Eg: select * <fields> from <master table> inner join <table> on <field> into <itab>.
    Edited by: Narayananchandran on Dec 27, 2010 12:31 PM

    have two clarifications based on the above points.
    1. Is it necessary that the tables on which im performing an inner join should have a parent-child/children relationship or is it enough that the tables just have a common field.
    2. Also is it necessary that the master table should come first, (or can i use any child table from where i can fetch the records when there is a mater table in my report) as shown below.
    Eg: select * <fields> from <master table> inner join <table> on <field> into <itab>
    1) NO
                      2) NO

  • Poor performance reading MBEWH table

    Hi,
    I'm getting serious performance problems when reading MBEWH table directly.
    I did the following tests:
      GET RUN TIME FIELD t1.
      SELECT mara~matnr
        FROM mara
        INNER JOIN mbewh ON mbewh~matnr = mara~matnr
        INTO TABLE gt_mbewh
        WHERE mbewh~lfgja = '2009'.
      GET RUN TIME FIELD t2.
      GET RUN TIME FIELD t3.
      SELECT mbewh~matnr
        FROM mbewh
        INTO TABLE gt_mbewh
        WHERE mbewh~lfgja = '2009'.
      GET RUN TIME FIELD t4.
    t2 = t2 - t1.
    t4 = t4 - t3.
    write: 'With join: ', t2.
    write /.
    write: 'Without join: ', t4.
    And as result I got:
    With join:      27.166
    Without join:  103970.297
    All MATNR in MBEWH are in MARA.
    MBEWH has 71.745 records and MARA has 705 records.
    I created an index for lfgja field in MBEWH.
    Why I have better performance using inner join?
    In production client, MBEW has 68 million records, so any selection takes too much time.
    Thanks in advance,
    Frisoni

    Guilherme, Hermann, Siegfried,
    I have just seen this thread and read it from top to bottom, and I would say now is a good time to make a summary..
    This is want I got from Guilherme's comments:
    1) MBEWH has 71.745 records
    2) There are two hidden clients in the same server with 50 million rocords.
    3) Count Distinct mandt = 6
    4) In production client, MBEW has 68 million records
    First measurement
    With join               : 27.166
    Without join            :  103970.297
    Second measurement
    With join               : 96.217
    Without join            : 93.781            << now with hint
    The original question was to understand why using the JOIN made the query much faster.
    So the conclusions are:
    1) Execution times are really now much better (comparing only the not using join case, which is the one we are working on), and the original "mystery" is gone
    2) In this client, MANDT is actually much more selective that the optimizer thinks it is (and it's because of this uneven distrubution, as Hermann mentioned, that forcing the index made such a difference)
    4) Bad news is that this solution was good because of the special case of your development system, but will probably not help in the production system
    5) I suppose the index that Hermann suggested is the best possible thing to do (the table won't be read, assuming you really only want only MATNR from MBEWH, and that it wasn't a simplification for illustration purposes); anyway, noone can really expect that getting all entries from MBEWH for a given year will be a fast thing...
    Rui Dantas

  • Logic  req. using innerjoin for vendor

    plz help  me,
    tell me req . select statements useing innorjoins.give me logic.
    tables:
    MARA, MARC, MARD, MAKT, MAPF, MSEG, LFA1
    input fields:
    The end user will select a list of materials and vendors within a date range.
    output fields:
    The report should display   vendor name,
                                           actual Creation Date,
                                           payment terms
                                           prices,
                                           Material Number,
                                          Storage Location,
                                          Unit of Measure,
                                          description ,
                                          group totals.
    thank you,
    venki

    hi ,
    here is a simple inner join see this ..but inner jions is not good at performance..
    report test .
    tables: pa0002,pa0008,pa0021.
    data: begin of it_pa0002 occurs 0,
          pernr like pa0002-pernr,
          begda like pa0002-begda,
          endda like pa0002-endda,
          vorna like pa0002-vorna,
          nachn like pa0002-nachn,
          end of it_pa0002.
    data: begin of it_pa0008 occurs 0,
          pernr like pa0008-pernr,
          ansal like pa0008-ansal,
          lga01 like pa0008-lga01,
          bet01 like pa0008-bet01,
          end of it_pa0008.
    data: begin of it_pa0021 occurs 0,
          pernr like pa0021-pernr,
          famsa like pa0021-famsa,
          fanam like pa0021-fanam,
          favor like pa0021-favor,
          end of it_pa0021.
    data: begin of it_final occurs 0,
          pernr like pa0002-pernr,
          begda like pa0002-begda,
          endda like pa0002-endda,
          vorna like pa0002-vorna,
          nachn like pa0002-nachn,
          ansal like pa0008-ansal,
          lga01 like pa0008-lga01,
          bet01 like pa0008-bet01,
          famsa like pa0021-famsa,
          fanam like pa0021-fanam,
          favor like pa0021-favor,
          end of it_final .
    select-options:s_pernr for pa0002-pernr.
    select a~pernr
           a~begda
           a~endda
           a~vorna
           a~nachn
           b~ansal
           b~lga01
           b~bet01
           c~famsa
           c~fanam
           c~favor
           from  ( ( pa0002 as a inner join pa0008 as b  on apernr = bpernr )
           inner join pa0021 as c  on apernr = cpernr and bpernr = cpernr )
           into table it_final
           where a~pernr in s_pernr.
    sort it_final by pernr begda descending.
    loop at it_final.
    write:/ it_final-pernr,
    it_final-begda,
    it_final-endda,
    it_final-vorna,
    it_final-nachn,
    it_final-ansal,
    it_final-lga01,
    it_final-bet01,
    it_final-famsa,
    it_final-fanam,
    it_final-favor.
    endloop.
    regards.
    venkat.

  • InfoSet modelling - Link Maintenance between tables

    Hi
    I want to create an infoset between 2 DSO objects, we are using BI 7, and I am following the help from
    http://help.sap.com/saphelp_nw70/helpdata/EN/b1/713c3b35703079e10000000a114084/frameset.htm
    I have a couple of very simple questions
    This is what I have done so far
    In the AWB on the Modelling Tab, I have right clicked on the infoArea and selected the u201CCreate InfoSetu201D   then given a technical name etc and selected the 1st DSO
    Then I selected the u201CAdd infoprovideru201D icon and entered the technical name of the 2nd DSO.
    On Step 4 (of the above help link) I am not able to see the Link Maintenance Option or to define a link using a mouse.  Can someone please walk me through how we will go from here? i.e. where to find this option etc and if any help or how to guidesu2026
    Basically I need to make this infoset and perform an inner join on 4 info Objects common between the two DSOs.  Please walk me through the procedure and I will say thanks the SDN way.
    Regards
    Jack

    Basically the question was a simple one and I figured out the answer so I am posting it for future reference by someone else in the same situation...
    The Display mode was the problem here, i.e. the 1st time I tried to create the infoset I was asked about which display mode I wanted to use..
    InfoSet Maintenance Can Be Done in the Network (Data Flow Control) or in the Tree (Tree Control)
    While the Network Display Is Clearer, the Tree Display for ScreenReader is Readable and Thus More Suitable for the Visually Impaired..
    I was using the Hierarchy Display and hence could not see the Link maintenance Icon or use the Drag and Drop with a mouse functionality...
    To change the display mode, Right Click on the infoSet, Select Change and then on the Top of the screen menues, go to Settings and Choose Display... Here change the display to Data Flow control...   Go out of the maintenance screen and come back in and   Bobs your uncle

  • Oracle OUTER JOIN on more than one table

    Hi!
    Friends, please help with this urgent problem: How can an outer join be written on more than one table?
    An SQL Server query:
    SELECT * from a INNER JOIN b on a.id = b.id LEFT OUTER JOIN c ON c.id = a.id AND c.id = b.id
    works fine with SQL SERVER
    But Oracle query:
    SELECT * from a,b,c WHERE a.id = b.id AND a.id = c.id (+) AND b.id = c.id (+)
    gives an error: OUTER JOIN cannot be used on more than one table? Why?
    I use OracleDriver from classes12.zip to connect to Oracle8i database.
    Please, help!

    The Oracle 8i and later SQL reference reads that the following "join_types" are supported and under this syntax it does not limit the LEFT OUTER JOIN (syntax the same as SQLServer example in original note) to two tables as implied in these notes:
    The join_type indicates the kind of join being performed:
    Specify INNER to indicate explicitly that an inner join is being performed. This is the default.
    Specify RIGHT to indicate a right outer join.
    Specify LEFT to indicate a left outer join.
    Specify FULL to indicate a full or two-sided outer join. In addition to the inner join, rows from both tables that have not been returned in the result of the inner join will be preserved and extended with nulls.
    You can specify the optional OUTER keyword following RIGHT, LEFT, or FULL to explicitly clarify that an outer join is being performed.

  • Alv grid and pop up

    This program is an example with a Grid list and a Popup list   
    The Sales Orders are displayed in the first list  .
    When a line is selected, the items of the order are displayed in  a popup list

    For the given selection parameters.select all the sales order fields(listed in report fields section) from VBAP      by performing an inner join on VBAK where the sales order date and number match and the material group is equal to IM01 or IM02  or IM03 or IM04  or IM05  into an internal table A.
    For the above slected sales order get the purchase requisition (BANFN)  and purchase order type (BSART) from table VBEP into another internal table B loop through  the sales order internal table A.
    Read internal  table B.  If sy-subrc = 0 ,then select EBELN (purchase order number) from EBAN using purchase order requisition line item,item number of purchase  requisition  and purchase order  number is not initial.If there is a purchase order number,then delete the sales order line from the internal table else move  the purchase requisition number for each of the sales  order number into internal table A.
    Provide an ALV sort by sales order number and line item.
    Display the output in ALV grid by using  the FM REUSE_ALV_GRID_DISPLAY.
    Provide menu lists for display ,sorting,select/deselect functionalities.
    Note:     check the standard report VA05 as an example for creating the output for this custom  report.
    For       ALV variant use the FM_REUSE_ALV_VARIANT_F4 and REUSE_ALV_VARIANT_DEFAULT_GET to allow the user to save the variant and select it for displaying output.If   any of the data (Z fields in VBAP) is blank,the cell in the column must be highlighted in red.
    NAME      Table/check box/radio button     Selection option/parameter      comments     Default value
    S_DATE     VBAK-ERDAT     S     Sales order creation date     Current date
    S_VBELN     VABAK-VBELN     S     Saled order/orders     
    P_ALVVAR     DISVARIANT-VARAIANT     P          
    Report field label     Sap table     Sap field name     Field calculation     comments
    Sales order number     VBAP     VBELN          
    Line item     VBAP     POSNR          
    Created by     VBAP     ERNAM          
    Material master     VBAP     MATNR          
    description     VBAP     ARKTX          
    Material group     VBAP     MATKL

Maybe you are looking for

  • T440s - Rapid Startup and Windows 8.1 ?

    Hi, is it possible to have Rapid Startup on Windows 8 on T440s ? I havn´t tested it before, but maybe someone could explain best pratice how to deploy Win8 on T440s. Thanks, Magnus

  • In which table does the Manage Rejection data is stored

    Hi All, I need some information regarding Manage Rejection. In which table is Rejected users data is stored. Actually what I am looking for is to look at the comments of all the rejected users by the reviewers. Currently I need to go into each and ev

  • Problems installing windows xp !! help please

    when setup stops and asks "to set up windows xp press enter " the next screen says"setup did not find any hard disk drives installed in your computer" setup cannot continue! ive checked and done all i can think to do now for 3 days! my hard drive sho

  • AlertView in landscape mode

    I have an app in landscape mode - when I display an alertview - it shows up in portrait mode - how can I get it to display in landscape mode?

  • I book g4 av cable

    Hi... I bought an av cable last week! but since the time I have got it, I just cant figure out how to plug it from my computer so that I get an output on my tv! Please let me know if I need some kind of an adaptor... or would it just work by itself?