<?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: SQL problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470502#M834226</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;I wanna add one more observation, there is a similar SQL before the one posted both fetching the same table &amp;amp; loading the same itab below is the pseudo code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If flag = ' '.&lt;/P&gt;&lt;P&gt;sql fetching from RESB loading into I_MDRS having for all entries of itab.(but there is no check made before for all entries)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exec sql one in the posting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any Ideas,&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;Edited by: chidambar dixit on Mar 15, 2008 2:13 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 15 Mar 2008 13:13:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-15T13:13:27Z</dc:date>
    <item>
      <title>SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470495#M834219</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;This is with ref to SE30 results what i found for my program is that the below SQL statement which is as below takes 61% of the database load,any suggestions to overcome this load,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Useful suggestions rewarded,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgrds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select werks baugr matnr lgort pspel rsnum rspos bdter bdmng enmng meins aufnr bdart dbskz kzaus schgt techs cuobj umwrk postp plnum kdauf kdpos sobkz shkzg nfpkz nafkz nomng nomat&lt;/P&gt;&lt;P&gt;      into table i_mdrs&lt;/P&gt;&lt;P&gt;      from mdrs&lt;/P&gt;&lt;P&gt;     where matnr &amp;lt;&amp;gt; space&lt;/P&gt;&lt;P&gt;       and werks in s_werks&lt;/P&gt;&lt;P&gt;       and xloek = space                   "Not deleted&lt;/P&gt;&lt;P&gt;       and kzear = space                   "Not final issued&lt;/P&gt;&lt;P&gt;       and bdter &amp;lt;= p_seldt&lt;/P&gt;&lt;P&gt;       and sobkz in r_sobkz              "Plant, project,sales order&lt;/P&gt;&lt;P&gt;       and bdmng &amp;gt; 0&lt;/P&gt;&lt;P&gt;       and dbskz &amp;lt;&amp;gt; c_dbskzf               "Internal production&lt;/P&gt;&lt;P&gt;       and ndisp = space                   "Relevant to MRP&lt;/P&gt;&lt;P&gt;       and ( kzvbr &amp;lt;&amp;gt; c_kzvbrv             "Direct consumption&lt;/P&gt;&lt;P&gt;       and kzvbr &amp;lt;&amp;gt; c_kzvbra )             "Consumption to asset&lt;/P&gt;&lt;P&gt;       and txtps = space                   "Ignore text items&lt;/P&gt;&lt;P&gt;       and dumps = space                   "Ignore phantoms&lt;/P&gt;&lt;P&gt;       and vrpla = space                   "Ign planning w/o final assy&lt;/P&gt;&lt;P&gt;       and postp in r_t418                 "Ignore direct procurement&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Oracle hints option was added to improve performance&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   %_hints oracle 'FULL( MDRS ) PARALLEL( MDRS, 4 )'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 07:14:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470495#M834219</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T07:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470496#M834220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;u use the table RESB directly, and in where condition&lt;/P&gt;&lt;P&gt;fields order should be in the order of fields in the data base table , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This might help u .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 08:18:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470496#M834220</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T08:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470497#M834221</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;Remove negative condition(not equal to).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;better,Create index for near of your requierment for the table RESB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;L.Velu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 10:15:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470497#M834221</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T10:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470498#M834222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Run the SQL Trace and read the explain&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess your statement does not use any index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Either you add fields to the Where condition which are an index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you need to create an index. But for a new index you should ask somebody with more experience.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;61% is onyl a relative number, what is it in total?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 11:16:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470498#M834222</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T11:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470499#M834223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Still some information has to be given I suppose,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Total load on database is 84%,&lt;/P&gt;&lt;P&gt;8 flds of index in where clause,&lt;/P&gt;&lt;P&gt;There is same sql in the code before the one posted,only diff is making a check for all entries I doubt cause both sql fetching from the same table loading same object,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly Expecting more suggestions out of the above info,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 12:47:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470499#M834223</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T12:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470500#M834224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; Total load on database is 84%,&lt;/P&gt;&lt;P&gt;the SE30 will not help you here, go to the SQL Trace, measure the time for this select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; 8 fields of an index&lt;/P&gt;&lt;P&gt;does not help, see 'explain' whether this index is actually taken, and count only fields without gaps from the first one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oracle hints will of course only help with Oracle databases, so I expect you are using Oracle, the Oracle explain is quite easy to read,&lt;/P&gt;&lt;P&gt;double-click on the colored table name in the explain, this tells you total number of lines in table, and different values of fields in index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 13:35:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470500#M834224</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T13:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470501#M834225</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;Check is s_werks is not empty during data fetch. if the key field passed it empty it is as good as full table scan.&lt;/P&gt;&lt;P&gt;could u tell us the no of records fetched using this select???&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 17:03:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470501#M834225</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T17:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470502#M834226</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;I wanna add one more observation, there is a similar SQL before the one posted both fetching the same table &amp;amp; loading the same itab below is the pseudo code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If flag = ' '.&lt;/P&gt;&lt;P&gt;sql fetching from RESB loading into I_MDRS having for all entries of itab.(but there is no check made before for all entries)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exec sql one in the posting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any Ideas,&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;Edited by: chidambar dixit on Mar 15, 2008 2:13 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Mar 2008 13:13:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470502#M834226</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-15T13:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470503#M834227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chidambar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check if the itab( which is used in 'for all entries' ) is not initial before the data fetch from RESB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In MDRS Select:&lt;/P&gt;&lt;P&gt;1. make sure if s_werks is not initial. and is matnr empty acc to ur requirement???&lt;/P&gt;&lt;P&gt;2. avoid &amp;lt;&amp;gt; ,if possible , populate a range for kzvbr&lt;/P&gt;&lt;P&gt;3. avoid dbskz &amp;lt;&amp;gt; c_dbskz, and delete the unwanted records after the select.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tune your where conditions(MDRS) for improvement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Madhumitha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Mar 2008 05:25:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470503#M834227</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-16T05:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: SQL problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470504#M834228</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;you added the hint&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* Oracle hints option was added to improve performance

%_hints oracle 'FULL( MDRS ) PARALLEL( MDRS, 4 )'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the cause of your performance problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARALLEL is a non-scalable "I take all I can get CPU resources" to make the task as fast as possible&lt;/P&gt;&lt;P&gt;(but not efficient as it could be considering a multi-user environment).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider it when you do mass data processing (full table or index scans needed because you have to process a significant amount of the table's rows) preferably done in over night jobs with reduced user load on the system&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Solution:&lt;/P&gt;&lt;P&gt;1) Delete the hint &lt;/P&gt;&lt;P&gt;2) Create the missing index wich should contain all the fields that get non-Space values in the WHERE clause&lt;/P&gt;&lt;P&gt;3) read some good performance tuning books (start with the ORACLE docs on that topic)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Mar 2008 09:23:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sql-problem/m-p/3470504#M834228</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-26T09:23:21Z</dc:date>
    </item>
  </channel>
</rss>

