<?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: Inner Join Performance issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213714#M766222</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Performance can be bad for any number of reasons. The JOIN looks OK. How many records does it bring back?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 Dec 2007 21:52:21 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-07T21:52:21Z</dc:date>
    <item>
      <title>Inner Join Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213710#M766218</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 the following select statement which has three levels of inner joins. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT p&lt;SUB&gt;plnty p&lt;/SUB&gt;plnnr p&lt;SUB&gt;plnkn m&lt;/SUB&gt;plnal m&lt;SUB&gt;werks m&lt;/SUB&gt;matnr mr~meins&lt;/P&gt;&lt;P&gt;             p&lt;SUB&gt;vornr p&lt;/SUB&gt;steus s&lt;SUB&gt;datuv s&lt;/SUB&gt;loekz INTO TABLE it_group&lt;/P&gt;&lt;P&gt;      FROM ( ( plpo AS p&lt;/P&gt;&lt;P&gt;             INNER JOIN plas AS s ON s&lt;SUB&gt;plnty = p&lt;/SUB&gt;plnty AND&lt;/P&gt;&lt;P&gt;             s&lt;SUB&gt;plnnr = p&lt;/SUB&gt;plnnr AND s&lt;SUB&gt;plnkn = p&lt;/SUB&gt;plnkn )&lt;/P&gt;&lt;P&gt;             INNER JOIN mapl AS m ON m&lt;SUB&gt;plnty = s&lt;/SUB&gt;plnty AND&lt;/P&gt;&lt;P&gt;             m&lt;SUB&gt;plnnr = s&lt;/SUB&gt;plnnr AND m&lt;SUB&gt;plnal = s&lt;/SUB&gt;plnal )&lt;/P&gt;&lt;P&gt;             INNER JOIN mara AS mr ON mr&lt;SUB&gt;matnr = m&lt;/SUB&gt;matnr&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN it_valid_opr&lt;/P&gt;&lt;P&gt;      WHERE p~plnty = c_routing&lt;/P&gt;&lt;P&gt;        AND p~plnnr = it_valid_opr-plnnr&lt;/P&gt;&lt;P&gt;        AND s&lt;SUB&gt;datuv &amp;lt;= p_valdt AND m&lt;/SUB&gt;plnty =&lt;/P&gt;&lt;P&gt;            c_routing AND m&lt;SUB&gt;datuv &amp;lt;= p_valdt AND m&lt;/SUB&gt;loekz &amp;lt;&amp;gt; c_x .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have some 2500 entries in the internal table it_valid_opr. This query is taking very long time to get executed. Any anyone suggest an alternative for the above SELECT query.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 20:54:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213710#M766218</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-07T20:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Inner Join Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213711#M766219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have one expression in both a JOIN condition and the WHERE. I'd remove it from the WHERE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT p~plnty p~plnnr p~plnkn m~plnal m~werks m~matnr mr~meins
       p~vornr p~steus s~datuv s~loekz
  INTO TABLE it_group
  FROM ( ( plpo AS p
    INNER JOIN plas AS s
      ON s~plnty = p~plnty AND
         s~plnnr = p~plnnr AND
         s~plnkn = p~plnkn )
    INNER JOIN mapl AS m
      ON m~plnty = s~plnty AND
         m~plnnr = s~plnnr AND
         m~plnal = s~plnal )
    INNER JOIN mara AS mr
      ON mr~matnr = m~matnr
  FOR ALL ENTRIES IN it_valid_opr
  WHERE p~plnty = c_routing
    AND p~plnnr = it_valid_opr-plnnr
    AND s~datuv &amp;lt;= p_valdt
*   AND m~plnty = c_routing              "&amp;lt;====
    AND m~datuv &amp;lt;= p_valdt
    AND m~loekz &amp;lt;&amp;gt; c_x .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 21:15:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213711#M766219</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-07T21:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Inner Join Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213712#M766220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for ur quick reply. But is this the only reason wat is causing the performance slow down?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 21:29:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213712#M766220</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-07T21:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Inner Join Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213713#M766221</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;PRE&gt;&lt;CODE&gt;Types: begin of ty_plpo,
        plnty type plnty,
        plnnr type plnnr,
        plnkn type plnkn,
        vornr type vornr,
        steus type steus,
       end of ty_plpo,

       begin of ty_plas,
        plnty type plnty,
        plnnr type plnnr,
        plnal type plnal,
        datuv type datuv,
        loekz type loekz,        
       end of ty_plas,

       begin of ty_mapl,
        plnty type plnty,
        plnnr type plnnr,
        plnkn type plnkn,
        plnal type plnal,
        werks type werks_d,
        matnr type matnr,
       end of ty_mapl,
  
       begin of ty_mara,
        matnr type matnr,
        meins type meins,
       end of ty_mara.

Data: it_plpo type table of ty_plpo,
      it_mplo type table of ty_mplo,
      it_mapl type table of ty_mapl,
      it_mara type table of ty_mara.



if it_valid_opr[] is not intial.
 SELECT plnty plnnr plnkn vornr steus from plpo into table it_plpo for all entries in it_valid_opr
where plnty = c_routing
  and plnnr = it_valid_opr-plnnr.
 if sy-subrc = 0.
  select plnty plnnr plnal datuv loekz from plas into table it_plas for all entries in it_mplo
 where plnty = it_mplo-plnty
   and plnnr = it_mplo-plnnr
   and plnkn = it_mplo-plnkn
   and datuv LE p_valdt.
  if sy-subrc = 0.
   select plnty plnnr plnkn plnal werks matnr from mapl into table it_mapl for all entries in it_plas
     where plnty = it_plas-plnty
       and plnnr = it_plas-plnnr
       and plnkn = it_plas-plnal
       or  plnty = c_routing
       and datuv LE p_valdt.
   if sy-subrc = 0.
     delete it_mapl where loekz EQ c_x.
     select matnr meins from mara into table it_mara for all entries in it_mapl 
      where matnr = it_mapl-matnr.
   endif. 
  endif.
 endif.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 21:32:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213713#M766221</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-07T21:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Inner Join Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213714#M766222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Performance can be bad for any number of reasons. The JOIN looks OK. How many records does it bring back?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 21:52:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213714#M766222</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-07T21:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Inner Join Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213715#M766223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It returns about 300,000 records....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 22:00:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213715#M766223</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-07T22:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: Inner Join Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213716#M766224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, that's probably it then. One of the first rules of performance tuning is to keep the selection set small. 300,000 records isn't huge, but it isn't small either. Coupled with the fact that you aren't using the entire key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 22:16:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inner-join-performance-issue/m-p/3213716#M766224</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-07T22:16:07Z</dc:date>
    </item>
  </channel>
</rss>

