Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Delete custom table records without performance issue

0 Likes
2,577

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.

5 REPLIES 5
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,879

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?

Read only

teshanappadoo
Participant
0 Likes
1,879

Hello,

Do you need to do this by code ? If not, you can use SE14(database Utility) to erase all the records.

Regards,

Teshan

Read only

0 Likes
1,879

@ 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.
Read only

0 Likes
1,879

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.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,879

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.