<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: performance multiple joins in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893801#M373747</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a solution to these joins. Fetch data separately into all tables instead of using a join to fetch data. Then, compile data from these different tables into one table by using LOOP and READ statements. We had similar kind of problem in one of the projects. We avoided using 9 joins by using LOOP and READ statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, FOR ALL ENTRIES gives much better performance than a JOIN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if the answer is helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagrds,&lt;/P&gt;&lt;P&gt;Mukul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 14 Jan 2007 13:23:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-01-14T13:23:26Z</dc:date>
    <item>
      <title>performance multiple joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893800#M373746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;we use multiple joins to extract data from certain tables. But because of the large amount of data and the number of tables the performance is bad. Is it possible to improve the performance. I've read that FOR ALL ENTRIES and database views are used to improve the performance, but does this also work with this kind of join?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select fkkvkp&lt;SUB&gt;gpart fkkvkp&lt;/SUB&gt;vkont ever&lt;SUB&gt;vertrag ever&lt;/SUB&gt;abrsperr  &lt;/P&gt;&lt;P&gt;         ever&lt;SUB&gt;einzdat ever&lt;/SUB&gt;auszdat&lt;/P&gt;&lt;P&gt;into table lt_data&lt;/P&gt;&lt;P&gt;from fkkvkp&lt;/P&gt;&lt;P&gt;join ever&lt;/P&gt;&lt;P&gt;    on fkkvkp&lt;SUB&gt;vkont = ever&lt;/SUB&gt;vkonto&lt;/P&gt;&lt;P&gt;join eanlh&lt;/P&gt;&lt;P&gt;    on eanlh&lt;SUB&gt;anlage = ever&lt;/SUB&gt;anlage&lt;/P&gt;&lt;P&gt;join eanl&lt;/P&gt;&lt;P&gt;    on eanl&lt;SUB&gt;anlage = eanlh&lt;/SUB&gt;anlage&lt;/P&gt;&lt;P&gt;join evbs&lt;/P&gt;&lt;P&gt;    on eanl&lt;SUB&gt;vstelle = evbs&lt;/SUB&gt;vstelle&lt;/P&gt;&lt;P&gt;join iflot&lt;/P&gt;&lt;P&gt;    on evbs&lt;SUB&gt;haus    = iflot&lt;/SUB&gt;tplnr&lt;/P&gt;&lt;P&gt;join iloa&lt;/P&gt;&lt;P&gt;    on iflot&lt;SUB&gt;iloan  = iloa&lt;/SUB&gt;iloan&lt;/P&gt;&lt;P&gt;join adrc&lt;/P&gt;&lt;P&gt;    on iloa&lt;SUB&gt;adrnr   = adrc&lt;/SUB&gt;addrnumber&lt;/P&gt;&lt;P&gt;where fkkvkp~vkont in so_vkont&lt;/P&gt;&lt;P&gt;         and adrc~post_code1 in so_postc&lt;/P&gt;&lt;P&gt;         and  ever~vertrag in so_vert&lt;/P&gt;&lt;P&gt;         and eanlh~tariftyp in so_type&lt;/P&gt;&lt;P&gt;         and eanlh~bis &amp;gt;= sy-datum&lt;/P&gt;&lt;P&gt;         and eanlh~ab &amp;lt;= sy-datum.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Jan 2007 11:37:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893800#M373746</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-14T11:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: performance multiple joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893801#M373747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a solution to these joins. Fetch data separately into all tables instead of using a join to fetch data. Then, compile data from these different tables into one table by using LOOP and READ statements. We had similar kind of problem in one of the projects. We avoided using 9 joins by using LOOP and READ statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, FOR ALL ENTRIES gives much better performance than a JOIN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if the answer is helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reagrds,&lt;/P&gt;&lt;P&gt;Mukul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Jan 2007 13:23:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893801#M373747</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-14T13:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: performance multiple joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893802#M373748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi pieter,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Joins always affect performance.  You should always make use of FOR ALL ENTRIES.  This is an efficient way of selection, rather than using joins.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to make use of FOR ALL ENTRIES, identify al the keys in differnt tables, and check which of these key fields occur in more than one table (which is being used).  Then it can be easily merged using the FOR ALL ENTRIES stmt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PLZ REWARD POINTS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Jan 2007 14:44:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893802#M373748</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-14T14:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: performance multiple joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893803#M373749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've done some work on this in the past. What I found was that in general, JOINs outperform FOR ALL ENTRIES. But this is not always the case. Sometimes the reverse happens and I'm not able to determine precisely why or under what circumstances. If you're really concerned about which is better, you should code both ways and take the best (remembering to allow for buffering).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the gain is not that much in either case (maybe a factor of two.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having said all of the above, the most important thing to take care of is to make sure you are using as many key fields as possible in both JOINs and WHERE clauses. I'm not on R3 right now, but I doubt if post_code1 is a key field of adrc. You might try taking that out of the WHERE and check it after the SELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I discuss some of this in a BLOG:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/rob.burbank/blog/2006/11/16/performance--what-will-kill-you-and-what-will-leave-you-with-only-a-flesh-wound&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2007 02:38:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893803#M373749</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-15T02:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: performance multiple joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893804#M373750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u do like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first  compare two table and comment remaining tables and check which table is  taking more time and detach that table from the JOIN and use the for all entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have done like this and improved the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Especially for your case it is better to use the JOIN.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you lot &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2007 04:12:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893804#M373750</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-15T04:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: performance multiple joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893805#M373751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Its advisable not to use JOINS for more than 2 or 3 tables. 2 tables itself would reduce the performance.&lt;/P&gt;&lt;P&gt;Instead, use for all entries and you can sort the table and use the Read..table to read the entries.&lt;/P&gt;&lt;P&gt;If you are using FOR ALL ENTRIES and need to exclude some entries, then instead of using the Negative stmts like &amp;lt;&amp;gt;, &amp;gt;=, &amp;lt;= , select all entries and then you can delete the entries which do not match your criteria from the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This also improves performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Subramanian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2007 04:35:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893805#M373751</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-15T04:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: performance multiple joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893806#M373752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tested the "for all entries" statement and it seems that it's no improvement for my case. Maybe a mix of joins and all entries will work, but I hadn't have time to test it yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Mukul R. Kulkarni: The tables you use to select your data in, i suppose they are hashed tables? Otherwise the read will be sequential and the performance will not improve. Correct me if I'm wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards Pieter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jan 2007 09:58:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893806#M373752</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-01-15T09:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: performance multiple joins</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893807#M373753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Pieter,&lt;/P&gt;&lt;P&gt;when going for performance optimization it is hard to judge from distance. It depends on technical settings, dbms used and the usage profile. So there are only some general hints:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- The application server uses a own table buffering logic. These bufferng can be enabled by according attributes of db tables. It is one of the most effective way of performance tuning but only if - no joíns/views and no distinct is used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Joins heavily depend on the availibility of fitting database indicies. Despite the pure availibility most DBMS have an optimizer to compute a so called query plan. The query plan determine the use and order of the db index. Sometimes the 'optimized' query plan is not that good. So it might be a good idea to check the query plan with the help of  TA ST05. In case that the default query plan is not perfect you need to use DB Hints which are specific with the various db vendors, it can not be influenced that detailed by ABAP statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Beside this a new balancing between for using AS buffering (FOR ALL ENTRIES) and a limited use of JOIN should also be checked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Klaus&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jan 2007 11:53:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-multiple-joins/m-p/1893807#M373753</guid>
      <dc:creator>former_member183804</dc:creator>
      <dc:date>2007-01-16T11:53:53Z</dc:date>
    </item>
  </channel>
</rss>

