<?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: Select Query Performance issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175775#M1979412</link>
    <description>&lt;P&gt;For any post about SQL performance issue, please provide the values of input variables and the execution plan, because it depends only on your data.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jun 2020 12:56:18 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2020-06-03T12:56:18Z</dc:date>
    <item>
      <title>Select Query Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175770#M1979407</link>
      <description>&lt;P&gt;Dear Experts,&lt;/P&gt;
  &lt;P&gt;Could you please tell me how to improvise the below code.&lt;/P&gt;
  &lt;P&gt;Fetching the data from LIKP and LIPS without non key fields, its taking 5 to 10 min to execute,as user requirement is not use the vbeln as input and improve performance.&lt;/P&gt;
  &lt;P&gt; SELECT t1~vbeln t1~vstel&lt;BR /&gt; t1~kodat t1~kunag t1~kunnr&lt;BR /&gt; t1~wadat t1~wadat_ist t2~posnr t2~pstyv&lt;BR /&gt; t2~werks t2~matnr t2~arktx t2~charg&lt;BR /&gt; t2~spart t2~lgort&lt;BR /&gt; INTO CORRESPONDING FIELDS OF TABLE i_delpos&lt;BR /&gt; FROM likp AS t1 INNER JOIN lips AS t2&lt;BR /&gt; ON t2~vbeln = t1~vbeln&lt;BR /&gt; WHERE t1~wadat IN s_date&lt;BR /&gt; AND t1~vstel IN s_vstel&lt;BR /&gt; AND t2~werks IN s_werks&lt;BR /&gt; AND t2~matnr IN s_matnr&lt;BR /&gt; AND t2~spart IN s_spart&lt;BR /&gt; AND t2~lgort in s_lgort.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 12:04:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175770#M1979407</guid>
      <dc:creator>Santosh21N</dc:creator>
      <dc:date>2020-06-03T12:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175771#M1979408</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;santoshnadumani&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;I had similar issue once and in my case the solution was splitting those 2 selects - firstly I selected VBELN from LIKP (using the selection criteria applicable to LIKP) and then having the document numbers I executed another selection from LIPS using FOR ALL ENTRIES and selection criteria applicable for LIPS (and afterwards removing entries gathered from LIKP that did not exist in LIPS).&lt;BR /&gt;I would not call it an elegant solution but in my case it worked as a charm. &lt;BR /&gt;If someone has a better suggestion I would be glad to hear it.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Bartosz&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 12:19:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175771#M1979408</guid>
      <dc:creator>ziolkowskib</dc:creator>
      <dc:date>2020-06-03T12:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175772#M1979409</link>
      <description>&lt;P&gt;Hello &lt;SPAN class="mention-scrubbed"&gt;santoshnadumani&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;ziolkowskib&lt;/SPAN&gt; 's solution is a good idea. It could work. You should try it out&lt;/P&gt;&lt;P&gt;In case it does not, check the report's selection criteria - are there any fields marked as obligatory? If yes, then you could create a DB index on the table using those fields (and MANDT field) - this should help with performance.&lt;/P&gt;&lt;P&gt;If no fields are marked as obligatory (maybe this should be changed?), then ask users which fields they use the most and make a DB index based on these fields. &lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Mateusz&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 12:29:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175772#M1979409</guid>
      <dc:creator>MateuszAdamus</dc:creator>
      <dc:date>2020-06-03T12:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175773#M1979410</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;ziolkowskib&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;Thanks for your input, if write seperate select statments for LIKP and LIPS but its without key fields, so do you think it wont be any performnce issue?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 12:43:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175773#M1979410</guid>
      <dc:creator>Santosh21N</dc:creator>
      <dc:date>2020-06-03T12:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175774#M1979411</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;mateuszadamus&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;Thanks for the valuable input, how to use the DB index in the program?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 12:54:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175774#M1979411</guid>
      <dc:creator>Santosh21N</dc:creator>
      <dc:date>2020-06-03T12:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175775#M1979412</link>
      <description>&lt;P&gt;For any post about SQL performance issue, please provide the values of input variables and the execution plan, because it depends only on your data.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 12:56:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175775#M1979412</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-06-03T12:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175776#M1979413</link>
      <description>&lt;P&gt;Hello  &lt;SPAN class="mention-scrubbed"&gt;santoshnadumani&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;You don't need to worry about using the DB index in the program. In most cases, the DB selects the best index available.&lt;/P&gt;&lt;P&gt;However, this works only if the index is created in the table. That has to checked and implemented (if needed) by a developer.&lt;/P&gt;Kind regards,&lt;BR /&gt;Mateusz</description>
      <pubDate>Wed, 03 Jun 2020 13:07:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175776#M1979413</guid>
      <dc:creator>MateuszAdamus</dc:creator>
      <dc:date>2020-06-03T13:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175777#M1979414</link>
      <description>&lt;P&gt;&lt;A href="https://answers.sap.com/storage/temp/1812140-likp-and-lips.jpg"&gt;likp-and-lips.jpg&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hi Sandra,&lt;/P&gt;&lt;P&gt;I will be selecting based on the below input, from this only 4 entires are fetched but still it takes 5 to 10 mins.&lt;/P&gt;&lt;P&gt;PFA screen shot&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 13:14:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175777#M1979414</guid>
      <dc:creator>Santosh21N</dc:creator>
      <dc:date>2020-06-03T13:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175778#M1979415</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;santoshnadumani&lt;/SPAN&gt;,&lt;BR /&gt;As I mentioned in my case splitting one SELECT with JOIN into 2 separate selections improved performance. In this case the 1st selection would be executed without key fields but the second selection from LIPS would be executed with partial key (VBELN)&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Bartosz &lt;/P&gt;</description>
      <pubDate>Wed, 03 Jun 2020 14:27:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175778#M1979415</guid>
      <dc:creator>ziolkowskib</dc:creator>
      <dc:date>2020-06-03T14:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175779#M1979416</link>
      <description>&lt;P&gt;Can you upload output of explain functionality, or in case of HDB, the PlanViz file?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2020 10:03:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175779#M1979416</guid>
      <dc:creator>gasparerdelyi</dc:creator>
      <dc:date>2020-06-05T10:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Select Query Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175780#M1979417</link>
      <description>&lt;P&gt;Any performance-related investigation should start with using SQL Trace (ST05) and checking Execution path. (Other tools could also exist in the HANA systems but I assume this is not the case here.)&lt;/P&gt;&lt;P&gt;Fast access on DB level is only possible by primary key or secondary index. That's pretty much it. I'm guessing there is no suitable secondary index for LIKP or LIPS in your system, so it has to go through all the records (aka "full table scan") to find the ones that match the selection criteria. Even though it might as well find just 4 or even 0 matching records, still the time is spent just looking for them. Imagine if you mixed up a bag of rice and a bag of beans and then had to find all the rice grains that are longer than 3 mm. The same thing but with data.&lt;/P&gt;&lt;P&gt;I'm a bit puzzled by the recommendation by Bartosz to split the SELECT into two separate ones. While it's not improbable that it could improve the performance, I just find it odd that DB optimizer doesn't take care of it more efficiently. This could be a YMMV situation that could work differently based on DB or even specific SAP system. Also, a secondary index could still be a better solution.&lt;/P&gt;&lt;P&gt;Performance tuning is not the exact science, so your best bet would be to use DB tools and experiment in the specific system. Reach out to a local Basis admin or DBA if you need assistance with using the tools or interpreting findings.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2020 20:04:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-query-performance-issue/m-p/12175780#M1979417</guid>
      <dc:creator>Jelena_Perfiljeva</dc:creator>
      <dc:date>2020-06-05T20:04:04Z</dc:date>
    </item>
  </channel>
</rss>

