<?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 of ABAP query program in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-abap-query-program/m-p/7439078#M1551387</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;... layout problem ... then I had 2 anwer postings &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ähh no, thanks Thomas for editing it !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Siegfried Boes on Dec 3, 2010 10:57 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Dec 2010 09:55:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-12-03T09:55:15Z</dc:date>
    <item>
      <title>Performance of ABAP query program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-abap-query-program/m-p/7439075#M1551384</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;A custom program &lt;STRONG&gt;AQNWZ_TALAT=====TCS_AP_ITEMS==&lt;/STRONG&gt; is taking lot of time running. And when checked the cost of the select statement is very high.&lt;/P&gt;&lt;P&gt;I guessed it must be some custom abap query. Correct me if I am wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also please let me know how to do the performance tuning on this code? Should I be editing the program directly or should I edit at the abap query level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pooja&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message: &lt;SPAN __jive_macro_name="thread" id="1283414"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Dec 3, 2010 11:01 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Dec 2010 03:38:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-abap-query-program/m-p/7439075#M1551384</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-03T03:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of ABAP query program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-abap-query-program/m-p/7439076#M1551385</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;Follow these tips then u r program performance reduce.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A few tips you can use for finetuning a Report &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Use mostly primary key to access data. &lt;/P&gt;&lt;P&gt;2) Before READ u sort the itab &lt;/P&gt;&lt;P&gt;3) use mostly the indexes fields in ur where clause. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4) Restrict the the fields retrieved by your select sentences to the minimal set. (Avoid select *) &lt;/P&gt;&lt;P&gt;5) try to use specify where clause so the abap sql optimizer chooses the right index. &lt;/P&gt;&lt;P&gt;6) Avoid sentences like select lifnr name1 into corresponding fields of lfa1 from lfa1 where.... &lt;/P&gt;&lt;P&gt;(You should declare a working area and select into the working area, is twice faster) &lt;/P&gt;&lt;P&gt;7) use hashed tables instead of standard tables. They are faster. &lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; avoid the use of collect as much as you can.&lt;/P&gt;&lt;P&gt;******************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 Always check the driver internal tables is not empty , while using FOR ALL ENTRIES &lt;/P&gt;&lt;P&gt;2 Avoid for all entries in JOINS &lt;/P&gt;&lt;P&gt;3 Try to avoid joins and use FOR ALL ENTRIES. &lt;/P&gt;&lt;P&gt;4 Try to restrict the joins to 1 level only ie only for 2 tables &lt;/P&gt;&lt;P&gt;5 Avoid using Select *. &lt;/P&gt;&lt;P&gt;6 Avoid having multiple Selects from the same table in the same object. &lt;/P&gt;&lt;P&gt;7 Try to minimize the number of variables to save memory. &lt;/P&gt;&lt;P&gt;8 The sequence of fields in 'where clause' must be as per primary/secondary index ( if any) &lt;/P&gt;&lt;P&gt;9 Avoid creation of index as far as possible &lt;/P&gt;&lt;P&gt;10 Avoid operators like , &amp;gt; , &amp;lt; &amp;amp; like % in where clause conditions &lt;/P&gt;&lt;P&gt;11 Avoid select/select single statements in loops. &lt;/P&gt;&lt;P&gt;12 Try to use 'binary search' in READ internal table. Ensure table is sorted before using BINARY SEARCH. &lt;/P&gt;&lt;P&gt;13 Avoid using aggregate functions (SUM, MAX etc) in selects ( GROUP BY , HAVING,) &lt;/P&gt;&lt;P&gt;14 Avoid using ORDER BY in selects &lt;/P&gt;&lt;P&gt;15 Avoid Nested Selects &lt;/P&gt;&lt;P&gt;16 Avoid Nested Loops of Internal Tables &lt;/P&gt;&lt;P&gt;17 Try to use FIELD SYMBOLS. &lt;/P&gt;&lt;P&gt;18 Try to avoid into Corresponding Fields of &lt;/P&gt;&lt;P&gt;19 Avoid using Select Distinct, Use DELETE ADJACENT.&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;muralii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message: please refrain from copy/pasting such "information" in the future, this is the fast lane to account deletion. I'm only leaving them because Siegfried has already commented each one from a realistic point of view below.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Dec 3, 2010 10:58 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Dec 2010 05:03:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-abap-query-program/m-p/7439076#M1551385</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-03T05:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of ABAP query program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-abap-query-program/m-p/7439077#M1551386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;&amp;gt;A few tips you can use for finetuning a Report&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The actually a good collection of the most important pain points. But the recommendations are unfortunately quite poor, and even wrong. I have updated them a little bit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And for German speaking people I have added a reference to a textbook, where arll my recommendations are explained in detail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;1) Use mostly primary key to access data.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... nonsense, the task determines the WHERE clause, it is not your choice&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;2) Before READ u sort the itab&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; No&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;3) use mostly the indexes fields in ur where clause.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;... as 1, it is the other way, the task determines the WHERE-clause, make surwe that there is an index which&lt;/P&gt;&lt;P&gt;supports it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;4) Restrict the the fields retrieved by your select sentences to the minimal set. (Avoid select *)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;nonsense, most SELECT use and must use *, use field list in wide tables &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;5) try to use specify where clause so the abap sql optimizer chooses the right index.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; o.k., but who understands that in depth?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;6) Avoid sentences like select lifnr name1 into corresponding fields of lfa1 from lfa1 where....&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; feel free to use if required&lt;/P&gt;&lt;P&gt;(You should declare a working area and select into the working area, is twice faster) &lt;/P&gt;&lt;P&gt;... such general statements are always incorrect&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;7) use hashed tables instead of standard tables. They are faster&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;no, use sorted tables, hashed are very special and can only be used if there is a unique key&lt;/P&gt;&lt;P&gt;. &lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; avoid the use of collect as much as you can.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;total nonsense, use collect with hashed tables, works perfect, if you use it with standard tables, do not mix it with other statements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;1 Always check the driver internal tables is not empty , while using FOR ALL ENTRIES&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; 100% correct&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;2 Avoid for all entries in JOINS&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... not generally true&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;3 Try to avoid joins and use FOR ALL ENTRIES.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... hmmm, there are pages of discussions, this statement was wrong, is wrong and will be wrong!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;4 Try to restrict the joins to 1 level only ie only for 2 tables&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;nonsense, joins are complicated, you must know hw indexes are used, if everything is fine, then 10 or 20 tables can be joined&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;5 Avoid using Select *.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; see 4)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;6 Avoid having multiple Selects from the same table in the same object.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... try to avoid to SELECT the same data, different criteria can be necessary&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;7 Try to minimize the number of variables to save memory.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... obvious, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;8 The sequence of fields in 'where clause' must be as per primary/secondary index ( if any)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... no is must not the optimizer will not be influenced be the order , but do it, it increases readability &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;9 Avoid creation of index as far as possible&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... no, o.k. if you are not experienced than avoid ... otherwise the creation of the required indexes is absolutely mandatory for new tables, for SAP standard tables most indexes are already there. But still if very new accesses are added, then new indexes can become necessary. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;10 Avoid operators like , &amp;gt; , &amp;lt; &amp;amp; like % in where clause conditions&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... no, you must add them, but be aware that the search is only poorly supported by them, but the result set is reduced.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;11 Avoid select/select single statements in loops.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... if they are going to the database! If the tables are buffered, then these statements are perfect! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;12 Try to use 'binary search' in READ internal table. Ensure table is sorted before using BINARY SEARCH.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; .... Actually try to avoid standard tables, use sorted tables instead. If you must use a standard table, than the recommendation is true.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;13 Avoid using aggregate functions (SUM, MAX etc) in selects ( GROUP BY , HAVING,)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; .... no, use them if required. Again, if table is buffered, then they MUST be avoided. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;14 Avoid using ORDER BY in selects&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... if it is not ORDER BY PRIMARY KEY. Again, if the table is buffered, then other orders MUST be avoided. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;15 Avoid Nested Selects&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... use join. Again, if the tables are buffered, then Nested SELECTs are fine! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;16 Avoid Nested Loops of Internal Tables&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; .... impossible, there is no other option. Use sorted tables and verything is fine!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;17 Try to use FIELD SYMBOLS.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... what means try? Use ASSIGNING fieldsymbol in LOOPs, but use it in READs only for very wide tables (&amp;gt;1kB). Use it always for tables with tables in the workarea! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;18 Try to avoid into Corresponding Fields of&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; ... see 6) is wrong!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;19 Avoid using Select Distinct, Use DELETE ADJACENT.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;.... no, use it if required and if it can reduce the result set by a factor of 2 or more. Again, if table is buffered, then it MUST be avoided. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt;Wenn Sie mit der Performance Ihres ABAP Programms nicht zufrieden sind, werfen Sie doch einen Blick in mein neues Buch:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried Boes: Performance-Optimierung von ABAP®-Programmen Nov. 2009 464 Seiten  59u20AC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leseproben und weitere Informationen: &lt;A href="http://www.dpunkt.de/buecher/3096.html" target="test_blank"&gt;http://www.dpunkt.de/buecher/3096.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Thomas Zloch on Dec 3, 2010 10:53 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Dec 2010 09:47:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-abap-query-program/m-p/7439077#M1551386</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-03T09:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of ABAP query program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-abap-query-program/m-p/7439078#M1551387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;... layout problem ... then I had 2 anwer postings &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ähh no, thanks Thomas for editing it !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Siegfried Boes on Dec 3, 2010 10:57 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Dec 2010 09:55:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-abap-query-program/m-p/7439078#M1551387</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-03T09:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Performance of ABAP query program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-abap-query-program/m-p/7439079#M1551388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To hold up the spirit of the proven and reliable answer &amp;lt;b&amp;gt;it depends&amp;lt;/b&amp;gt; I couldn't resist to nitpick a bit on the updated recommendations. So all you non-sticklers don't complain to me later for having wasted your time if you continue reading...  &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div class="jive-quote"&amp;gt;3) use mostly the indexes fields in ur where clause.&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="darkblue" __jive_macro_name="color"&gt;... as 1, it is the other way, the task determines the WHERE-clause, make sure that there is an index which supports it&lt;/SPAN&gt;&amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P&gt;Depending on the size of your result set and the number of filtered entries it might actually be more efficient to do a full table scan (prime examples where this might be the case are data extracts or huge reports, see for examples [Oracle's comments on full table scans|http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/optimops.htm#i44851]). And sometimes we even need to &lt;EM&gt;convince&lt;/EM&gt; the optimizer that a full table scan is in fact better than the indirect access via an index...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;4) Restrict the the fields retrieved by your select sentences to the minimal set. (Avoid select *)&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="darkblue" __jive_macro_name="color"&gt;...nonsense, most SELECT use and must use *, use field list in wide tables&lt;/SPAN&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;By selecting only the columns I need I give the database a chance to possibly read less data and then also transfer less data over the network to the application server (and possibly less data in memory on the app server, which was found to be beneficial in 7). I don't see why I would use &lt;SPAN __default_attr="Courier New" __jive_macro_name="font"&gt;select *&lt;/SPAN&gt; unless I need all fields (or almost all fields if my result set is not too large) and in that case the &lt;EM&gt;minimal set&lt;/EM&gt; corresponds to &lt;EM&gt;all fields&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;11) Avoid select/select single statements in loops.&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="darkblue" __jive_macro_name="color"&gt;... if they are going to the database! If the tables are buffered, then these statements are perfect!&lt;/SPAN&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm not sure if &lt;EM&gt;perfect&lt;/EM&gt; is the right expression, I'd replace it with &lt;EM&gt;usually ok&lt;/EM&gt;. If the data is actually available in the buffer depends obviously on the table buffering strategy (i.e. full versus partial) and what data you're reading how and when (and obviously reading data from a buffered table that is not yet buffered cannot be faster then reading data from a table without buffering).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly the recommendation for 13 (must avoid aggregate functions for buffered tables) and 19 (must avoid select distinct for buffered tables) also seem to be based on the assumption that either the table is fully buffered or most required rows are buffered. Even if that's true, I'd personally have performance in the back of my mind while coding, but would try to avoid any [premature optimization|http://en.wikipedia.org/wiki/Premature_optimization#When_to_optimize] and first of all stick to [KISS|http://en.wikipedia.org/wiki/KISS_principle]: If my coding is more readable and shorter, even though my select bypasses table buffering, why should I forgo it unless I measured some actual performance impact?!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;14) Avoid using ORDER BY in selects&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="darkblue" __jive_macro_name="color"&gt;... if it is not ORDER BY PRIMARY KEY. Again, if the table is buffered, then other orders MUST be avoided. &lt;/SPAN&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I think I've babbled too much already on table buffering, so let me skip this here. However, I strongly disagree with generally restricting &lt;SPAN __default_attr="Courier New" __jive_macro_name="font"&gt;order by&lt;/SPAN&gt; to the table's primary key (even for non-buffered tables). I thought the &lt;SPAN __default_attr="Courier New" __jive_macro_name="font"&gt;order by&lt;/SPAN&gt; is usually an operation on the result set - so why not let the database sort a small result set?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And even if the result set is larger, we still might be as efficient as without the &lt;SPAN __default_attr="Courier New" __jive_macro_name="font"&gt;order by&lt;/SPAN&gt; clause if the table has an index for those fields (the prime example is obviously where sort fields and main condition fields are in &lt;EM&gt;one&lt;/EM&gt; appropriate index).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not to mention the fact that I have in fact also used the &lt;SPAN __default_attr="Courier New" __jive_macro_name="font"&gt;order by&lt;/SPAN&gt; clause successfully to push the Oracle optimizer in the right direction (i.e. use of appropriate index) without having to specify any hints (probably due to the approach described in [optimizing with order by|http://download.oracle.com/docs/html/A95912_01/wn32tune.htm#i631241]).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, harald&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Dec 2010 23:04:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-of-abap-query-program/m-p/7439079#M1551388</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-04T23:04:41Z</dc:date>
    </item>
  </channel>
</rss>

