‎2020 Apr 26 9:23 AM
Hi,
In my custom table having more than 10 lakhs records.Need to delete the records without performance issue.
Could you please suggest best solution for this.
I have found some below solutions...
1. Using package or up to rows, can split the records and deletion can be performed.
‎2020 Apr 26 10:19 AM
The SQL statement DELETE, in itself, should not lead to performance issues.
So, I suggest that you first learn how to identify the cause of performance issues. There are already many blog posts/questions about this topic in the forum.
The addition "package size" concerns only SELECT and does not, in itself, improve the performance, but the use of packages allows making several ABAP processes run in parallel, so you have a gain in performance at ABAP side. Using packages may also avoid memory/network issues.
I don't see how "up to rows" can improve the performance (it's only to allow working with packages).
Now, the question is, do you have a performance issue, and what does it concern?
‎2020 Apr 26 11:01 AM
Hello,
Do you need to do this by code ? If not, you can use SE14(database Utility) to erase all the records.
Regards,
Teshan
‎2020 Apr 26 12:06 PM
@ sandra.rossi
For delete entries in database table i use instruction:
Delete from <table> where <zone> = 'X'.
The delete take seven hours (the table is very big and <zone> isn't an index)
How can i optimize for reduce the delete time.
I have tried this one......now...
do100times.
select*fromintotable itab.whereupto10.000 records.
if( itab isinitial)
exit.
endif.
delete...fromtable itab.
commitwork.
‎2020 Apr 26 1:31 PM
Please use the COMMENT button for comments, questions, adding details, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.
‎2020 Apr 26 1:40 PM
In English, I think you mean 1 million records in the table. It's somewhat a low volume nowadays. If you delete these lines using:
DELETE FROM (tablename) WHERE zone = 'X'.
and the table doesn't have an index with column ZONE, then probably the database optimizer does a full scan (but only the Execution Plan of the database can confirm).
But you say that it takes seven hours to run, I can't imagine that this single statement can take so much time. So, before changing any ABAP code without even know the reason of that, first analyze the situation: do an ABAP + SQL trace, make sure what takes time, get the execution plan. If you don't know how to interpret them, paste the traces here.