<?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 SQL statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619674#M601508</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this i think it will increase performance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;INTO TABLE t_output&lt;/P&gt;&lt;P&gt;FROM ztable&lt;/P&gt;&lt;P&gt;WHERE key IN s_key AND&lt;/P&gt;&lt;P&gt;out_date IN s_dte AND&lt;/P&gt;&lt;P&gt;dkey IN s_dkey.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF t_output[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;into TABLE t_output1&lt;/P&gt;&lt;P&gt;FROM z_table1&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN t_output&lt;/P&gt;&lt;P&gt;WHERE key IN s_key AND&lt;/P&gt;&lt;P&gt;(dkey_in = t_output-dkey or dkey_out = t_output-dkey).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if Helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Jul 2007 13:55:49 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-25T13:55:49Z</dc:date>
    <item>
      <title>Performance Issue SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619671#M601505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Friends, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am writing this piece of SQL to delete a lot of data in the Data Base z tables . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is running slow. Please advise as to how I can make this SQL better and faster . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;skey is the key field in the ztable but not in the z_table1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT *&lt;/P&gt;&lt;P&gt;    INTO TABLE t_output&lt;/P&gt;&lt;P&gt;    FROM ztable&lt;/P&gt;&lt;P&gt;    WHERE key IN s_key AND&lt;/P&gt;&lt;P&gt;          out_date IN s_dte AND&lt;/P&gt;&lt;P&gt;          dkey IN s_dkey.&lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF t_output[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT *&lt;/P&gt;&lt;P&gt;        APPENDING TABLE t_output1&lt;/P&gt;&lt;P&gt;       FROM z_table1&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN t_output&lt;/P&gt;&lt;P&gt;       WHERE key IN s_key AND&lt;/P&gt;&lt;P&gt;             dkey_in = t_output-dkey.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF syst-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      SELECT *&lt;/P&gt;&lt;P&gt;       APPENDING TABLE t_output1&lt;/P&gt;&lt;P&gt;       FROM z_table1&lt;/P&gt;&lt;P&gt;       FOR ALL ENTRIES IN t_output&lt;/P&gt;&lt;P&gt;       WHERE key IN s_key AND&lt;/P&gt;&lt;P&gt;             dkey_out  = t_output-dkey.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Hari  G  Krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jul 2007 13:49:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619671#M601505</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-25T13:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619672#M601506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi hari&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u can probably check from st05 which statement is taking more time and hence modify it accordingly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;and 1 more thing you should avoid using select * . instead u can select selecte fields from ztable as it is the biggest performance issue&lt;/P&gt;&lt;P&gt;&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;ravish&lt;/P&gt;&lt;P&gt;b]plz dont forget to reward points if useful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jul 2007 13:52:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619672#M601506</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-25T13:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619673#M601507</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;Follow the following steps to optimise your ABAP Code&lt;/P&gt;&lt;P&gt;Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE. &lt;/P&gt;&lt;P&gt;Use WHERE clause in your SELECT statement to restrict the volume of data retrieved. &lt;/P&gt;&lt;P&gt;Design your Query to Use as much index fields as possible from left to right in your WHERE statement &lt;/P&gt;&lt;P&gt;Either enable buffering in your database table or create Indexes to speed up the query. &lt;/P&gt;&lt;P&gt;Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot. &lt;/P&gt;&lt;P&gt;Avoid using nested SELECT statement, SELECT within LOOPs. &lt;/P&gt;&lt;P&gt;Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE. &lt;/P&gt;&lt;P&gt;Avoid using SELECT * and Select only the required fields from the table. &lt;/P&gt;&lt;P&gt;Avoid nested loops when working with large internal tables. &lt;/P&gt;&lt;P&gt;Use assign instead of into in LOOPs for table types with large work areas &lt;/P&gt;&lt;P&gt;When in doubt call transaction SE30 and use the examples and check your code &lt;/P&gt;&lt;P&gt;Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search. &lt;/P&gt;&lt;P&gt;Use "CHECK" instead of IF/ENDIF whenever possible. &lt;/P&gt;&lt;P&gt;Use "CASE" instead of IF/ENDIF whenever possible. &lt;/P&gt;&lt;P&gt;Use "MOVE" with individual variable/field moves instead of "MOVE-CORRESPONDING", creates more coding but is more effcient. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward if helpful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jul 2007 13:54:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619673#M601507</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-25T13:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619674#M601508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this i think it will increase performance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;INTO TABLE t_output&lt;/P&gt;&lt;P&gt;FROM ztable&lt;/P&gt;&lt;P&gt;WHERE key IN s_key AND&lt;/P&gt;&lt;P&gt;out_date IN s_dte AND&lt;/P&gt;&lt;P&gt;dkey IN s_dkey.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF t_output[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;into TABLE t_output1&lt;/P&gt;&lt;P&gt;FROM z_table1&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN t_output&lt;/P&gt;&lt;P&gt;WHERE key IN s_key AND&lt;/P&gt;&lt;P&gt;(dkey_in = t_output-dkey or dkey_out = t_output-dkey).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if Helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jul 2007 13:55:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619674#M601508</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-25T13:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619675#M601509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know i dont need to use SELECT * but I need to delete all the fields in the table for that entry. &lt;/P&gt;&lt;P&gt;Please advise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jul 2007 13:57:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619675#M601509</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-25T13:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue SQL statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619676#M601510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;Do you need all the fields in this table ur using * instead use specific fields..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and one small change&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT *&lt;/P&gt;&lt;P&gt;APPENDING TABLE t_output1&lt;/P&gt;&lt;P&gt;FROM z_table1&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN t_output&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;WHERE key eq t_output-key AND&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;dkey_in = t_output-dkey.&lt;/P&gt;&lt;P&gt;&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;Mahesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Jul 2007 13:58:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-sql-statement/m-p/2619676#M601510</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-25T13:58:43Z</dc:date>
    </item>
  </channel>
</rss>

