<?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 issue for select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688070#M302652</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a quick addition to Awesome Rob's code&lt;/P&gt;&lt;P&gt;(That's what we call Rob at our work place. I am surprised that Fantastic Rich did not take a stab at this). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES:
  BEGIN OF ty_afvc,
    aufpl TYPE afvc-aufpl,
    aplzl TYPE afvc-aplzl,
    .... Add any other
    .... fields that
    .... you need from table AFVC
  END OF ty_afvc.

TYPES:
  BEGIN OF ty_catsdb,
    counter   TYPE catsdb-counter,
    workdate  TYPE catsdb-workdate,
    raufpl    TYPE catsdb-raufpl,
    raplzl    TYPE catsdb-raplzl,
    status    TYPE catsdb-status,
    catshours TYPE catsdb-catshours,
    del_flag(1) TYPE c, "Add as last field
  END OF ty_catsdb.

DATA:
  it_afvc TYPE SORTED TABLE OF ty_afvc
    INITIAL SIZE 0
    WITH HEADER LINE
    WITH UNIQUE KEY aufpl aplzl.

DATA:
  it_catsdb TYPE STANDARD TABLE OF ty_catsdb
    INITIAL SIZE 0
    WITH HEADER LINE.

FIELD-SYMBOLS:
  &amp;lt;fs_catsdb&amp;gt; TYPE ty_catsdb.

**DATA: cat_index LIKE sy-tabix.
SELECT counter workdate raufpl raplzl status catshours
  FROM catsdb
  INTO  TABLE it_catsdb
  WHERE workdate &amp;lt; sy-datum
  AND   status EQ '30'.

**SORT: it_afvc   BY aufpl aplzl,
**      it_catsdb BY raufpl raplzl.

&amp;lt;i&amp;gt;*it_afvc is already sorted since it is defined as a sorted table. 
*Personally, I would not do the below SORT also, since I don't gain anything from it.&amp;lt;/i&amp;gt;
SORT it_catsdb BY raufpl raplzl.

LOOP AT it_catsdb ASSIGNING &amp;lt;fs_catsdb&amp;gt;.
**  cat_index = sy-tabix.
**  READ TABLE it_afvc WITH KEY
**    aufpl = it_catsdb-raufpl
**    aplzl = it_catsdb-raplzl
**    BINARY SEARCH.
**  IF sy-subrc &amp;lt;&amp;gt; 0.
**    DELETE it_catsdb INDEX cat_index.
**  ENDIF.
  READ TABLE it_afvc TRANSPORTING NO FIELDS
    WITH KEY aufpl = &amp;lt;fs_catsdb&amp;gt;-raufpl
             aplzl = &amp;lt;fs_catsdb&amp;gt;-raplzl
             BINARY SEARCH.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    &amp;lt;fs_catsdb&amp;gt;-del_flag = 'X'.
&amp;lt;i&amp;gt;*Note that there is no MODIFY statement. Not needed.
*The field-symbol is already pointing to the actual table row.&amp;lt;/i&amp;gt;
  ENDIF.
ENDLOOP.

