<?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: How to increase Performance with DELETE FROM TABLE? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757667#M2022322</link>
    <description>&lt;P&gt;Rather than use a cursor, why not use something like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DO.
  DELETE FROM tab WHERE condition UP TO 20000 ROWS.
  IF sy-subrc IS NOT INITIAL.
    EXIT. 
  ENDIF.
  COMMIT WORK.
ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But it depends on your release. UP TO is a fairly recent addition, I believe.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Nov 2023 08:13:03 GMT</pubDate>
    <dc:creator>matt</dc:creator>
    <dc:date>2023-11-13T08:13:03Z</dc:date>
    <item>
      <title>How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757657#M2022312</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;
  &lt;P&gt;im currently writing a Program to delete Data from multiple Tables. Each table can be very Big (up to 10+ Billion entrys). And i need to delete a few hundred millions from them weekly. Problem is, all my trys are very slow.&lt;/P&gt;
  &lt;P&gt;My last 2 Trys were the following:&lt;/P&gt;
  &lt;OL&gt; 
   &lt;LI&gt;Open a Cursor to SELECT the DATA i wanna delete&lt;/LI&gt; 
   &lt;LI&gt;Fetch the Data from the cursor in Packages (mostly around 20.000).&lt;/LI&gt; 
   &lt;LI&gt;Use the fetched Data in a DELETE FROM TABLE&lt;/LI&gt; 
  &lt;/OL&gt;
  &lt;P&gt;Problem here, i cant use a COMMIT WORK, because it would close the cursor.&lt;/P&gt;
  &lt;P&gt;Second Try:&lt;/P&gt;
  &lt;OL&gt; 
   &lt;LI&gt;SELECT all Data in an internal Table&lt;/LI&gt; 
   &lt;LI&gt;Select the data from that itab in packages around 20.000 in a loop&lt;/LI&gt; 
   &lt;LI&gt;delete the packages again with a DELETE FORM TABLE&lt;/LI&gt; 
   &lt;LI&gt;COMMIT WORK after&lt;/LI&gt; 
  &lt;/OL&gt;
  &lt;P&gt;Main Problem here, if i select all data in an internal Table, the tables can get very big fast and we run into memory issues.&lt;/P&gt;
  &lt;P&gt;But both trys are VERY SLOW.&lt;/P&gt;
  &lt;P&gt;Before i used those 2 statements, i used an DELETE WHERE without a SELECT. Problem here is, i cant use the COMMIT WORK after a certain Threshold. &lt;/P&gt;
  &lt;P&gt;For Example: One Run took 17 Seconds to SELECT all the Data ( ~2.000.000 rows in all tables combined), pack it in Packages of 20.000 and skip the deletion only.&lt;BR /&gt;Adding the Deletion to the exact same program it took way over 45min and run into our timeout.&lt;/P&gt;
  &lt;P&gt;So both solutions work in the way, it selects the Data really fast and does the Deletion, but its very slow. SInce its a HANA-DB, we cant use an Index here (at least we were told so).&lt;/P&gt;
  &lt;P&gt;So what can we do?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 16:02:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757657#M2022312</guid>
      <dc:creator>leracka</dc:creator>
      <dc:date>2023-11-10T16:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757658#M2022313</link>
      <description>&lt;P&gt;Is &lt;A href="https://me.sap.com/notes/3320379"&gt;3320379 - ABAP: Performance improvements for EXPORT and DELETE&lt;/A&gt; suitable for your Kernel (from &lt;A href="https://me.sap.com/notes/2000002"&gt;2000002 - FAQ: SAP HANA SQL Optimization&lt;/A&gt;, easy-to-remember number) - Look also at SAP Notes &lt;A href="https://me.sap.com/notes/2351294"&gt;2351294&lt;/A&gt; and &lt;A href="https://me.sap.com/notes/2823243"&gt;2823243&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Otherwise, try parallelizing record deletions without triggering general performance problems.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 16:20:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757658#M2022313</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2023-11-10T16:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757659#M2022314</link>
      <description>&lt;P&gt;I'll looking at that Link. But it is already parallelized. Im Talking about the Performance for each Task. In Reality there are 300+ Tasks, that need to be done.&lt;/P&gt;&lt;P&gt;Edit: The Note cant be implemented on our system&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 16:27:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757659#M2022314</guid>
      <dc:creator>leracka</dc:creator>
      <dc:date>2023-11-10T16:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757660#M2022315</link>
      <description>&lt;UL&gt;&lt;LI&gt;What kind of table are those, standard or custom, &lt;/LI&gt;&lt;LI&gt;Are those tables changes logged (dbtablog)&lt;/LI&gt;&lt;LI&gt;Can they be partitionned&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 10 Nov 2023 16:28:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757660#M2022315</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2023-11-10T16:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757661#M2022316</link>
      <description>&lt;P&gt;It will be slow anyway.&lt;/P&gt;&lt;P&gt;Timeout? Why do you run it in dialog?&lt;/P&gt;&lt;P&gt;What is the original DELETE statement you need to adapt?&lt;/P&gt;&lt;P&gt;Which database indexes exist?&lt;/P&gt;&lt;P&gt;Partitions could help, as Raymond said, but maybe you don't need them.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 17:12:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757661#M2022316</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-11-10T17:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757662#M2022317</link>
      <description>&lt;P&gt;There are no Index on that Tables beside the Primary Keys.&lt;/P&gt;&lt;P&gt;We dont run it in Dialog, but in Backgroud. We set a Timeoutvalue in Selection-Screen in Seconds to limit executions, that run in a dead end. In the Test we seit it to 3600, e.g. 1 Hour, cause 1 Hour is already far too long of an execution time for one Task.&lt;/P&gt;&lt;P&gt;The Deletion is already parallelized, i dont know what you mean with "partitions". The Tables are all Standard-Tables from SAP, no Z* if that helps.&lt;/P&gt;&lt;P&gt;We already tried to use an Index a few Months back in another try (where we used DELETE WHERE), but it didnt help at all. But the Indexes went VERY Big (Multiple TB of Space). So we had to delete them immediately.&lt;BR /&gt;&lt;BR /&gt;And what do you mean with "original DELETE"? There is no original. The Standard has ways to delete data from those tables, but they are also too slow, thats why i have to make this Program right now.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 17:19:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757662#M2022317</guid>
      <dc:creator>leracka</dc:creator>
      <dc:date>2023-11-10T17:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757663#M2022318</link>
      <description>&lt;OL&gt;
 
