<?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: LOOP AT vs INNER JOIN in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664954#M1667967</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"In the case of for all entries/loop the first two parts need to be done in the same way". &lt;/P&gt;&lt;P&gt;I'm sorry, but it's not "in the same way". If you are doing a non-index search on the second table, retrieving the second table can be extremely time consuming. And I'm not saying it's more efficient, quite the opposite. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Mar 2012 17:20:25 GMT</pubDate>
    <dc:creator>joao_sousa2</dc:creator>
    <dc:date>2012-03-27T17:20:25Z</dc:date>
    <item>
      <title>LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664936#M1667949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone.&lt;/P&gt;&lt;P&gt;I have been searching for hours in google about this question, but I have not found anything strictly related to this issue.&lt;/P&gt;&lt;P&gt;The programmers in my company uses "LOOP AT table_a" to match records in "Table_b", is better to use INNER JOIN to this proposes? why?&lt;/P&gt;&lt;P&gt;I think the INNER JOIN was made to match criteria at low level machine language, what represents an excellent performance, and LOOP AT was to made to print information, but I'm not much sure about this.&lt;/P&gt;&lt;P&gt;I appreciate your help, thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 22:31:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664936#M1667949</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-03-23T22:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664937#M1667950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;the main problem I see with an INNER JOIN is that you need an extra structure to hold the sum of the fields of both tables. At times the data&amp;nbsp; in table_b has been loaded from the database&amp;nbsp; already so it wouldn't make sense to hit the database again. Then there is the cases where you look up table_b to check whether a record doesn't exist. Then there is the case where you have an function module that selects the data from the database but it's missing the description to the value of one field. In that case I'd load the descriptions separately and read them during a LOOP AT if needed.&lt;/P&gt;&lt;P&gt;On the other hand there are definitely use cases where and inner join, or better yet a view on the 2 database tables makes more sense. As always it is a matter context what makes more sense.&lt;/P&gt;&lt;P&gt;I usually try to use standard SAP function modules or methods to retrieve data from standard tables and then work with 2 internal tables, instead of creating a view or join on database tables that might change during patching and mess up my code.&lt;/P&gt;&lt;P&gt;Cheers&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Adi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 23:07:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664937#M1667950</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-03-23T23:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664938#M1667951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ivan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Try reading through this thread I started years go for some background information - &lt;/SPAN&gt;&lt;A class="jive-link-thread-small" data-containerid="2017" data-containertype="14" data-objectid="919187" data-objecttype="1" href="http://scn.sap.com/thread/919187"&gt;http://scn.sap.com/thread/919187&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I came to the conclusion that newer ABAP developers were favouring FOR ALL ENTRIES but none of them really knew why. It's good to see someone questioning this approach. I still maintain that an INNER JOIN is better in almost all scenarios, you just have to know how to write efficient SQL. &lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES has the small benefit of making the code slightly easier to understand sometimes which may help with maintenance - I would argue that we should be up skilling our ABAP developers rather than dumbing down our code though.&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Gareth.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Mar 2012 09:25:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664938#M1667951</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-03-24T09:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664939#M1667952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For performance critical sections, I tend to do both and use whichever is faster. It isn't always obvious in advance which that is going to be. It is entirely likely that my SQL skills are the reason why sometimes a join is unexpectedly slower. In some cases, though, the join really &lt;EM&gt;is&lt;/EM&gt; slower.&lt;/P&gt;&lt;P&gt;In cases where performance isn't an issue, I'd argue for using whichever method produces the most understandable code. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 10:39:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664939#M1667952</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-03-26T10:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664940#M1667953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In most cases JOIN is faster, because we don't need the network traffic (for each select single), especially if you have different appl/db servers. Rule of thumb: "let do the DB all the work"&lt;/P&gt;&lt;P&gt;And btw: there is a third option:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;SELECT * FROM SFLIGHT AS F INTO SFLIGHT_WA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE SEATSOCC &amp;lt; F~SEATSMAX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND EXISTS ( SELECT * FROM SPFLI&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE CARRID = F~CARRID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND CONNID = F~CONNID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND CITYFROM = 'FRANKFURT'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND CITYTO = 'NEW YORK' )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND FLDATE BETWEEN '19990101' AND '19990331'.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Best regards&lt;BR /&gt;&lt;A __default_attr="173998" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://community.sap.com/"&gt;&lt;/A&gt;&lt;SPAN&gt; (@se38)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 10:54:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664940#M1667953</guid>
      <dc:creator>UweFetzer_se38</dc:creator>
      <dc:date>2012-03-26T10:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664941#M1667954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is an endless discussion, I cones up at least once every second week in this forum and it was always answered.&lt;/P&gt;&lt;P&gt;+ Try a join if you need information from 2 or more tables.&lt;/P&gt;&lt;P&gt;+ Use FOR ALL ENTRIES if one internal table was created or selected at an earlier point in the programs execution and later additional data mus be read from another DB table. Use the nested loops to combine to 2 result tables and be ware that you must use an optimized READ or LOOP for the inner operation of the nested loop, i.e. sorted or hashed table or BINARY SEARCH.&lt;/P&gt;&lt;P&gt;* Do not use nested SELECTs or SELECTs inside LOOPs (exception: SELECT used single-record table buffer)&lt;/P&gt;&lt;P&gt;Using a FOR ALL NTRIES to replace a join is NOT recommended. It can make sense, if the join becomes very large, many tables with conditions which do not use primary keys. Then the DB optimizer can become confused. But then you will also have to invest some time for the optimization.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Be aware, that the JOIN can be flexible to some extent, if the WHERE-clause varies a lot, then the DB optimizer can choose differend access pathes, for example different order of table accesses.&lt;/P&gt;&lt;P&gt;Note, the above mentioned SUBSELECT is very special, it can not replace all joins. However, if applicable then it can be even faster than the join. Again everything is done inside the DB.&lt;/P&gt;&lt;P&gt;Background: The Join does more inside the DB and trys to avoid unnecessary data transfers and accesses.&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 11:35:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664941#M1667954</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-03-26T11:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664942#M1667955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ivan,&lt;/P&gt;&lt;P&gt;It all depends on the context you are using both the approaches.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Making use of Join:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If you want to read logically related information from tables then it is advisable to use the JOIN over Nested SELECTs.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Making use of Nested LOOP:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If you want to optimize the performance of nested LOOP then you may go for Parallel Cursor.&lt;/P&gt;&lt;P&gt;As i mentioned above the best approach depends on the requirement and the context where it is being implemented in ABAP Code.&lt;/P&gt;&lt;P&gt;You can use the Runtime analysis and compare the performance.&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Abdul Hakim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 12:59:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664942#M1667955</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2012-03-26T12:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664943#M1667956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please do not recommend parallel cursor anymore.&lt;/P&gt;&lt;P&gt;It is possible to use parallel index with internal tables, but it is cumbersome and cann easily lead to functional bugs and is not necessary if you use an optimized inner access =&amp;gt; sorted table, read my blogs on internal tables.&lt;/P&gt;&lt;P&gt;it is also possible to use parallel cursors on the database but this should also not done out of performance reasons but only if you need the OPEN CURSOr with HOLD (was also explained lots of times).&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 13:05:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664943#M1667956</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-03-26T13:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664944#M1667957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone, thanks for your answers.&lt;/P&gt;&lt;P&gt;I'm just trying to RETURN RELATED ROWS WHEN THERE IS A MATCH IN BOTH TABLES ONLY, in whatever SQL Language (Microsoft SQL Server, Oracle, MySQL, etc) it's advised the INNER JOIN for this proposes, but the company where I am working at, ABAP programmers uses to write a LOOP, what I think it's wrong, adding this takes 1 hour to return related rows, there are a lot of bad practices else in the company and I want to expose all of them, but I need strong arguments to explain it. Actually, I am a C# - Oracle developer, and I like the best practices even if I have to spent time to learn about them and to apply them. I have learned ABAP, I understand clearly its syntax, but I think, for this simple case, it's wrong use LOOP instead INNER JOIN.&lt;/P&gt;&lt;P&gt;Thank you for your help&lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/5.0.1/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 13:47:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664944#M1667957</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-03-26T13:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664945#M1667958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Siegfried,&lt;/P&gt;&lt;P&gt;I have used Parallel cursors on many occasions and it has helped me in improving the performance when compared over nested LOOPs. &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" src="https://community.sap.com/5.0.1/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Abdul Hakim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 13:59:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664945#M1667958</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2012-03-26T13:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664946#M1667959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@abdul,&lt;/P&gt;&lt;P&gt;yes, because you did use a standard table in the nested loop. The performance gain over a key access to a sorted table is marginal, it might be lost because you need to sort both tables for parallel cursor.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 14:18:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664946#M1667959</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-03-26T14:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664947#M1667960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Siegfried, Yes i have used standard tables and the performane gain was marginal. So for no issues. Things are going well. I have read your blogs about performance tuning and they are really excellent. Keep up the good work.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Abdul Hakim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 14:26:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664947#M1667960</guid>
      <dc:creator>abdul_hakim</dc:creator>
      <dc:date>2012-03-26T14:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664948#M1667961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ivan,&lt;/P&gt;&lt;P&gt;or should i say Don Quijote? (since i think you have a loooong fight)&lt;/P&gt;&lt;P&gt;Write small examples that prove your points (e.g. join vs. loop and selects). Ask&lt;/P&gt;&lt;P&gt;them to prove their points / practises (with examples). Slowly and surely you might&lt;/P&gt;&lt;P&gt;be able to convince them. Oh and never mind... some people simply can't be convinced&lt;/P&gt;&lt;P&gt;they simply don't want to change something or learn something new.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 20:09:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664948#M1667961</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2012-03-26T20:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664949#M1667962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Hermann, it's very funny your analogue with Don Quijote hahahaha, perfect to me I say because you right, people don't want to change them mind.&lt;/P&gt;&lt;P&gt;I think it has not been clear the fact INNER JOIN is better than LOOP AT for return rows where there is a match in two tables.... a lot of people has talk about parallel cursors, performance tips, etc.... but, just for this strictly case, very few post are useful to answer my question, I don't want anything else than know its low level behavior, which is better for a simple SELECT.&lt;/P&gt;&lt;P&gt;Thank you Hermann.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 20:28:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664949#M1667962</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-03-26T20:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664950#M1667963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i think the best thing is to write a small test porgram and prove your points. You can use DD02L (tables) and DD03L (fields) for that, these tables are available everywhere.&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Hermann&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 20:38:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664950#M1667963</guid>
      <dc:creator>HermannGahm</dc:creator>
      <dc:date>2012-03-26T20:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664951#M1667964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Database engines are optimized for this kind of operation so anyone will tell you that it's more efficient to use the inner join. There are two problems with the inner join which are not really performance related (well sort of): &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Inner join makes you create an specific structure and you have to map the fields you really want. ABAPers are lazy (full disclosure, I'm also guilty), so it's much more comfortable to write select * into table X, where X type standard table of Y. This is bad memory wise, but hey, deadlines are deadlines &lt;SPAN __jive_emoticon_name="wink" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/5.0.1/images/emoticons/wink.gif"&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;You can have 50 application servers, but only one database server. The inner join may have superior performance, but if you have a application server dedicated to data crunching it doesn't really matter. The database is being shared, the application server is yours. This is very special situation, and makes little sense from a landscape point of view, but in the end the ABAPer doesn't control the landscape he has to work with what he's been given. &lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 20:42:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664951#M1667964</guid>
      <dc:creator>joao_sousa2</dc:creator>
      <dc:date>2012-03-26T20:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664952#M1667965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;Joao Sousa wrote:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;You can have 50 application servers, but only one database server. The inner join may have superior performance, but if you have a application server dedicated to data crunching it doesn't really matter. The database is being shared, the application server is yours. This is very special situation, and makes little sense from a landscape point of view, but in the end the ABAPer doesn't control the landscape he has to work with what he's been given. &lt;/LI&gt;&lt;/UL&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hello Joao,&lt;/P&gt;&lt;P&gt;the second point is not that much relevant actually. In the JOIN the database needs to do the following:&lt;/P&gt;&lt;P&gt;- read blocks for the first table+index from disk (time!) and buffer;&lt;/P&gt;&lt;P&gt;- loop over the records in these blocks and read relevant blocks for the second table+index from disk (time!) and buffer;&lt;/P&gt;&lt;P&gt;- combine the result set and retrieve it back.&lt;/P&gt;&lt;P&gt;In the case of for all entries/loop the first two parts need to be done in the same way, but you'll have more overhead from transferring data to the application server and back. More records will be moved over the network. Actually combining the result is not that critical to move it form DB to the app server.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;&amp;nbsp; Yuri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 04:38:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664952#M1667965</guid>
      <dc:creator>yuri_ziryukin</dc:creator>
      <dc:date>2012-03-27T04:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664953#M1667966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;... Ivan maybe you should read the answers again, the answers which you defined useful, are wrong or misleading ... the others are the good ones. &lt;/P&gt;&lt;P&gt;Application server versus database server is completely misleading, the FOR ALL ENTRIES is slower on the database, the join is the fastest even on the database! The ABAP time is orders faster if done correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 08:17:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664953#M1667966</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-03-27T08:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664954#M1667967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"In the case of for all entries/loop the first two parts need to be done in the same way". &lt;/P&gt;&lt;P&gt;I'm sorry, but it's not "in the same way". If you are doing a non-index search on the second table, retrieving the second table can be extremely time consuming. And I'm not saying it's more efficient, quite the opposite. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 17:20:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664954#M1667967</guid>
      <dc:creator>joao_sousa2</dc:creator>
      <dc:date>2012-03-27T17:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: LOOP AT vs INNER JOIN</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664955#M1667968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I made it quite clear that the "solutions" I posted were NOT the most eficient, and just tried to explain the psychology behind ABAPer choice. &lt;/P&gt;&lt;P&gt;Sometimes its interesting to understand your ABAPers and their choices, beyond the technical performance issues. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 17:52:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-at-vs-inner-join/m-p/8664955#M1667968</guid>
      <dc:creator>joao_sousa2</dc:creator>
      <dc:date>2012-03-27T17:52:37Z</dc:date>
    </item>
  </channel>
</rss>

