<?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: issue with select query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169267#M1371364</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; I would like to suggest one thing, when using tabke in joins use like this&lt;/P&gt;&lt;P&gt;&amp;gt; mseg as a l mkpf as b then  use a and b instead of entire table names&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi, Kartik&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this way it will take some more Seconds to Execute, because first it will get meaning of &lt;STRONG&gt;a&lt;/STRONG&gt; than &lt;STRONG&gt;b&lt;/STRONG&gt; if we will not directly provide table names ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please Correct me if wrong&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;@ Babu: Please try to USE More Meaningful Subject Line&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Faisal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Oct 2009 04:43:40 GMT</pubDate>
    <dc:creator>faisalatsap</dc:creator>
    <dc:date>2009-10-01T04:43:40Z</dc:date>
    <item>
      <title>issue with select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169265#M1371362</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;I have written a join on MSEG and MKPF table in a program and execute the program in two different systems (say A and B) which has same amount of data and also have the same indexes in the tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;System A is taking 32000 seconds and System B is taking 600 seconds for the same input and output also same because of similar data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried many options like splitting the join, usage of index, using view WB2_V_MKPF_MSEG2 in place of join etc.. to increase the performance in System A but performance not improved. And one more thing what i observed is if i provide the same inputs for mseg in se11 , it is giving all the required entries in just 100 seconds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know the reason why the query in program is taking time in system A. Is it due to any memory issue? Please provide solution for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my select query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT mseg~mblnr&lt;/P&gt;&lt;P&gt;           mseg~bwart&lt;/P&gt;&lt;P&gt;           mseg~matnr&lt;/P&gt;&lt;P&gt;           mseg~werks&lt;/P&gt;&lt;P&gt;           mseg~lgort&lt;/P&gt;&lt;P&gt;           mseg~charg&lt;/P&gt;&lt;P&gt;           mseg~zeile&lt;/P&gt;&lt;P&gt;           mkpf~budat&lt;/P&gt;&lt;P&gt;    INTO TABLE P_T_LASTDT&lt;/P&gt;&lt;P&gt;    FROM mseg INNER JOIN mkpf&lt;/P&gt;&lt;P&gt;    ON  mseg&lt;SUB&gt;mandt = mkpf&lt;/SUB&gt;mandt&lt;/P&gt;&lt;P&gt;    AND mseg&lt;SUB&gt;mblnr = mkpf&lt;/SUB&gt;mblnr&lt;/P&gt;&lt;P&gt;    AND mseg&lt;SUB&gt;mjahr = mkpf&lt;/SUB&gt;mjahr&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN P_T_MCHB&lt;/P&gt;&lt;P&gt;    WHERE mseg~matnr = p_t_mchb-matnr&lt;/P&gt;&lt;P&gt;    AND   mseg~werks = p_t_mchb-werks&lt;/P&gt;&lt;P&gt;    AND   mseg~lgort = p_t_mchb-lgort&lt;/P&gt;&lt;P&gt;    AND   mseg~charg = p_t_mchb-charg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shoban&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2009 02:58:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169265#M1371362</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-01T02:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: issue with select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169266#M1371363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to suggest one thing, when using tabke in joins use like this&lt;/P&gt;&lt;P&gt;mseg as a l mkpf as b then  use a and b instead of entire table names&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2009 04:07:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169266#M1371363</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-01T04:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: issue with select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169267#M1371364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; I would like to suggest one thing, when using tabke in joins use like this&lt;/P&gt;&lt;P&gt;&amp;gt; mseg as a l mkpf as b then  use a and b instead of entire table names&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi, Kartik&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this way it will take some more Seconds to Execute, because first it will get meaning of &lt;STRONG&gt;a&lt;/STRONG&gt; than &lt;STRONG&gt;b&lt;/STRONG&gt; if we will not directly provide table names ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please Correct me if wrong&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;@ Babu: Please try to USE More Meaningful Subject Line&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Faisal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2009 04:43:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169267#M1371364</guid>
      <dc:creator>faisalatsap</dc:creator>
      <dc:date>2009-10-01T04:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: issue with select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169268#M1371365</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;Try to use &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the query:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a~mblnr&lt;/P&gt;&lt;P&gt;a~bwart&lt;/P&gt;&lt;P&gt;a~matnr&lt;/P&gt;&lt;P&gt;a~werks&lt;/P&gt;&lt;P&gt;a~lgort&lt;/P&gt;&lt;P&gt;a~charg&lt;/P&gt;&lt;P&gt;a~zeile&lt;/P&gt;&lt;P&gt;b~budat&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE  P_T_LASTDT&lt;/P&gt;&lt;P&gt;FROM mseg as a INNER JOIN mkpf as b&lt;/P&gt;&lt;P&gt;ON a&lt;SUB&gt;mandt =  b&lt;/SUB&gt;mandt&lt;/P&gt;&lt;P&gt;AND a&lt;SUB&gt;mblnr = b&lt;/SUB&gt;mblnr&lt;/P&gt;&lt;P&gt;AND a&lt;SUB&gt;mjahr = b&lt;/SUB&gt;mjahr&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN P_T_MCHB&lt;/P&gt;&lt;P&gt;WHERE a~matnr = p_t_mchb-matnr&lt;/P&gt;&lt;P&gt;AND a~werks = p_t_mchb-werks&lt;/P&gt;&lt;P&gt;AND a~lgort = p_t_mchb-lgort&lt;/P&gt;&lt;P&gt;AND a~charg = p_t_mchb-charg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it will hep.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Archana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2009 05:18:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169268#M1371365</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-01T05:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: issue with select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169269#M1371366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try to pass budat.&lt;/P&gt;&lt;P&gt;If you dont have budat.&lt;/P&gt;&lt;P&gt;try to create a start date and end date from the MJAHR if you have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try to avoid joins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Split the query *&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2009 05:26:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169269#M1371366</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2009-10-01T05:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: issue with select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169270#M1371367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using alias definately improves performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Reducing Parse Time Using Aliasing A statement which does not have a cached execution plan should be parsed before execution; this parsing phase is a highly time and resource consuming, so parsing time for any sql query must include an alias name in it for the following reason. 1. Providing the alias name will enable the query engine to resolve the tables to which the specified fields belong to. 2. Providing a short alias name, (a single character alias name) is more efficient that providing a big alias name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above text is quoted from the answer given by Seshu Maramreddy in this thread&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="444724"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="16" __jive_macro_name="size"&gt;кu03B1ятu03B9к&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2009 05:38:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169270#M1371367</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-01T05:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: issue with select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169271#M1371368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello - &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggest you to use CURSORS with a packing size.  Do not use join; will be very expensive.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2009 05:46:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169271#M1371368</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-01T05:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: issue with select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169272#M1371369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kartik thanks for the information.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Oct 2009 06:39:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-select-query/m-p/6169272#M1371369</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2009-10-01T06:39:55Z</dc:date>
    </item>
  </channel>
</rss>

