<?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: SELECT Performance problem with IN, GE, LE condition in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964047#M1800121</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've change the code to use INDEX when selecting and filter the rest data in the Application Server by manipulating the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also changed from FOR ALL ENTRIES to ranges again but now I limit the maximum number of ranges that will be processed at once.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Suwandi C.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Jan 2014 13:29:23 GMT</pubDate>
    <dc:creator>suwandi_cahyadi</dc:creator>
    <dc:date>2014-01-09T13:29:23Z</dc:date>
    <item>
      <title>SELECT Performance problem with IN, GE, LE condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964042#M1800116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;FROM wrf_matgrp_sku&lt;/P&gt;&lt;P&gt;WHERE matnr IN r_matnr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND date_from &amp;lt;= sy-datum&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND date_to &amp;gt;= sy-datum&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;r_matnr contains approximately 37k or records. With that statement, I get a shortdump saying &lt;EM&gt;DBIF_RSQL_INVALID_RSQL. &lt;/EM&gt;This, I found because that the r_matnr contains too many records than I change from using a range table to an internal table like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;FROM wrf_matgrp_sku&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_matnr&lt;/P&gt;&lt;P&gt;WHERE matnr = it_matnr-matnr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND &lt;SPAN style="font-size: 10pt;"&gt;date_from &amp;lt;= sy-datum&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND date_to &amp;gt;= sy-datum&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the new statement I get no shortdump but a performance issue. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is that, is there anything I can do to solve the performance issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm thinking of using the parallel processing and also taking out the date_from and date_to conditions from the SELECT statement then filter out the data by deleting them from the internal table. Will this help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Suwandi C.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jan 2014 13:06:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964042#M1800116</guid>
      <dc:creator>suwandi_cahyadi</dc:creator>
      <dc:date>2014-01-02T13:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT Performance problem with IN, GE, LE condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964043#M1800117</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;&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;SELECT *&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;FROM wrf_matgrp_sku&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;WHERE matnr IN r_matnr&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND date_from &amp;lt;= sy-datum&lt;/P&gt;&lt;P style="font-size: 12px; color: #333333;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND &lt;STRONG&gt;date_to &amp;gt;= sy-datum due to this i think you program goes to dump instead of '&amp;gt;=' please put 'EQ'.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jan 2014 13:17:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964043#M1800117</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-02T13:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT Performance problem with IN, GE, LE condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964044#M1800118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suwanandi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think due to IN there could be any problem . But in case of LE and GE it takes time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you create range for both date , there could be good performance optimization&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg.&lt;/P&gt;&lt;P&gt;lr_date-low = sy-datum&lt;/P&gt;&lt;P&gt;lr_date-high = 31.12.9999&lt;/P&gt;&lt;P&gt;append lr_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in select query use&amp;nbsp; "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date_to IN lr_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do same procedure for from date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try with this . Might be it can help you .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Deependra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jan 2014 13:25:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964044#M1800118</guid>
      <dc:creator>deependra_shekhawat3</dc:creator>
      <dc:date>2014-01-02T13:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT Performance problem with IN, GE, LE condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964045#M1800119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suwandi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems that you are reading all the records in&amp;nbsp; your r_matnr that means all 37k Records , So can u Please enlighten more regarding why you are reading all the records. Can you Post the Error with Exception also..?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arpit Gupta&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jan 2014 13:33:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964045#M1800119</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-01-02T13:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT Performance problem with IN, GE, LE condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964046#M1800120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The FOR ALL ENTRIES often (almost always...) perform badly when internal table is to big, SQL statements are too long if too many records in a range selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So how did you get those 37K values of MATNR, did they come for another SQL SELECT statement, if yes you could use this one in a subquery clause like in following sample :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN class="L0S52"&gt;SELECT * &lt;SPAN class="L0S52"&gt;INTO &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;TABLE &lt;/SPAN&gt;itab&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;FROM &lt;/SPAN&gt;wrf_matgrp_sku &lt;SPAN class="L0S52"&gt;AS &lt;/SPAN&gt;wrf&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;WHERE &lt;/SPAN&gt;EXISTS &lt;SPAN class="L0S55"&gt;( &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;SELECT &lt;/SPAN&gt;matnr &lt;BR /&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; &lt;SPAN class="L0S52"&gt;FROM &lt;/SPAN&gt;marc &lt;BR /&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; &lt;SPAN class="L0S52"&gt;WHERE &lt;/SPAN&gt;matnr &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;wrf&lt;SPAN class="L0S70"&gt;~&lt;/SPAN&gt;matnr&lt;BR /&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; &lt;SPAN class="L0S52"&gt;AND &lt;/SPAN&gt;ekgrp &lt;SPAN class="L0S52"&gt;IN &lt;/SPAN&gt;so_ekgrp &lt;SPAN class="L0S55"&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;AND &lt;/SPAN&gt;date_from &lt;SPAN class="L0S52"&gt;LE &lt;/SPAN&gt;sy&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;datum&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;AND &lt;/SPAN&gt;date_to &lt;SPAN class="L0S52"&gt;GE &lt;/SPAN&gt;sy&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;datum&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jan 2014 13:40:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964046#M1800120</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2014-01-02T13:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: SELECT Performance problem with IN, GE, LE condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964047#M1800121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've change the code to use INDEX when selecting and filter the rest data in the Application Server by manipulating the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also changed from FOR ALL ENTRIES to ranges again but now I limit the maximum number of ranges that will be processed at once.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Suwandi C.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2014 13:29:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-performance-problem-with-in-ge-le-condition/m-p/9964047#M1800121</guid>
      <dc:creator>suwandi_cahyadi</dc:creator>
      <dc:date>2014-01-09T13:29:23Z</dc:date>
    </item>
  </channel>
</rss>

