cancel
Showing results for 
Search instead for 
Did you mean: 

delete db dtable with non key fields

UmaArjunan
Active Participant
0 Kudos
615

Dear Experts,

Deleting the temporary staging table in ECC for clearing item around 13M data based on open document number using range table with 10000 doc no at a time and then it is extracted to BW.

Tried with full scan parallel option also deletion is very slow at the db level.

DELETE FROM dfkkcibw WHERE opbel IN rt_del_ciopbel
%_HINTS DB6 'FULL(DFKKCIBW) PARALLEL (DFKKCIBW, 4)'.

COMMIT WORK AND WAIT.

Any other efficient way to delete records based on non-key fields ? please suggest .

Thanks,

ABAP dev

Accepted Solutions (0)

Answers (4)

Answers (4)

appel_solar_dk
Active Participant

I suppose that what takes the time is a full table scan of your table for each row in rt_del_ciopbel. On average n/2 rows will have to be scanned to find the row to delete. With an index that time will go down drastically. It will of cause take some time (and space) to maintain the index but probably a lot less than scanning for each deletion.

UmaArjunan
Active Participant
0 Kudos

I was bit cautious to know , How does the secondary index works in case of full deletion of a table on a daily basis, will it automatically build the secondary index at the db level every time when the data is deleted fully and new data is populated ?? apart from secondary index creation for opbel at table, is there any thing to do (considering full table deletion) from db team ..

UmaArjunan
Active Participant
0 Kudos

created secondary index for opbel, deletion for 50000 records takes 2.6 seconds where as without secondary index it took 0.66 seconds.

appel_solar_dk
Active Participant
0 Kudos

Well it is hard to argue against the numbers but it sounds weird. How many rows were there in the table before deleting the 50.000? (Did the secondary index include mandt as a field, it could have an impact?)

UmaArjunan
Active Participant
0 Kudos

it is 50216 and yes included Mandt , opbel is the secondary index, ,now removed mandt and kept opbel and tested it is 1.7sec should try with more data

UmaArjunan
Active Participant
0 Kudos

thanks for all the suggestions provided . removed MANDT and created sec index with only OPBEL. Transported index to quality and for 13 M time went down drastically. now it is taking 3,689 seconds to 13m data

Do we need to index re-org as well at db level for this case ?.pl. suggest

raymond_giuseppi
Active Contributor
0 Kudos
UmaArjunan
Active Participant
0 Kudos

Yes already using the program RFKKOPBWS_DELETE_MARK to do the full deletion everyday. it deletes by comparing key fields i.e less than record number with block size 100000 and it completes less than a minute , the one i m deleting is for applying intermittent filter based on non key for BW extraction .

appel_solar_dk
Active Participant
0 Kudos

Hi ABAP Dev

I think you should take a small DB course it will help you going forward. The index can be added in the normal t-codes so you don't need to involve the DB team as such but they may be able to help you with your detailed questions about how a DB works.

-Kristian

appel_solar_dk
Active Participant
0 Kudos

Hi ABAP dev

Have you tried to put an index on opbel? It should help.

If you want to clear the table completely a TRUNCATE would be faster but I suppose you have a need to only delete some rows.

Regards

Kristian

UmaArjunan
Active Participant
0 Kudos

Yes i have a need to delete certain rows . This is a temporary staging table and it is completely cleared everyday before loading, After loading again next day with full clear item, we are filtering the data in the table using the delete statement above .

considering full deletion on a daily basis, Would it still help for Deletion if a second index opbel is created on the table level , would it not consume additional time for building index etc, everyday. pl. clarify. If there is no impact i wanted to try