<?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 problem in accessing custom table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589035#M592647</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;  1) I need all the fields. Select * is essential.&lt;/P&gt;&lt;P&gt;  2) it_cust_head[] is being checked for contents before the for all entries.&lt;/P&gt;&lt;P&gt;  3) Primary index should have fired since field docuument is part of primary keys but the secondary index is picked up automatically even though I am not mentioning HINTS anywhere.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Helllllp....&lt;/P&gt;&lt;P&gt;Rgds.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Aug 2007 13:40:57 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-03T13:40:57Z</dc:date>
    <item>
      <title>Performance problem in accessing custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589031#M592643</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 am accessing a Z table with around 50 fields including two primary key fields Document and line item number. Number of entries are 400000. I have the following select in program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT *&lt;/P&gt;&lt;P&gt;    FROM   YORDER&lt;/P&gt;&lt;P&gt;    INTO TABLE it_customer&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN it_cust_head&lt;/P&gt;&lt;P&gt;    WHERE  document  = it_cust_head-doc_num.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ST05, the above trace took a lot of time and it appears in red. Also the index picked up by the program appears to be the one created and not the default one since the key document passed is a key field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The execution plan of the statment is as follows :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT STATEMENT ( Estimated Costs = 83 , Estimated #Rows = 65,836 )&lt;/P&gt;&lt;P&gt;                                                                     &lt;/P&gt;&lt;P&gt;      TABLE ACCESS BY INDEX ROWID YORDER                                                                                &lt;/P&gt;&lt;P&gt;INDEX RANGE SCAN YORDER~Z01 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two issues here:-&lt;/P&gt;&lt;P&gt;1) Performance is very slow.&lt;/P&gt;&lt;P&gt;2) Wrong index is picked up when one of the primary key fields is the basis on which the selection is done.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone has nay ideas on performance improvement here ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 13:20:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589031#M592643</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T13:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem in accessing custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589032#M592644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi RK,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Specify the required field names instead of * in the select query.&lt;/P&gt;&lt;P&gt;2. Check it_cust_head[] is not inital before using for all entries.&lt;/P&gt;&lt;P&gt;3. if still there is a problem, create a secondary index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward for helpful answers.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 13:30:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589032#M592644</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T13:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem in accessing custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589033#M592645</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;Have you using &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
if not it_cust_head[] is initial.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;before calling select all entries ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can force the sql statement to use a particular index by using %_HINTS parameter. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aRs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 13:31:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589033#M592645</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-08-03T13:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem in accessing custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589034#M592646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please provide the fields of the pprimary key and  the fields of the index Z01,&lt;/P&gt;&lt;P&gt;which one contains field 'document', at which position?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 13:36:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589034#M592646</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T13:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem in accessing custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589035#M592647</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;  1) I need all the fields. Select * is essential.&lt;/P&gt;&lt;P&gt;  2) it_cust_head[] is being checked for contents before the for all entries.&lt;/P&gt;&lt;P&gt;  3) Primary index should have fired since field docuument is part of primary keys but the secondary index is picked up automatically even though I am not mentioning HINTS anywhere.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Helllllp....&lt;/P&gt;&lt;P&gt;Rgds.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 13:40:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589035#M592647</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T13:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem in accessing custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589036#M592648</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;(1) first of all : Always check if table is empty before any SELECT FOR ALL ENTRIES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(2) Only read data wanted: Please remove that *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(3) If the index you want is not the primary one, check under SE11 if it is actually active in the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(4) If nothing works try to give hints to SQL (Look at OSS &amp;lt;a href="https://service.sap.com/sap/support/notes/129385"&amp;gt;Note 129385 - Database hints in Open SQL&amp;lt;/a&amp;gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(5) Upgrade you hardware?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 13:43:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589036#M592648</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2007-08-03T13:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem in accessing custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589037#M592649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don't have the FULL primary key, SQL won't choose this index automatically, Try to put the full key, even if you have to use a : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE FIELD IN SO-FIELD where SO-FIELD is an empty range, or a dummy range (like 000000-999999) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Better if you can fill the range with the true values (maybe Society, Status, Year?)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the first keys have too many values, the SQL optimization will not give any miracle, maybe if you transaction is often called, could you build an index, or build a new table with your data available, filled by a periodic job ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 13:48:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589037#M592649</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2007-08-03T13:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem in accessing custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589038#M592650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so that case    ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"Replace your  select statment with  my statements  ... &lt;/CODE&gt;&lt;/PRE&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;DATA  YORDER_tab TYPE TABLE OF YORDER. 
FIELD-SYMBOLS &amp;lt;YORDER&amp;gt; TYPE YORDER. 

SELECT *FROM YORDER INTO correspnding fields  of table   TABLE    YORDER_itab .

loop at  it_cust_head.

read table   YORDER_itab with    key  document =  it_cust_head-doc_num  ASSIGNING  &amp;lt;YORDER&amp;gt; .
if  sy-subr = 0 .
move   &amp;lt;YORDER&amp;gt;  to   it_customer .
endif.
Append  it_customer .
endloop .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"now see  what  was the  performance  of  your program .&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward  points if it is usefull ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Girish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Aug 2007 13:53:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589038#M592650</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-03T13:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem in accessing custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589039#M592651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; Primary index should have fired since field docuument is part of primary keys b&lt;/P&gt;&lt;P&gt;the question was not whether it is a part of the primary key, but whether the primary key starts with the document field. I guess it does not.Then the primary key will not be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; WHERE FIELD IN SO-FIELD where SO-FIELD is an empty&lt;/P&gt;&lt;P&gt;&amp;gt; range, or a dummy range (like 000000-999999) &lt;/P&gt;&lt;P&gt;this is not recommended and actually quite useless.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; SELECT *FROM YORDER INTO correspnding fields  of&lt;/P&gt;&lt;P&gt;&amp;gt; table   TABLE    YORDER_itab .&lt;/P&gt;&lt;P&gt;this is also not recommended! I don't know your data distrubution, but you have a where condition, so you read only a fraction of the full table. Here you would read the full table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=&amp;gt; please check whether you know other conditions, and add them to the where condition&lt;/P&gt;&lt;P&gt;=&amp;gt; if not, then check selectivity of field 'document' how many different values of document appear in the table?&lt;/P&gt;&lt;P&gt;=&amp;gt; if less thant 10 different values, then nothing will help you, if more than 10 (the more the better) then you should create a new index, with field 'client document'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 09:05:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589039#M592651</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T09:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem in accessing custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589040#M592652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Two ideas:&lt;/P&gt;&lt;P&gt;1) replace your query with a join, something like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SELECT * FROM YORDER inner join it_cust_head on YORDER~document = it_cust_head~doc_num
  INTO corresponding fields of TABLE it_customer.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;2) better yet, use a range (doesn' t work if you need too many entries for the range, 512 on my system):&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
ranges: rord for YORDER-document.
free rord.
rord = 'IEQ'.
select document from it_cust_head into rord-low.
  append rord.
endselect.

SELECT * FROM YORDER
INTO TABLE it_customer
WHERE document in rord.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 09:24:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589040#M592652</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T09:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: Performance problem in accessing custom table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589041#M592653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to all for the solutions.. Including the primary key as well helped a lot..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2007 13:46:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-problem-in-accessing-custom-table/m-p/2589041#M592653</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-06T13:46:45Z</dc:date>
    </item>
  </channel>
</rss>

