<?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: Table query performance improvement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650818#M2015035</link>
    <description>&lt;P&gt;Thank you &lt;SPAN class="mention-scrubbed"&gt;maciej.domagaa&lt;/SPAN&gt;! Put a smile on my face &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;Query be faster &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; (17 sec to 5 sec)&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jan 2023 20:28:51 GMT</pubDate>
    <dc:creator>former_member709662</dc:creator>
    <dc:date>2023-01-19T20:28:51Z</dc:date>
    <item>
      <title>Table query performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650813#M2015030</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
  &lt;P&gt;I would like to make one querry about them to improve performance. The table has 93 million records:&lt;/P&gt;
  &lt;P&gt; SELECT COUNT(*) INTO lv_erdk_count_one FROM erdk WHERE items_archived = '1'.&lt;BR /&gt; SELECT COUNT(*) INTO lv_erdk_count_two FROM erdk WHERE items_archived = '2'.&lt;BR /&gt; SELECT COUNT(*) INTO lv_erdk_count_three FROM erdk WHERE items_archived = '3'.&lt;BR /&gt; SELECT COUNT(*) INTO lv_erdk_count_four FROM erdk WHERE items_archived = '4'.&lt;BR /&gt; SELECT COUNT(*) INTO lv_erdk_count_five FROM erdk WHERE items_archived = '5'.&lt;BR /&gt;&lt;BR /&gt;Is it possible to make one query?&lt;/P&gt;
  &lt;P&gt;Thank your help in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 15:38:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650813#M2015030</guid>
      <dc:creator>former_member709662</dc:creator>
      <dc:date>2023-01-19T15:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Table query performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650814#M2015031</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;SELECT COUNT(*) From erdk INTO (  lv_erdk_count_one,  
				  lv_erdk_count_two,  
				  lv_erdk_count_three,  
				  lv_erdk_count_four,  
				  lv_erdk_count_five  ) 
	where items_archived = '1' and
	      items_archived = '2' and
	      items_archived = '3' and 
	      items_archived = '4' and 
	      items_archived = '5'.

Check this.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Jan 2023 16:12:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650814#M2015031</guid>
      <dc:creator>shantraj6</dc:creator>
      <dc:date>2023-01-19T16:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Table query performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650815#M2015032</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;this would return no records. No record can fulfill the criteria items_archived = '1' &lt;STRONG&gt;and&lt;/STRONG&gt; items_archived = '2'...&lt;/P&gt;&lt;P&gt;I guess the above given 5 statements can not be covered with a single statement. My first though on this was using the ':' for chained statements (one might think it looks a little bit cleaner).&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select:
  count( * ) into @lv_erdk_count_one from ERDK where items_archived = '1',&lt;BR /&gt;  count( * ) into @lv_erdk_count_two from ERDK where items_archived = '2',&lt;BR /&gt;  count( * ) into @lv_erdk_count_three from ERDK where items_archived = '3',&lt;BR /&gt;  count( * ) into @lv_erdk_count_four from ERDK where items_archived = '4',
  count( * ) into @lv_erdk_count_five from ERDK where items_archived = '5'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But also with this notation there will be 5 separated statements - no gain regarding performance improvement &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;Jan&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 16:26:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650815#M2015032</guid>
      <dc:creator>jmodaal</dc:creator>
      <dc:date>2023-01-19T16:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: Table query performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650816#M2015033</link>
      <description>&lt;P&gt;I got error message: The field list and the INTO list must have the same number of elements.		&lt;/P&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
      <pubDate>Thu, 19 Jan 2023 16:35:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650816#M2015033</guid>
      <dc:creator>former_member709662</dc:creator>
      <dc:date>2023-01-19T16:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Table query performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650817#M2015034</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;data:
  begin of itab occurs 5,
    items_archived  type ERDK-items_archived,
    counter         type i,
  end of itab.

select 
  items_archived 
  count(*) 
  into table itab 
  from ERDK 
  where items_archived in ('1','2','3','4','5') 
  group by items_archived.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Jan 2023 16:59:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650817#M2015034</guid>
      <dc:creator>Maciej_DomagaBa</dc:creator>
      <dc:date>2023-01-19T16:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Table query performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650818#M2015035</link>
      <description>&lt;P&gt;Thank you &lt;SPAN class="mention-scrubbed"&gt;maciej.domagaa&lt;/SPAN&gt;! Put a smile on my face &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;Query be faster &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; (17 sec to 5 sec)&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 20:28:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650818#M2015035</guid>
      <dc:creator>former_member709662</dc:creator>
      <dc:date>2023-01-19T20:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Table query performance improvement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650819#M2015036</link>
      <description>&lt;P&gt;You're welcome. &lt;/P&gt;&lt;P&gt;If you want to speed it up even more, you may consider creating your own index on that database table, an index with fields: MANDT and ITEMS_ARCHIVED (tcode SE11 -&amp;gt; button Indexes...) - it could make sense if you are going to use that query  pretty often.&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2023 13:26:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-query-performance-improvement/m-p/12650819#M2015036</guid>
      <dc:creator>Maciej_DomagaBa</dc:creator>
      <dc:date>2023-01-20T13:26:28Z</dc:date>
    </item>
  </channel>
</rss>

