Archive and delete process. Which one is recommended?
This process runs end of the day when the window is closed to any extraneous transactions other than this one to disallow interference with the below tx.
I. Batch delete
object = read()
while ( hasNext() )
{
object = next();
call the archive_process to archive the object.
add to delete.
}
batch_delete.
II. Single delete statement.
object = read()
while ( hasNext() )
{
object = next();
call the archive_process to archive the object.
}
use the same sql as above, but instead delete in a single statement.
Which one is recommended?
It all depends on your specific needs:
You need to remember that every delete
triggers an action on your data, and may have an impact on disk read-write speed of your program. A single batch delete may have a positive impact on the speed of your code compared with many one-row delete operations.
As addition to other answers - check also you have enough UNDO to support DELETE command. Also, with bigger volume DELETE can become tooo slow - check if alternatives exist. Be aware also of the impact of many indexes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.