<?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 with join in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284073#M153422</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi frank,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. why do you want to use GROUP By ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. u are not using any aggregate functions in sql &lt;/P&gt;&lt;P&gt;   like sum, count etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. so if not required, you may remove&lt;/P&gt;&lt;P&gt;  group by,&lt;/P&gt;&lt;P&gt;   it will improve the performance a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4.Further i think that &lt;/P&gt;&lt;P&gt;  the BRACKETS for OR&lt;/P&gt;&lt;P&gt;  are misplace. it should be like this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ekpo~lgort&lt;/P&gt;&lt;P&gt;INTO TABLE i_temp&lt;/P&gt;&lt;P&gt;FROM ekbe&lt;/P&gt;&lt;P&gt;INNER JOIN ekpo ON ekpo&lt;SUB&gt;ebeln = ekbe&lt;/SUB&gt;ebeln AND&lt;/P&gt;&lt;P&gt;ekpo&lt;SUB&gt;ebelp = ekbe&lt;/SUB&gt;ebelp&lt;/P&gt;&lt;P&gt;WHERE ekbe~cpudt IN s_date AND&lt;/P&gt;&lt;P&gt;ekpo~werks IN s_werks AND&lt;/P&gt;&lt;P&gt;ekbe~ebeln IN s_ebeln AND&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;( ekbe&lt;SUB&gt;vgabe EQ '1'  OR  ekbe&lt;/SUB&gt;vgabe EQ '6' )&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;GROUP BY&lt;/P&gt;&lt;P&gt;&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;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Mar 2006 04:26:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-03-29T04:26:57Z</dc:date>
    <item>
      <title>Performance with join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284072#M153421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Could you please give me tips to improve the performmance of the following joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT ekbe~ebeln&lt;/P&gt;&lt;P&gt;           ekbe~ebelp&lt;/P&gt;&lt;P&gt;           ekbe~vgabe&lt;/P&gt;&lt;P&gt;           ekbe~matnr&lt;/P&gt;&lt;P&gt;           ekbe~menge&lt;/P&gt;&lt;P&gt;           ekbe~shkzg&lt;/P&gt;&lt;P&gt;           ekpo~werks&lt;/P&gt;&lt;P&gt;           ekpo~meins&lt;/P&gt;&lt;P&gt;           ekpo~afnam&lt;/P&gt;&lt;P&gt;           ekpo~lgort&lt;/P&gt;&lt;P&gt;           INTO TABLE i_temp&lt;/P&gt;&lt;P&gt;           FROM ekbe&lt;/P&gt;&lt;P&gt;           INNER JOIN ekpo ON  ekpo&lt;SUB&gt;ebeln = ekbe&lt;/SUB&gt;ebeln AND&lt;/P&gt;&lt;P&gt;                               ekpo&lt;SUB&gt;ebelp = ekbe&lt;/SUB&gt;ebelp&lt;/P&gt;&lt;P&gt;                        WHERE  ekbe~cpudt IN s_date    AND&lt;/P&gt;&lt;P&gt;                               ekpo~werks IN s_werks   AND&lt;/P&gt;&lt;P&gt;                               ekbe~ebeln IN s_ebeln   AND&lt;/P&gt;&lt;P&gt;                               ( ekbe~vgabe EQ '1' )   OR&lt;/P&gt;&lt;P&gt;                               ( ekbe~vgabe EQ '6' )&lt;/P&gt;&lt;P&gt;                                GROUP BY&lt;/P&gt;&lt;P&gt;                                ekbe~ebeln&lt;/P&gt;&lt;P&gt;                                ekbe~ebelp&lt;/P&gt;&lt;P&gt;                                ekbe~vgabe&lt;/P&gt;&lt;P&gt;                                ekbe~matnr&lt;/P&gt;&lt;P&gt;                                ekbe~menge&lt;/P&gt;&lt;P&gt;                                ekbe~shkzg&lt;/P&gt;&lt;P&gt;                                ekpo~werks&lt;/P&gt;&lt;P&gt;                                ekpo~meins&lt;/P&gt;&lt;P&gt;                                ekpo~afnam&lt;/P&gt;&lt;P&gt;                                ekpo~lgort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DELETE i_temp WHERE werks NOT IN s_werks  .&lt;/P&gt;&lt;P&gt;  DELETE i_temp WHERE ebeln NOT IN s_ebeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 04:24:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284072#M153421</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T04:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Performance with join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284073#M153422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi frank,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. why do you want to use GROUP By ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. u are not using any aggregate functions in sql &lt;/P&gt;&lt;P&gt;   like sum, count etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. so if not required, you may remove&lt;/P&gt;&lt;P&gt;  group by,&lt;/P&gt;&lt;P&gt;   it will improve the performance a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4.Further i think that &lt;/P&gt;&lt;P&gt;  the BRACKETS for OR&lt;/P&gt;&lt;P&gt;  are misplace. it should be like this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ekpo~lgort&lt;/P&gt;&lt;P&gt;INTO TABLE i_temp&lt;/P&gt;&lt;P&gt;FROM ekbe&lt;/P&gt;&lt;P&gt;INNER JOIN ekpo ON ekpo&lt;SUB&gt;ebeln = ekbe&lt;/SUB&gt;ebeln AND&lt;/P&gt;&lt;P&gt;ekpo&lt;SUB&gt;ebelp = ekbe&lt;/SUB&gt;ebelp&lt;/P&gt;&lt;P&gt;WHERE ekbe~cpudt IN s_date AND&lt;/P&gt;&lt;P&gt;ekpo~werks IN s_werks AND&lt;/P&gt;&lt;P&gt;ekbe~ebeln IN s_ebeln AND&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;( ekbe&lt;SUB&gt;vgabe EQ '1'  OR  ekbe&lt;/SUB&gt;vgabe EQ '6' )&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;GROUP BY&lt;/P&gt;&lt;P&gt;&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;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 04:26:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284073#M153422</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T04:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: Performance with join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284074#M153423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Frank,&lt;/P&gt;&lt;P&gt;You can remove the GROUP BY statement.&lt;/P&gt;&lt;P&gt;Since you are not performing any aggregate functions .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do the same operation if any, in your internal table after the SELECT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Wenceslaus.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 04:28:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284074#M153423</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T04:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Performance with join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284075#M153424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Frank,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First you can remove the Group by clause .........as well as to check how much performance increase ....you can notice with the help of a tool code inspector(tcode-SCI)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please reward for the same.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 04:32:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284075#M153424</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T04:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Performance with join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284076#M153425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Frank,&lt;/P&gt;&lt;P&gt; change the code like this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; SELECT ekbe~ebeln
