Deleting records from database table

Question: I have a program that stores a copy of all the data in table PLAF in table ZPLAF_TEMP on the database server.

Everytime the program runs, it deletes the data out of ZPLAF_TEMP first. Right now it is doing

SELECT * FROM zplaf_temp into TABLE i_zplaf.

DELETE zplaf_temp FROM TABLE i_zplaf.

Now there are about 20,000 records in this file. My question is this: Would it be faster to do something like this:

DELETE FROM zplaf_temp WHERE plnum IN r_emptylist.

(r_emptylist would be an empty internal table)

If so, how much faster would it be?

The whole program is taking about 8 minutes right now, and I'm trying to see if there is anything I can do to speed it up.

Answer:
Fastest way of deleting everything from the database table is to use function module DD_DB_OPERATION to first DROP the table and then to RECREATE it again.

Please be careful while using this function module.

Answer:
Also note that this is a client independent operation.

Answer:
Yes very good point which I forgot to mention. Therefore you have to be very very careful before using this approach.

We however found this approach very useful while implementing interface with i2.
Copyright ?2007 - 2008 www.jt77.com