<?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 query performance in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516457#M845765</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;In addition to the suggestions given above, you can add the following things:&lt;/P&gt;&lt;P&gt;1) Add company code in the query if possible&lt;/P&gt;&lt;P&gt;2) Also add field GJAHR &lt;/P&gt;&lt;P&gt;3) Arrange the fields in the where clause as per sequence of the primary key combination &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you do this, do the trace analysis and check if the proper index is being used or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shahu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Feb 2008 01:27:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-28T01:27:32Z</dc:date>
    <item>
      <title>select query performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516450#M845758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assume that it_pos is an internla table and its having more than 15000 records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which of the following query will optimize performance of programme. &lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT it_pos BY belnr.&lt;/P&gt;&lt;P&gt;     LOOP AT it_pos INTO wa_pos .  &lt;/P&gt;&lt;P&gt;          SELECT hkont zuonr budat blart wrbtr bschl xref3&lt;/P&gt;&lt;P&gt;                 INTO CORRESPONDING FIELDS OF   wa_bsis&lt;/P&gt;&lt;P&gt;                 FROM bsis&lt;/P&gt;&lt;P&gt;                 WHERE belnr = wa_pos-belnr&lt;/P&gt;&lt;P&gt;                 AND   hkont = wa_pos-konto&lt;/P&gt;&lt;P&gt;                 AND   zuonr = wa_pos-zuonr&lt;/P&gt;&lt;P&gt;                 AND   blart = 'WE'        "IN ('WE' , 'RE' , 'RO')&lt;/P&gt;&lt;P&gt;                 AND   bschl = '96'&lt;/P&gt;&lt;P&gt;                 AND   shkzg = 'H'&lt;/P&gt;&lt;P&gt;                 AND   budat = sta_date .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          APPEND wa_bsis to it_bsis.&lt;/P&gt;&lt;P&gt;          ENDSELECT.&lt;/P&gt;&lt;P&gt;     ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      SELECT hkont zuonr budat blart wrbtr bschl xref3&lt;/P&gt;&lt;P&gt;   INTO CORRESPONDING FIELDS OF TABLE    it_bsis1&lt;/P&gt;&lt;P&gt;                 FROM bsis&lt;/P&gt;&lt;P&gt;                 FOR ALL ENTRIES IN it_pos&lt;/P&gt;&lt;P&gt;                 WHERE belnr = it_pos-belnr&lt;/P&gt;&lt;P&gt;                 AND   hkont = it_pos-konto&lt;/P&gt;&lt;P&gt;                 AND   zuonr = it_pos-zuonr&lt;/P&gt;&lt;P&gt;                 AND   blart = 'WE'        "IN ('WE' , 'RE' , 'RO')&lt;/P&gt;&lt;P&gt;                 AND   bschl = '96'&lt;/P&gt;&lt;P&gt;                 AND   shkzg = 'H'&lt;/P&gt;&lt;P&gt;                 AND   budat = sta_date .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;s.senthil kumar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 27, 2008 3:52 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 11:01:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516450#M845758</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T11:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: select query performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516451#M845759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,,&lt;/P&gt;&lt;P&gt;SAP Provides a transaction called SE30 Which will be use for ur query performaance..there is Tips and tricks also to improve your performance tuning...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U can use it and post me a mail.. '&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Karthik.T&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 27, 2008 3:51 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 11:04:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516451#M845759</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T11:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: select query performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516452#M845760</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 second way of select option is right one.&lt;/P&gt;&lt;P&gt;Because in your first code .&lt;/P&gt;&lt;P&gt;you have loop statement then you have the select statement.&lt;/P&gt;&lt;P&gt;Loop statement executes in the Application layer and Select statement executes in the Database Layer.&lt;/P&gt;&lt;P&gt;So moving from loop to select - &amp;gt; time consuming and also it moves from one layer to another layer in three tier architecture.&lt;/P&gt;&lt;P&gt;Whereas the second one has only Select statement operating upon the Database layer . and then comes out completely.&lt;/P&gt;&lt;P&gt;So it is more optimal and performance is good comparatively. &lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Chithra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 11:04:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516452#M845760</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T11:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: select query performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516453#M845761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;  Second select query would give you good result, because instead of putting a select query inside a loop, better avoid such sort of coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SUGGESTION1: TRY TO AVOID 'INTO CORRESPONDING FIELDS' STATEMENT IN THE SECOND SELECT QUERY.&lt;/P&gt;&lt;P&gt;SUGGESTION 2: DONT FORGET TO CHECK THE INITIALITY OF THE INTERNAL TABLE IT_POS BEFORE USING 'FOR ALL ENTRIES'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 11:05:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516453#M845761</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T11:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: select query performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516454#M845762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;your second part is better obviously &lt;/P&gt;&lt;P&gt;but let me remind you that you need to remove &lt;STRONG&gt;move corresponding&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;because that is time consuming and other then this plz use &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;into workarea&lt;/STRONG&gt; that will b helpful for sure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;vivek&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 27, 2008 3:52 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 11:07:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516454#M845762</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T11:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: select query performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516455#M845763</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;the first select stmt is hitting the database table for 15000 times...instead of it you can try fetching the data into an internal table outside the loop and hit the internal table inside the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this may help you out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;teja.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 11:49:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516455#M845763</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T11:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: select query performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516456#M845764</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 second way is right one. And you must to change "into corresponding fields of table" by "into table"  and make shure that the internal table has te same fields in the same order as the select.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2008 12:06:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516456#M845764</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-27T12:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: select query performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516457#M845765</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;In addition to the suggestions given above, you can add the following things:&lt;/P&gt;&lt;P&gt;1) Add company code in the query if possible&lt;/P&gt;&lt;P&gt;2) Also add field GJAHR &lt;/P&gt;&lt;P&gt;3) Arrange the fields in the where clause as per sequence of the primary key combination &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you do this, do the trace analysis and check if the proper index is being used or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shahu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2008 01:27:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516457#M845765</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-28T01:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: select query performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516458#M845766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BUKRS is the first field of the index. Either way will be extremely slow until you add this to the WHERE clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2008 02:49:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516458#M845766</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-28T02:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: select query performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516459#M845767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;       Avoid using select statement within loop. This will increase your execution time. Instead use 'for all entries in table1'. Make sure that u check if the table 1 is not initial before using 'for all entries'.&lt;/P&gt;&lt;P&gt;       Using select-endselect is also not advisable. Dont use 'corresponding fields of' .Instead specify the correct field names in the same order as that of internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ramya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2008 04:17:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516459#M845767</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-28T04:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: select query performance</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516460#M845768</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;        Thank you friends for ur reply. I have given points on basis of first in first out .&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;s.senthil kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2008 05:34:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance/m-p/3516460#M845768</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-28T05:34:15Z</dc:date>
    </item>
  </channel>
</rss>