&lt;LI&gt;Standard&lt;/LI&gt; 
&lt;LI&gt;Logging is disabled in technical Settings&lt;/LI&gt; 
&lt;LI&gt;What do you mean with that? I need to look up what that is&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Fri, 10 Nov 2023 17:21:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757663#M2022318</guid>
      <dc:creator>leracka</dc:creator>
      <dc:date>2023-11-10T17:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757664#M2022319</link>
      <description>&lt;P&gt;Original DELETE is the DELETE you want to do first, without any optimization. Just one DELETE.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DELETE FROM table WHERE ???????????&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You still don't provide any information about the structure of the table, which lines you need to delete, which columns are queried, do they belong to the primary key, which position in the primary key, and so on.&lt;/P&gt;&lt;P&gt;Partitions in tables = database concept: look at the definition in the Web, it's explained everywhere.&lt;/P&gt;&lt;P&gt;What is this "Timeoutvalue" concept in Selection-Screen? Never heard of that concept. I guess it's a custom timeout logic you have implemented, which means that your point is you just want to improve the performance. If you say "timeout" without any further explanation, you can understand that people will think that it's the system timeout, not a custom timeout. There's a system timeout in dialog but none in background.&lt;/P&gt;&lt;P&gt;If you don't give details, people will just give you general recommendations, and that won't help you.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 19:46:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757664#M2022319</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-11-10T19:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757665#M2022320</link>
      <description>&lt;P&gt;The Tables are the Standard UDF-Tables like /DMF/UFC_TS etc. The Columns do not belong to the primary key. Examples are: Time_gran TS_SOURCE, diag_id, loc_id, prod_id, tsmp_fr. But they are filled from the selection-screen, so if nothing is entered, the WHERE-Clause for that column will be dismissed.&lt;/P&gt;&lt;P&gt;An Example, where i used DELETE WHERE, i already modified it to include the commit work between, but i dont know if that really helps:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;   WHILE subrc = 0.&lt;/P&gt;&lt;P&gt;      IF i_testmodus = abap_true.&lt;/P&gt;&lt;P&gt;        SELECT COUNT(*)&lt;/P&gt;&lt;P&gt;        FROM /dmf/ufc_ts AS t&lt;/P&gt;&lt;P&gt;        INTO @DATA(res)&lt;/P&gt;&lt;P&gt;        UP TO @i_package_size ROWS&lt;/P&gt;&lt;P&gt;        WHERE t~diag_id IN @i_diag_id&lt;/P&gt;&lt;P&gt;        AND t~prod_id IN @i_prod_guid&lt;/P&gt;&lt;P&gt;        AND t~loc_id = @i_loc_guid&lt;/P&gt;&lt;P&gt;        AND t~sales_org_id IN @i_sales_org_id&lt;/P&gt;&lt;P&gt;        AND t~ts_source IN @i_ts_src&lt;/P&gt;&lt;P&gt;        AND t~tstmp_fr &amp;gt;= @i_tstmp_fr&lt;/P&gt;&lt;P&gt;        AND t~tstmp_to &amp;lt;= @i_tstmp_to.&lt;/P&gt;&lt;P&gt;        subrc = sy-subrc.&lt;/P&gt;&lt;P&gt;        r_res += sy-dbcnt.&lt;/P&gt;&lt;P&gt;        IF subrc &amp;lt;&amp;gt; 0 AND subrc &amp;lt;&amp;gt; 4.&lt;/P&gt;&lt;P&gt;          MESSAGE s023 DISPLAY LIKE 'E'.&lt;/P&gt;&lt;P&gt;          LEAVE LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        DELETE&lt;/P&gt;&lt;P&gt;        FROM /dmf/ufc_ts&lt;/P&gt;&lt;P&gt;        WHERE diag_id IN @i_diag_id&lt;/P&gt;&lt;P&gt;        AND prod_id IN @i_prod_guid&lt;/P&gt;&lt;P&gt;        AND loc_id = @i_loc_guid&lt;/P&gt;&lt;P&gt;        AND sales_org_id IN @i_sales_org_id&lt;/P&gt;&lt;P&gt;        AND ts_source IN @i_ts_src&lt;/P&gt;&lt;P&gt;        AND tstmp_fr &amp;gt;= @i_tstmp_fr&lt;/P&gt;&lt;P&gt;        AND tstmp_to &amp;lt;= @i_tstmp_to&lt;/P&gt;&lt;P&gt;        UP TO @i_package_size ROWS.&lt;/P&gt;&lt;P&gt;        subrc = sy-subrc.&lt;/P&gt;&lt;P&gt;        r_res += sy-dbcnt.&lt;/P&gt;&lt;P&gt;        IF subrc &amp;lt;&amp;gt; 0 AND subrc &amp;lt;&amp;gt; 4.&lt;/P&gt;&lt;P&gt;          MESSAGE s024 DISPLAY LIKE 'E'.&lt;/P&gt;&lt;P&gt;          LEAVE LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;      COMMIT WORK.&lt;/P&gt;&lt;P&gt;    ENDWHILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 07:43:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757665#M2022320</guid>
      <dc:creator>leracka</dc:creator>
      <dc:date>2023-11-13T07:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757666#M2022321</link>
      <description>&lt;P&gt;The Tables are the Standard UDF-Tables like /DMF/UFC_TS etc. The Columns do not belong to the primary key. Examples are: Time_gran TS_SOURCE, diag_id, loc_id, prod_id, tsmp_fr. But they are filled from the selection-screen, so if nothing is entered, the WHERE-Clause for that column will be dismissed.&lt;/P&gt;&lt;P&gt;An Example, where i used DELETE WHERE, i already modified it to include the commit work between, but i dont know if that really helps:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;WHILE subrc = 0.&lt;BR /&gt;IF i_testmodus = abap_true.&lt;BR /&gt;SELECT COUNT(*)&lt;BR /&gt;FROM /dmf/ufc_ts AS t&lt;BR /&gt;INTO @DATA(res)&lt;BR /&gt;UP TO @i_package_size ROWS&lt;BR /&gt;WHERE t~diag_id IN @i_diag_id&lt;BR /&gt;AND t~prod_id IN @i_prod_guid&lt;BR /&gt;AND t~loc_id = @i_loc_guid&lt;BR /&gt;AND t~sales_org_id IN @i_sales_org_id&lt;BR /&gt;AND t~ts_source IN @i_ts_src&lt;BR /&gt;AND t~tstmp_fr &amp;gt;= @i_tstmp_fr&lt;BR /&gt;AND t~tstmp_to &amp;lt;= @i_tstmp_to.&lt;BR /&gt;subrc = sy-subrc.&lt;BR /&gt;r_res += sy-dbcnt.&lt;BR /&gt;IF subrc &amp;lt;&amp;gt; 0 AND subrc &amp;lt;&amp;gt; 4.&lt;BR /&gt;MESSAGE s023 DISPLAY LIKE 'E'.&lt;BR /&gt;LEAVE LIST-PROCESSING.&lt;BR /&gt;ENDIF.&lt;BR /&gt;ELSE.&lt;BR /&gt;DELETE&lt;BR /&gt;FROM /dmf/ufc_ts&lt;BR /&gt;WHERE diag_id IN @i_diag_id&lt;BR /&gt;AND prod_id IN @i_prod_guid&lt;BR /&gt;AND loc_id = @i_loc_guid&lt;BR /&gt;AND sales_org_id IN @i_sales_org_id&lt;BR /&gt;AND ts_source IN @i_ts_src&lt;BR /&gt;AND tstmp_fr &amp;gt;= @i_tstmp_fr&lt;BR /&gt;AND tstmp_to &amp;lt;= @i_tstmp_to&lt;BR /&gt;UP TO @i_package_size ROWS.&lt;BR /&gt;subrc = sy-subrc.&lt;BR /&gt;r_res += sy-dbcnt.&lt;BR /&gt;IF subrc &amp;lt;&amp;gt; 0 AND subrc &amp;lt;&amp;gt; 4.&lt;BR /&gt;MESSAGE s024 DISPLAY LIKE 'E'.&lt;BR /&gt;LEAVE LIST-PROCESSING.&lt;BR /&gt;ENDIF.&lt;BR /&gt;ENDIF.&lt;BR /&gt;COMMIT WORK.&lt;BR /&gt;ENDWHILE.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Nov 2023 07:44:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757666#M2022321</guid>
      <dc:creator>leracka</dc:creator>
      <dc:date>2023-11-13T07:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757667#M2022322</link>
      <description>&lt;P&gt;Rather than use a cursor, why not use something like&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DO.
  DELETE FROM tab WHERE condition UP TO 20000 ROWS.
  IF sy-subrc IS NOT INITIAL.
    EXIT. 
  ENDIF.
  COMMIT WORK.