ekbe~ebelp
ekbe~vgabe
ekbe~matnr
ekbe~menge
ekbe~shkzg
INTO TABLE i_temp1.
FROM ekbe
WHERE ekbe~cpudt IN s_date AND 
ekbe~ebeln IN s_ebeln AND
( ekbe~vgabe EQ '1' ) OR
( ekbe~vgabe EQ '6' ).

if i_temp1[] is not initial.
SELECT
ekpo~werks
ekpo~meins
ekpo~afnam
ekpo~lgort
INTO TABLE i_temp2
FROM EKPO
FOR ALL ENTRIES in i_temp1
WHERE ekpo~werks IN s_werks.
endif.

MOVE CORRESPONDING i_temp1 to i_temp3.
MOVE CORRESPONDING i_temp2 to i_temp3.
append it_temp3.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here i_temp3 contains the finl structure that is needed..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then no need To use DELETE as the selection takes care of that..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;satesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 04:37:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284076#M153425</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T04:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Performance with join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284077#M153426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rex, In addition to wot amit already said (remove group by). &lt;/P&gt;&lt;P&gt;I think your SQL is already optimized to the max, and the reason is:&lt;/P&gt;&lt;P&gt;1) ( ekbe&lt;SUB&gt;vgabe EQ '1' OR ekbe&lt;/SUB&gt;vgabe EQ '6' ) &lt;/P&gt;&lt;P&gt;- ekbe~vgabe IN ('1','6') will be slower in my openion&lt;/P&gt;&lt;P&gt;2) ekbe INNER JOIN ekpo &lt;/P&gt;&lt;P&gt;-  two SQL staement (first on ekbe and then ekpo) will always give poor performance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 11:19:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284077#M153426</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T11:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Performance with join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284078#M153427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't really expect this, but when I ran this a couple of different ways with a trace on and then looked at the 'explain', I found the most important thing was to change:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
( ekbe~vgabe EQ '1' ) OR
( ekbe~vgabe EQ '6' )&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;to:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
( ekbe~vgabe EQ '1'   OR
  ekbe~vgabe EQ '6' )&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;(that is, if this is what you want). Additionaly, ensure that s_ebeln is not initial. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 15:40:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284078#M153427</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T15:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Performance with join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284079#M153428</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 reason to use group by in my query is: The &amp;#147;group by&amp;#148; designation means that all data for a given STO will be the same for that field for all records in the internal table.  Thus it can be combined to form one line.  The Quantity field will be summed to determine the net amount issued or received.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is the performance is okay if I change the following code? &lt;/P&gt;&lt;P&gt;( ekbe&lt;SUB&gt;vgabe EQ '1'   OR   ekbe&lt;/SUB&gt;vgabe EQ '6' )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 22:06:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284079#M153428</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T22:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Performance with join</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284080#M153429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It was better when I tried it. But you'll have to try it yourself before you know for sure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Mar 2006 22:18:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-with-join/m-p/1284080#M153429</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-29T22:18:10Z</dc:date>
    </item>
  </channel>
</rss>

