<?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 issue with select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581421#M1860255</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;Do not use &lt;STRONG&gt;WHILE----ENDWHILE&lt;/STRONG&gt; Instead you can use &lt;STRONG&gt;IF---ENDIF&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHILE--ENDWHILE will be an endless loop if the query executed successfully and fetch some records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nooruddin Bohra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Sep 2014 08:26:36 GMT</pubDate>
    <dc:creator>NooruBohra</dc:creator>
    <dc:date>2014-09-03T08:26:36Z</dc:date>
    <item>
      <title>Performance issue with select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581418#M1860252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a select statement with inner join and for all entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg : it_data has 50,000 records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a~field1 a~field2 a~field3 a~field4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b~field1 b~field2 b~field3 into table it_temp &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from Zxxxxx as a inner join Zyyyyyy as b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on a~field1 eq b~field1&lt;/P&gt;&lt;P&gt; for all entries in it_data where a~field1 in s_field1&lt;/P&gt;&lt;P&gt;and a~field2 in s_field2 and b~field3 = it_data-field5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endwhile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: Zxxxxx has 10000 records and Zyyyyyy has 4000 records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Problem &lt;/SPAN&gt;: taking long time for execution. its a performance issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3doubts: 1) Can I use for all entries with inner joins with huge data.&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; 2) I want to replace for all entries with Ranges..............with huge data...............is it work.&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; 3) What about While.....endwhile loop............?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Suggest me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2014 18:08:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581418#M1860252</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-09-02T18:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue with select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581419#M1860253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;where do the 50000 entries in your itab come from? Most likely also a select statement.&lt;/P&gt;&lt;P&gt;if this is the case why don't you try to use a join of the three tables involved instead of the join together with for all entries?&lt;/P&gt;&lt;P&gt;Christian &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2014 19:02:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581419#M1860253</guid>
      <dc:creator>ceedee666</dc:creator>
      <dc:date>2014-09-02T19:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue with select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581420#M1860254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nagireddy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I think if you are using table keys for &lt;SPAN style="color: #333333; font-size: 12px;"&gt;Zxxxxx and Zyyyyyy, it's ok.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. You can insert 50,000 in a range. the limit of the database is approximately 5,000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. I do not understand to make a selection within a loop. also if the select returns data you enter an infinite loop. As I see that's the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;Genaro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Sep 2014 22:32:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581420#M1860254</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-09-02T22:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue with select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581421#M1860255</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;Do not use &lt;STRONG&gt;WHILE----ENDWHILE&lt;/STRONG&gt; Instead you can use &lt;STRONG&gt;IF---ENDIF&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHILE--ENDWHILE will be an endless loop if the query executed successfully and fetch some records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nooruddin Bohra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2014 08:26:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581421#M1860255</guid>
      <dc:creator>NooruBohra</dc:creator>
      <dc:date>2014-09-03T08:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue with select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581422#M1860256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No idea why you have this WHILE statement here!?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2014 08:34:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581422#M1860256</guid>
      <dc:creator>former_member201275</dc:creator>
      <dc:date>2014-09-03T08:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue with select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581423#M1860257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;SPAN class="j-post-author"&gt;Nagireddy.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;Have you tried tracing your SELECT statement in ST05? You haven't specified the structure of your tables, probably you are not using key fields or index fields of your Z tables.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;Concerning your questions:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;1. If you are joining tables using key fields, it's ok. But you can try joining to Zxxxxx table instead of using FOR ALL ENTRIES construction as Christian suggested.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;2. Replacing FAE with Range is not a good idea in case there are many records in it_data (and you mentioned that it may have 50 000 entries, it's quite enough to get a dump in the above query). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;3. I didn't get what was the need in WHILE/ENDWHILE loop.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;And one more suggestion: table Zyyyyyy has 4 000 records, it_data may have 50 000 entries. In case you are using key fields in SELECT statement, have you tried sorting it_data by field5 and removing adjacent duplicates comparing field5 from it_data before the SELECT? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="j-post-author"&gt;P.S. I didn't mention compulsory check that it_data is not initial, hoping it has been done before the SELECT.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2014 08:45:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581423#M1860257</guid>
      <dc:creator>nikolayevstigneev</dc:creator>
      <dc:date>2014-09-03T08:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue with select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581424#M1860258</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;First check the secondary Indexes of the tables if the index is not there create secondary index and try.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i suggest with for all entries using in inner join better to avoid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2014 09:40:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581424#M1860258</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-09-03T09:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue with select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581425#M1860259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It will&amp;nbsp; definitely have a performance issue: IT WILL RUN FOREVER !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHILE .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDWHILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and no exit condition. If your select has a result it will continue to do the same select over and over again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can call that a performance problem, I would call it different, but I will not mention it on this forum.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Sep 2014 12:26:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-with-select-statement/m-p/10581425#M1860259</guid>
      <dc:creator>PeterJonker</dc:creator>
      <dc:date>2014-09-03T12:26:41Z</dc:date>
    </item>
  </channel>
</rss>