DELETE it_catsdb WHERE del_flag EQ 'X'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The three things I did are:&lt;/P&gt;&lt;P&gt;1.)&lt;/P&gt;&lt;P&gt;LOOP AT &amp;lt;itab&amp;gt; &amp;lt;b&amp;gt;ASSIGNING &amp;lt;field-symbol&amp;gt;&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;With this, there is no transfer of data from table row to table header. Makes it faster&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.)&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;b&amp;gt;TRANSPORTING NO FIELDS&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;We just need to check if a record exists. There is no need to really move data from table row to table header.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.)&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&amp;lt;fs_catsdb&amp;gt;-del_flag = 'X' and I did the delete outside the loop.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;If we are deleting a record in an internal table while looping on itself, the ABAP processing time increases since the table gets re-indexed everytime a delete takes place.&lt;/P&gt;&lt;P&gt;Instead, it is better to set a flag and do the delete outside (Learnt it the hard way).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;-Ramesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Nov 2006 23:35:17 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-11-01T23:35:17Z</dc:date>
    <item>
      <title>Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688044#M302626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Friends,&lt;/P&gt;&lt;P&gt;          &lt;/P&gt;&lt;P&gt;            Iam getting the performance problem for this below statement and its running lot of time in debug mode itself and timingout and in catsdb table raufpl and raplzl  fields are not keyelments .Actually for this select statement iam taking the data from AFVC table aufpl and aplzl.&lt;/P&gt;&lt;P&gt;  IF NOT it_afvc[] IS INITIAL.&lt;/P&gt;&lt;P&gt;  SELECT  counter workdate raufpl raplzl status catshours FROM catsdb&lt;/P&gt;&lt;P&gt;           INTO TABLE it_catsdb&lt;/P&gt;&lt;P&gt;           FOR ALL ENTRIES IN it_afvc&lt;/P&gt;&lt;P&gt;           WHERE workdate &amp;lt; sy-datum&lt;/P&gt;&lt;P&gt;            and  raufpl = it_afvc-aufpl&lt;/P&gt;&lt;P&gt;            AND  raplzl = it_afvc-aplzl&lt;/P&gt;&lt;P&gt;            AND  status EQ '30'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please suggest any one how to optize fro this statement &lt;/P&gt;&lt;P&gt;points will be award and your answers are highly apprciable &lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Govind&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 09:42:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688044#M302626</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T09:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688045#M302627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create an Index on the table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 09:55:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688045#M302627</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T09:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688046#M302628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your case it seems that the number of records it is trying to fetch is causing the issue...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;The solution for the same is to either select the data using package size OR use Cursors.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 09:57:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688046#M302628</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T09:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688047#M302629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;generally...u need to compramise on performance or the no of records..fetch records in a fixed time and ur problem would be solved. and the other thing which may b small but advisable is to use symbols where ever possible donot use EQ instead use =.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;santhosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 10:18:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688047#M302629</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T10:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688048#M302630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Govind&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would say your problem is that you are not using keys or an index.  The table already has 5 indices (on our system anyway) so adding another might affect the performance of any updates to this table.  There are 2 existing indices which might be of use;&lt;/P&gt;&lt;P&gt;1. Uses Pernr, Status and Workdate&lt;/P&gt;&lt;P&gt;2. Uses Pernr and Workdate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously these are no use if you haven't got the Pernr - is there anyway that you can re-write your previous code to get a Pernr value?  You can then make use of the either of these indices.  Given that you are not testing for equality against workdate (i.e. workdate &amp;lt; sy-datum rather than workdate = a_date) the first one would be my preference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other than that you might have to use Packages or Cursors - it would be better to try and use an index though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps &lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 10:43:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688048#M302630</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T10:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688049#M302631</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;     In my code pernr it wont come actually iam calculating for each project wise getting the total no of catshours.&lt;/P&gt;&lt;P&gt;Can u pls suggest how i will use package or cursor concept ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;govind&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 11:57:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688049#M302631</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T11:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688050#M302632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;govind&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One thing you can try your hand at. just comment the code  'workdate &amp;lt; sy-datum'. once you select all the entries into table it_catsdb, then delete records where workdate &amp;lt; sy-datum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. just check how much of data is there in the table for your select query. if the volume of record is more, then check size of your internal table i.e., it_catsdb. if frequently paging is done, this will also hamper performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;shane&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 11:57:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688050#M302632</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T11:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688051#M302633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Data : C1 type cursor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open cursor C1 for select * from dbtable where &lt;SPAN __jive_macro_name="conditions"&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;Do.&lt;/P&gt;&lt;P&gt;  fetch next cursor C1 into wa.&lt;/P&gt;&lt;P&gt;  if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;     Close cursor.&lt;/P&gt;&lt;P&gt;     Exit.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;  ==&amp;gt;process the data&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 12:01:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688051#M302633</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T12:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688052#M302634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shane,&lt;/P&gt;&lt;P&gt;         okay, actually in it_catsdb getting around 90,000&lt;/P&gt;&lt;P&gt;records ,at the time of debugging the cursor its not moving out of this select statement and timingout .Is any other possible ways i will do?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Govind&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 12:05:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688052#M302634</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T12:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688053#M302635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;is it happening, even after removing code " workdate &amp;lt; sy-datum" from select query? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and secondly what is the size of your internal table. i mean to say you would have declared something like &lt;/P&gt;&lt;P&gt;it_catsdb initial size 100 / it_catsdb occurs 100. whatever you have declared, what is that size.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 12:57:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688053#M302635</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T12:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688054#M302636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shane,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          yes right now i removed workdate and still its timing out bcz of some 90,000 records and I declared internal table it_catdsdb size 0 ie occurs 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Govind&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 13:04:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688054#M302636</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T13:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688055#M302637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yes i can understand it is getting tough on you. but one thing you are selecting for all entries in it_afvc. so is there any means you can select " COUNTER " field into it_afvc prior to selecting data from db table CATSDB. do you understand what i mean to say. first you would be filling internal table IT_AFVC. so what i mean to say over here is, if you can fill this table by the field  "COUNTER " prior to selecting data from CATSDB, then it may solve your problem. beacuse COUNTER is the key field over there. so that time your code looks like follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort it_afvc by counter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF NOT it_afvc[] IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT counter workdate raufpl raplzl status catshours FROM catsdb&lt;/P&gt;&lt;P&gt;INTO TABLE it_catsdb&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_afvc&lt;/P&gt;&lt;P&gt;WHERE counter = it_afvc-counter&lt;/P&gt;&lt;P&gt;and raufpl = it_afvc-aufpl&lt;/P&gt;&lt;P&gt;AND raplzl = it_afvc-aplzl&lt;/P&gt;&lt;P&gt;AND status EQ '30'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if there is no such provision of doing so, then probably you have to use the technique of PACKAGE SIZE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it makes sense for you and works&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;shane&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 13:25:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688055#M302637</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T13:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688056#M302638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How many records (total) in catsdb?&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, 27 Oct 2006 13:41:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688056#M302638</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T13:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688057#M302639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shane,&lt;/P&gt;&lt;P&gt;          I checked it in AFVC table here didn't have the counter field but its exist only in catsdb but u mentioned &amp;lt;b&amp;gt;WHERE counter = it_afvc-counter&amp;lt;/b&amp;gt; ??&lt;/P&gt;&lt;P&gt;and can you please tell how i will use  PACKAGE SIZE ?&lt;/P&gt;&lt;P&gt;Your answers are highly appreciable &lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Govind&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 14:08:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688057#M302639</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T14:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688058#M302640</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;         In catsdb total records around 6 lakh but at the time of seeing the data from AFVC table to CATSDB &lt;/P&gt;&lt;P&gt;ie afvc-aufpl = catsdb-raufpl and afvc-aplzl = catsdb-raplzl for this getting around 90,000 records for these records in debug mode the cursor not moving out from this select statement and timing out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Govind&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 14:12:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688058#M302640</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T14:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688059#M302641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK - does this SELECT run more quickly or more slowly than yours:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT counter workdate raufpl raplzl status catshours
  FROM catsdb
  INTO  TABLE it_catsdb
  WHERE workdate &amp;lt; sy-datum
  AND   status EQ '30'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 14:25:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688059#M302641</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T14:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688060#M302642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Govind&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure about packages or cursors having never had to use them.  However, I wonder if there would be any benefit in creating a select-option style table based on the counter field.  You could then populate it with ranges of data, for example, 1 to 30000 (depending on the contents of the field).  You could then put the main select within a loop that increments the range on each iteration i.e. 2nd iteration would be 30001 to 60000 until the select returns no records.  After each select you would then append the lines to a main internal table that will eventually hold all the relevant records.  It would be using the PK field but as it would be selecting all records I don't know if there would be a performance gain - perhaps other people would like to comment on the principle?  The thought has only just occurred to me so I suspect it is fatally flawed somewhere but might be worth a shot!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I still suspect the poor performance is down to not using PK or index fields effectively as much as the number of records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 14:59:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688060#M302642</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-27T14:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688061#M302643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;govind&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i can see, this chapter getting hard on you. but finally, i have two proposals for you. firstly, if your selection criteria does not fit with any of the existing indexes, then probably you have to create one more index according to your selection criteria, which means your db index should consider the following fields in your case:&lt;/P&gt;&lt;P&gt;1. raplzl&lt;/P&gt;&lt;P&gt;2. raplzl&lt;/P&gt;&lt;P&gt;3. workdate&lt;/P&gt;&lt;P&gt;but mind one thing, the order of the index should be decided by you. like frequently, based on which fields and in what order you are retrieving data from CATSDB. also one more thing you have to look at. that is how many indexes are already existing in database for CATSDB. if there are more than 5 - 6 number of indexes already existing in database, then it is quite risky to build one more index, before deleting one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the second and final proposal from my side is if non of the technique works in your case, then you should get back to your basis guyz regarding the timeout issue, probably they can increase the timeout duration for the test ambience.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it helps&lt;/P&gt;&lt;P&gt; shane&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 05:51:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688061#M302643</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T05:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688062#M302644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oops!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i would like to make slight change on my recent posting.&lt;/P&gt;&lt;P&gt;before creating new index, just give one trial with the existing index if any, with the fields as &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. PERNR&lt;/P&gt;&lt;P&gt;2. STATUS&lt;/P&gt;&lt;P&gt;3. WORKDATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in your case you are using combination of the fields status and workdate. so just give a little trial to this index. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;shane&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 06:00:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688062#M302644</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T06:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue for select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688063#M302645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Shane,&lt;/P&gt;&lt;P&gt;       In my catsdb table already 5 database indexes are created i think for a database table only 5 database indexes are possible right? and my basis person also not ready to increase the time out period from 5 mts.&lt;/P&gt;&lt;P&gt;Actually as of now i used package size and cursor technique also still for these also timing out and the existing index pernr status workdate anyway its exist but still taking time (but in my select query pernr wont come). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Govind&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 14:12:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-for-select-statement/m-p/1688063#M302645</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T14:12:21Z</dc:date>
    </item>
  </channel>
</rss>