ENDDO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But it depends on your release. UP TO is a fairly recent addition, I believe.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 08:13:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757667#M2022322</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2023-11-13T08:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757668#M2022323</link>
      <description>&lt;P&gt;Thats exactly what we did 1 Year ago. but the performance wasnt satisfing for our Customers, so we have to develop something new&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 08:26:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757668#M2022323</guid>
      <dc:creator>leracka</dc:creator>
      <dc:date>2023-11-13T08:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757669#M2022324</link>
      <description>&lt;P&gt;Read some documentation in &lt;A href="https://help.sap.com/docs/search?q=SAP%20HANA%20Table%20Partitioning"&gt;SAP HANA Table Partitioning&lt;/A&gt; such as &lt;A href="https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/c2ea130bbb571014b024ffeda5090764.html"&gt;Table Partitioning&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Then consider partitionning on some date/month criteria, so delete could be mostly replaced with drop of partitions.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 08:51:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757669#M2022324</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2023-11-13T08:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757670#M2022325</link>
      <description>&lt;P&gt;Did you try:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Just do one SELECT to get the primary key values (I assume below that the key is made of prod_id only) of all records to delete.&lt;/LI&gt;&lt;LI&gt;Write these key values to a new work table ZDELETE_UFC_TS with a package number and i_package_size lines per package number.&lt;/LI&gt;&lt;LI&gt;Loop at the total number of packages, at each package do DELETE FROM /dmf/ufc_ts WHERE EXISTS ( SELECT * FROM ZDELETE_UFC_TS WHERE package_number =  @package_number AND ZDELETE_UFC_TS~prod_id = /dmf/ufc_ts~prod_id ), and COMMIT WORK.&lt;/LI&gt;&lt;LI&gt;Cleanup your work table&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Mon, 13 Nov 2023 13:37:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757670#M2022325</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-11-13T13:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757671#M2022326</link>
      <description>&lt;P&gt;When I say "one SELECT", it can be via a cursor so that to write the key values by package, and use ON HOLD to not dump at the INSERT.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 13:45:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757671#M2022326</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-11-13T13:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757672#M2022327</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;sandra.rossi&lt;/SPAN&gt; I tried that attempt today, but in an AMDP-Procedure:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    DECLARE client varchar(3) := '';&lt;BR /&gt;    DECLARE row_cnt int;&lt;BR /&gt;    SELECT SESSION_CONTEXT ('CLIENT') AS client INTO client FROM DUMMY;&lt;BR /&gt;    data = SELECT TOP :i_del_cnt TS.MANDT&lt;BR /&gt;                                ,TS.DIAG_ID&lt;BR /&gt;                                ,TS.AGGR_PROFILE_ID&lt;BR /&gt;                                ,TS.PROD_ID&lt;BR /&gt;                                ,TS.LOC_ID&lt;BR /&gt;                                ,TS.SALES_ORG_ID&lt;BR /&gt;                                ,TS.DISTR_CHNL_ID&lt;BR /&gt;                                ,TS.ORDER_CHNL_ID&lt;BR /&gt;                                ,TS.TS_SOURCE&lt;BR /&gt;                                ,TS.TIME_GRAN&lt;BR /&gt;                                ,TS.TSTMP_FR&lt;BR /&gt;                                ,TS.OFR_ID&lt;BR /&gt;                                ,TS.EXT_EVENT_ID&lt;BR /&gt;           FROM "/DMF/UFC_TS" AS TS&lt;BR /&gt;           INNER JOIN :i_prod_ids AS P ON TS.prod_id = P.prod_id&lt;BR /&gt;           WHERE time_gran = :i_time_granularity&lt;BR /&gt;             AND ts_source = :i_ts_source&lt;BR /&gt;             AND diag_id   = :i_diag_id&lt;BR /&gt;             AND loc_id    = :i_loc_id&lt;BR /&gt;             AND tstmp_fr &amp;gt;= :i_startdate&lt;BR /&gt;             AND tstmp_fr &amp;lt;= :i_enddate&lt;BR /&gt;             AND mandt     = :client;&lt;BR /&gt;    SELECT COUNT(*) INTO row_cnt FROM :data;&lt;BR /&gt;    IF :row_cnt &amp;gt; 0&lt;BR /&gt;    THEN&lt;BR /&gt;        DELETE FROM "/DMF/UFC_TS" AS TS&lt;BR /&gt;        WHERE EXISTS (  SELECT * FROM :data AS DTS&lt;BR /&gt;                         WHERE TS.MANDT                = DTS.MANDT&lt;BR /&gt;                           AND TS.DIAG_ID              = DTS.DIAG_ID&lt;BR /&gt;                           AND TS.AGGR_PROFILE_ID      = DTS.AGGR_PROFILE_ID&lt;BR /&gt;                           AND TS.PROD_ID              = DTS.PROD_ID&lt;BR /&gt;                           AND TS.LOC_ID               = DTS.LOC_ID&lt;BR /&gt;                           AND TS.SALES_ORG_ID         = DTS.SALES_ORG_ID&lt;BR /&gt;                           AND TS.DISTR_CHNL_ID        = DTS.DISTR_CHNL_ID&lt;BR /&gt;                           AND TS.ORDER_CHNL_ID        = DTS.ORDER_CHNL_ID&lt;BR /&gt;                           AND TS.TS_SOURCE            = DTS.TS_SOURCE&lt;BR /&gt;                           AND TS.TIME_GRAN            = DTS.TIME_GRAN&lt;BR /&gt;                           AND TS.TSTMP_FR             = DTS.TSTMP_FR&lt;BR /&gt;                           AND TS.OFR_ID               = DTS.OFR_ID&lt;BR /&gt;                           AND TS.EXT_EVENT_ID         = DTS.EXT_EVENT_ID&lt;BR /&gt;        ) WITH HINT ( CS_ITAB_IN_SUBQUERY );&lt;BR /&gt;        e_deleted_count = ::ROWCOUNT;&lt;BR /&gt;    END IF;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But that attempt is also slow. It deletes ~ 5.279 Rows per Second. &lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2023 11:13:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757672#M2022327</guid>
      <dc:creator>leracka</dc:creator>
      <dc:date>2023-11-16T11:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757673#M2022328</link>
      <description>&lt;P&gt;I took a Packagecount of 20k Rows per Deletion with a COMMIT WORK right after.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2023 11:20:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757673#M2022328</guid>
      <dc:creator>leracka</dc:creator>
      <dc:date>2023-11-16T11:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757674#M2022329</link>
      <description>&lt;P&gt;5k* not 20k&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2023 11:22:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757674#M2022329</guid>
      <dc:creator>leracka</dc:creator>
      <dc:date>2023-11-16T11:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to increase Performance with DELETE FROM TABLE?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757675#M2022330</link>
      <description>&lt;P&gt;As I said in my very first comment, "it will be slow anyway".&lt;/P&gt;&lt;P&gt;I'm unable to answer precisely because I still don't know the primary key of your table. If it's made of PROD_ID only, then I don't understand why you delete using many columns which will make it slower.&lt;/P&gt;&lt;P&gt;Also, if you want to discuss the performance, you should post the Execution Plan.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2023 13:54:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-increase-performance-with-delete-from-table/m-p/12757675#M2022330</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-11-16T13:54:33Z</dc:date>
    </item>
  </channel>
</rss>

