<?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: BSAD Performance issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699586#M1577879</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When we run this program the first time, it'll take 10 min to finish. But it'll take only 1 second when we try this in the second time.  We believe that it should be the cache issue becuase we'll see this problem after a few hours when we run this program again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Right, because as you indicated, the statement has been buffered in the cursor cache.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; We already talked to our BASIS but they said the system is in the best status. If they tune the system for this SQL, we might have other issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;True, but not a very helpful answer from the Basis team.  There's no need to tune because you already have index support for the statement, both with BSEG&lt;SUB&gt;0 (primary key) and with BSAD&lt;/SUB&gt;4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any suggestions that we can tune this SQL?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would dump the 'OR' as Rob already hinted at.  Try using 2 statements with APPENDING TABLE on the second and see how that works.  You can hit BSEG for the BUKRS/BELNR/GJAHR/BUZEI combo (also specifying KOART, AUGBL not blank, and other fields to get the right items) and then BSAD for the BUKRS/REBZG/.../ combo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Feb 2011 21:41:40 GMT</pubDate>
    <dc:creator>brad_bohn</dc:creator>
    <dc:date>2011-02-10T21:41:40Z</dc:date>
    <item>
      <title>BSAD Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699584#M1577877</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;We have the following SQL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT&lt;/P&gt;&lt;P&gt;      vdbepi~ssolhab&lt;/P&gt;&lt;P&gt;      vdbepi~kunnr&lt;/P&gt;&lt;P&gt;      vdbepi~rebzj&lt;/P&gt;&lt;P&gt;      vdbepi~rebzg&lt;/P&gt;&lt;P&gt;      vdbepi~rebzz&lt;/P&gt;&lt;P&gt;      INTO CORRESPONDING FIELDS OF TABLE lt_vdbepi_key&lt;/P&gt;&lt;P&gt;      FROM (    vdbeki AS vdbeki INNER JOIN vdbepi AS vdbepi&lt;/P&gt;&lt;P&gt;            ON  vdbeki&lt;SUB&gt;mandt    = vdbepi&lt;/SUB&gt;mandt&lt;/P&gt;&lt;P&gt;            AND vdbeki&lt;SUB&gt;bukrs    = vdbepi&lt;/SUB&gt;bukrs&lt;/P&gt;&lt;P&gt;            AND vdbeki&lt;SUB&gt;rbelkpfd = vdbepi&lt;/SUB&gt;rbelkpfd )&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN ut_loan_bp_key&lt;/P&gt;&lt;P&gt;      WHERE      vdbeki~bukrs    EQ  uv_bukrs&lt;/P&gt;&lt;P&gt;        AND      vdbeki~ranl     EQ  ut_loan_bp_key-ranl&lt;/P&gt;&lt;P&gt;        AND      vdbeki~sstorno  EQ  space.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;if we don't no Key Value, it means this contract doesn't have Postings&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  IF lt_vdbepi_key[]  IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT&lt;/P&gt;&lt;P&gt;      kunnr "3&lt;/P&gt;&lt;P&gt;      augdt "6&lt;/P&gt;&lt;P&gt;      augbl "7&lt;/P&gt;&lt;P&gt;      gjahr "9&lt;/P&gt;&lt;P&gt;      belnr "10&lt;/P&gt;&lt;P&gt;      buzei "11&lt;/P&gt;&lt;P&gt;      bldat "13&lt;/P&gt;&lt;P&gt;      shkzg "21&lt;/P&gt;&lt;P&gt;      dmbtr "24&lt;/P&gt;&lt;P&gt;      zfbdt "39&lt;/P&gt;&lt;P&gt;      rebzg "54&lt;/P&gt;&lt;P&gt;      rebzj "55&lt;/P&gt;&lt;P&gt;      rebzz "56&lt;/P&gt;&lt;P&gt;      vertn "92&lt;/P&gt;&lt;P&gt;      vbewa "93&lt;/P&gt;&lt;P&gt;      auggj "167&lt;/P&gt;&lt;P&gt;      FROM bsad INTO CORRESPONDING FIELDS OF TABLE ct_bsad&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN lt_vdbepi_key&lt;/P&gt;&lt;P&gt;      WHERE     bukrs   EQ uv_bukrs&lt;/P&gt;&lt;P&gt;        AND     vertn   IN s_ranl&lt;/P&gt;&lt;P&gt;        AND ( ( gjahr   EQ lt_vdbepi_key-rebzj   " direct link&lt;/P&gt;&lt;P&gt;            AND belnr   EQ lt_vdbepi_key-rebzg&lt;/P&gt;&lt;P&gt;            AND buzei   EQ lt_vdbepi_key-rebzz )&lt;/P&gt;&lt;P&gt;        OR  (   rebzg   EQ lt_vdbepi_key-rebzg    " indirect link&lt;/P&gt;&lt;P&gt;            AND rebzj   EQ lt_vdbepi_key-rebzj&lt;/P&gt;&lt;P&gt;            AND rebzz   EQ lt_vdbepi_key-rebzz ) ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When we run this program the first time, it'll take 10 min to finish. But it'll take only 1 second when we try this in the second time. We tried to use ST05 and found that it is using indexes already.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We believe that it should be the cache issue becuase we'll see this problem after a few hours when we run this program again. We already talked to our BASIS but they said the system is in the best status. If they tune the system for this SQL, we might have other issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any suggestions that we can tune this SQL?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: FAE just have 20+ records max in the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tai&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2011 20:38:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699584#M1577877</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-10T20:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: BSAD Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699585#M1577878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The last OR condition looks suspicious to me. It may not be selective enough if there are many documents where these fields are initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try changing that condition so that it only tries to find fields that are 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>Thu, 10 Feb 2011 21:00:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699585#M1577878</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-10T21:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: BSAD Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699586#M1577879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When we run this program the first time, it'll take 10 min to finish. But it'll take only 1 second when we try this in the second time.  We believe that it should be the cache issue becuase we'll see this problem after a few hours when we run this program again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Right, because as you indicated, the statement has been buffered in the cursor cache.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; We already talked to our BASIS but they said the system is in the best status. If they tune the system for this SQL, we might have other issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;True, but not a very helpful answer from the Basis team.  There's no need to tune because you already have index support for the statement, both with BSEG&lt;SUB&gt;0 (primary key) and with BSAD&lt;/SUB&gt;4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have any suggestions that we can tune this SQL?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would dump the 'OR' as Rob already hinted at.  Try using 2 statements with APPENDING TABLE on the second and see how that works.  You can hit BSEG for the BUKRS/BELNR/GJAHR/BUZEI combo (also specifying KOART, AUGBL not blank, and other fields to get the right items) and then BSAD for the BUKRS/REBZG/.../ combo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2011 21:41:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699586#M1577879</guid>
      <dc:creator>brad_bohn</dc:creator>
      <dc:date>2011-02-10T21:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: BSAD Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699587#M1577880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe dividing the sql into two separate selects would clarify things for the database system:&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;kunnr "3 augdt "6 augbl "7 gjahr "9 belnr "10 buzei "11 bldat "13 shkzg "21 dmbtr "24&lt;/P&gt;&lt;P&gt;zfbdt "39 rebzg "54 rebzj "55 rebzz "56 vertn "92 vbewa "93 auggj "167&lt;/P&gt;&lt;P&gt;FROM bsad INTO CORRESPONDING FIELDS OF TABLE ct_bsad&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN lt_vdbepi_key&lt;/P&gt;&lt;P&gt;WHERE bukrs EQ uv_bukrs&lt;/P&gt;&lt;P&gt;AND vertn IN s_ranl&lt;/P&gt;&lt;P&gt;AND gjahr EQ lt_vdbepi_key-rebzj " direct link&lt;/P&gt;&lt;P&gt;AND belnr EQ lt_vdbepi_key-rebzg&lt;/P&gt;&lt;P&gt;AND buzei EQ lt_vdbepi_key-rebzz &lt;/P&gt;&lt;P&gt;.&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;kunnr "3 augdt "6 augbl "7 gjahr "9 belnr "10 buzei "11 bldat "13 shkzg "21 dmbtr "24&lt;/P&gt;&lt;P&gt;zfbdt "39 rebzg "54 rebzj "55 rebzz "56 vertn "92 vbewa "93 auggj "167&lt;/P&gt;&lt;P&gt;FROM bsad appending CORRESPONDING FIELDS OF TABLE ct_bsad&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN lt_vdbepi_key&lt;/P&gt;&lt;P&gt;WHERE bukrs EQ uv_bukrs&lt;/P&gt;&lt;P&gt;AND vertn IN s_ranl&lt;/P&gt;&lt;P&gt;AND rebzg EQ lt_vdbepi_key-rebzg " indirect link&lt;/P&gt;&lt;P&gt;AND rebzj EQ lt_vdbepi_key-rebzj&lt;/P&gt;&lt;P&gt;AND rebzz EQ lt_vdbepi_key-rebzz .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;you may want to sort ct_bsad and remove adjacent duplicates after these selects&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2011 23:34:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699587#M1577880</guid>
      <dc:creator>former_member186741</dc:creator>
      <dc:date>2011-02-10T23:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: BSAD Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699588#M1577881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Isn't that what I said without actually giving him the code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Feb 2011 15:04:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699588#M1577881</guid>
      <dc:creator>brad_bohn</dc:creator>
      <dc:date>2011-02-11T15:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: BSAD Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699589#M1577882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks alot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll try the suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tai&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Feb 2011 16:42:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bsad-performance-issue/m-p/7699589#M1577882</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-02-11T16:42:18Z</dc:date>
    </item>
  </channel>
</rss>

