<?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: Optimisation-SQL in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447355#M548246</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Execute ur program in one session and in an another session go to transaction SM50. Here u can see on which table ur select is taking the most time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now check this select of urs on this particular table, check for the available index. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go to ST05 and check whether ur select is picking up any of the available index else try creating an index based on ur selection criteria, now check again whether ur select is picking up the index u created, now check the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Retrieve only the necessary fields and put it in the same sequence as it is in the table. Avoid using MOVE CORRESPONDING, avoid SELECT - ENDSELCTS, avoid SELECTS inside a loop, instead SELECT the data before the loop and read it inside the loop. Check all ur READ statements if any, use BINARY SEARCH along with the READ statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And abt ur question on the varying execution time, as Arun has mentioned the execution time depends on various factors like the load on the database, the network, the number of users accessing the data, etc. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope these help u.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jun 2007 08:24:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-21T08:24:48Z</dc:date>
    <item>
      <title>Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447341#M548232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.I have a program which is having 10 select statements.Is there any way to know which select statement is eating most of the time and thus reducing the execution speed.Can ST05 or SE30 of any use in this case.&lt;/P&gt;&lt;P&gt;2.Does SYST has any field which lets us know the total amount of time a program is taking to display the output.&lt;/P&gt;&lt;P&gt;3.Suppose if we are joining two tables using inner join does the sequence of fields that we write in the select statement effects the performance.Do we need to write the fields in the same sequence as they are in the table?&lt;/P&gt;&lt;P&gt;4.Any hints to improve the execution speed are welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:25:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447341#M548232</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2007-06-20T13:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447342#M548233</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 can reduce time changing select.. endselect to select into table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use select... for all entries when possible &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;verify if you realy need to select all tables and all fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:33:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447342#M548233</guid>
      <dc:creator>rodrigo_paisante3</dc:creator>
      <dc:date>2007-06-20T13:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447343#M548234</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)goto se30 enter ur program in program field and press execute button execute ur program and come back.click on EVALUATE button.graph will come in thatselect hit list button it will give u detailed calculation of time statement wise.&lt;/P&gt;&lt;P&gt;2)no such syst field is there.&lt;/P&gt;&lt;P&gt;3)fields sequence will not effect the performance.&lt;/P&gt;&lt;P&gt;4)follow this link&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ABAPSort.asp" target="test_blank"&gt;http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ABAPSort.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;reward points if helpful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:34:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447343#M548234</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T13:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447344#M548235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1.) ST05 is the tool I most often use for this type of analysis.&lt;/P&gt;&lt;P&gt;2.) I don't think so.&lt;/P&gt;&lt;P&gt;3.) Probably not, but I think it's good programming style to put them in "index" order.&lt;/P&gt;&lt;P&gt;4.) Run ST05 and post the code of the problem SELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:35:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447344#M548235</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T13:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447345#M548236</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. ST05 or SE30 and coverage analyzer are tools for validating the performance. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. No SYST field will tell you the amount of time taken in select statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. If you cannot use primary key always check for secondary index associated with table. &lt;/P&gt;&lt;P&gt;or check for any database view are available?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check for your read table statements if you have then use with binary search. pl. remember use sort the internal table with key before binary search&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;aRs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:39:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447345#M548236</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2007-06-20T13:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447346#M548237</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;if u do not write the fields in the same sequence u will have to use&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF which is not advisable to use&lt;/P&gt;&lt;P&gt;so its better to write the fields in the same sequence as they are in the table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;even joins reduce the system performance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;prefer to use FOR ALL ENTRIES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;ravish&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;plz dont forget to reward points if helpful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:40:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447346#M548237</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T13:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447347#M548238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4.) Run ST05 and post the code of the problem SELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had pasted that particulat select statement in st05 after checking sql trace-activate trace and enter seql statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please let me know how to use st05 in this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:45:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447347#M548238</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2007-06-20T13:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447348#M548239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try it this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In one session, set a break point in your code to stop at he select and execute the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In another session, start ST05 (activate the trace) after the brteakpoint is reached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the program is ended deactivate the trace and list it. You should see problem points in the trace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:49:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447348#M548239</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T13:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447349#M548240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran , &lt;/P&gt;&lt;P&gt;  Yes ST05 will help you find which SQL statement is taking a lot of time.&lt;/P&gt;&lt;P&gt;There is also one option to find which part of the code takes a lot of time.&lt;/P&gt;&lt;P&gt;You need to use GET RUNE TIME command.&lt;/P&gt;&lt;P&gt;Here is a templeat of how to use this command&lt;/P&gt;&lt;P&gt;DATA: T1 TYPE I, T2 TYPE I.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;GET RUNE TIME FIELD T1.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   SOURCE CODE LINES &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;GET RUN TIME FIELD T2.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;TAKE DIFF. (T2-T1) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Assign points if helpful&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jun 2007 13:50:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447349#M548240</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-20T13:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447350#M548241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;Can anyone here please confirm "time taken to execute sql"  in the list output is exactly the amount of time that this sql statement has taken to fetch the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please execute the program to see the time taken and then comment on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZOPT                                    .&lt;/P&gt;&lt;P&gt;data:begin of imakt occurs 0,&lt;/P&gt;&lt;P&gt;     matnr like makt-matnr,&lt;/P&gt;&lt;P&gt;     spras like makt-spras,&lt;/P&gt;&lt;P&gt;     maktx like makt-maktx,&lt;/P&gt;&lt;P&gt;     end of imakt.&lt;/P&gt;&lt;P&gt;DATA: T1   TYPE I,&lt;/P&gt;&lt;P&gt;      T2   TYPE I,&lt;/P&gt;&lt;P&gt;      TMIN TYPE I.&lt;/P&gt;&lt;P&gt;TMIN = 1000000.&lt;/P&gt;&lt;P&gt;GET RUN TIME FIELD T1.&lt;/P&gt;&lt;P&gt;select matnr spras maktx from makt into table imakt where spras = sy-langu.&lt;/P&gt;&lt;P&gt;  GET RUN TIME FIELD T2.&lt;/P&gt;&lt;P&gt;  T2 = T2 - T1.&lt;/P&gt;&lt;P&gt;  IF T2 &amp;lt; TMIN.&lt;/P&gt;&lt;P&gt;    TMIN = T2.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;WRITE: 'Time taken for Execution of SQL:', TMIN, 'microseconds'.&lt;/P&gt;&lt;P&gt;loop at imakt.&lt;/P&gt;&lt;P&gt;write:/ imakt-matnr,imakt-spras,imakt-maktx.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Kiran K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 06:55:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447350#M548241</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2007-06-21T06:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447351#M548242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Every time it is run,the time taken varies.Why?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 07:55:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447351#M548242</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2007-06-21T07:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447352#M548243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran , &lt;/P&gt;&lt;P&gt;  The time taken will never be the same , as the time taken also depends on many other factors like network congention , and many other similar functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 08:03:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447352#M548243</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T08:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447353#M548244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Arun,&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;Can you please go through the prog i had pasted above and let me know whether the time taken shown in the list output is the time taken by the sql statement to fetch the data.Please confirm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 08:08:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447353#M548244</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2007-06-21T08:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447354#M548245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran , &lt;/P&gt;&lt;P&gt;  It is partially correct , but i am not clear why have you used the code given below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;IF T2 &amp;lt; TMIN.&lt;/P&gt;&lt;P&gt;TMIN = T2.&lt;/P&gt;&lt;P&gt;ENDIF.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually T2 is the time taken for the select statement , your program will given an incorrect time if T2 is greater than 1000000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 08:14:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447354#M548245</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T08:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447355#M548246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Execute ur program in one session and in an another session go to transaction SM50. Here u can see on which table ur select is taking the most time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now check this select of urs on this particular table, check for the available index. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Go to ST05 and check whether ur select is picking up any of the available index else try creating an index based on ur selection criteria, now check again whether ur select is picking up the index u created, now check the performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Retrieve only the necessary fields and put it in the same sequence as it is in the table. Avoid using MOVE CORRESPONDING, avoid SELECT - ENDSELCTS, avoid SELECTS inside a loop, instead SELECT the data before the loop and read it inside the loop. Check all ur READ statements if any, use BINARY SEARCH along with the READ statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And abt ur question on the varying execution time, as Arun has mentioned the execution time depends on various factors like the load on the database, the network, the number of users accessing the data, etc. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope these help u.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 08:24:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447355#M548246</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T08:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447356#M548247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bala,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had executed the report.&lt;/P&gt;&lt;P&gt;I went to sm50.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is showing some list which I was not able to makeout what exactly it is displaying.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So,glad if you can throw some light on this area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a ton to everybody.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 08:52:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447356#M548247</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2007-06-21T08:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447357#M548248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: T1 TYPE I,&lt;/P&gt;&lt;P&gt;T2 TYPE I,&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;GET RUN TIME FIELD T1.&lt;/P&gt;&lt;P&gt;select matnr spras maktx from makt into table imakt where spras = sy-langu.&lt;/P&gt;&lt;P&gt;GET RUN TIME FIELD T2.&amp;lt;/b&amp;gt;T2 = T2 - T1.&lt;/P&gt;&lt;P&gt;write:/ t2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some doubts.&lt;/P&gt;&lt;P&gt;1.If we give any statement in between get run time field t1 and get run time field t2 it will return the time taken to execute that statement.right?&lt;/P&gt;&lt;P&gt;2.why two fields t1 and t2?&lt;/P&gt;&lt;P&gt;3.Here it is giving the time taken by the sql to fetch the data,right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 09:19:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447357#M548248</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2007-06-21T09:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447358#M548249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kiran&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Double click on ur username in that list where it is taking long time, it will give more information abt the process which u are executing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SM50 gives u a list of all the process that are running in the system. Here u can find out which process is taking lot of time and it even lists out the action the process is performing and on which table. So based on these information u can determine whether a sequential read on a particular table is taking a very long time then. It even gives u the select statement which is taking the long time when u double click. now pick this select and use in ST05 and follow the steps that I had mentioned earlier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check it and let me know if u need any further help here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dont forget to keep refreshing the list in SM50 when ur program is executing. &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Elanchezhian Balasubramanian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 09:37:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447358#M548249</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T09:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447359#M548250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bala,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you said it is showing the user name but not the report name that I had executed.When I clikc on the user name it is showing some data having "last sql statement" which is no way related to my program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now coming to st05,it is showing data some in dark yellow and some in light yellow and some TIME in pink.Does they infer anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Under duration for prepare,fetch and open it is showing some duration,which one we should consider.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry to bug you all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;K.Kiran.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jun 2007 09:51:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447359#M548250</guid>
      <dc:creator>kiran_k8</dc:creator>
      <dc:date>2007-06-21T09:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Optimisation-SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447360#M548251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kiran - unfortunately, the same sSQL tatement can vary wildly in times taken to execute. Partly due to different system loads but more importantly due to buffering. Not SAP necessarily buffering - there are other types of buffering going on that you never see or hear about. Typically, the first time you execute a statement, it takes the longest.From the SAP help on "GET RUN TIME:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"SAP recommends that you measure the runtime several times and take the minimum result. "&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, 21 Jun 2007 13:24:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimisation-sql/m-p/2447360#M548251</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-21T13:24:10Z</dc:date>
    </item>
  </channel>
</rss>

