The delete table command is often used when DB2 deletes data. However, the delete table command still has some limitations. It is not perfect when processing a large amount of data.
When you use the delete table command to DELETE data in DB2, this operation deletes the TABLE records one by one and records them in the active transaction logs. When the data volume in the table is large, if the transaction log of the activity is not large enough, the transaction log is full and the log is rolled back. Even if the transaction log of the activity is large enough, it takes a lot of time for DB2 to delete tables with a large amount of data. This problem can be solved by importing an empty file as a data file) and replacing the REPLACE table. For example
Import from/dev/null of del replace into target table name
In this way, transaction logs only record this command and immediately release the occupied space, instead of scanning records one by one like DB2 data deletion commands, this is similar to dropping the table and then creating a table that is identical but has no data.
For a table in the DMS tablespace, the DB2 data deletion command scans records one by one, and the occupied record space is still marked as used by the table without immediately releasing the space, you must use the REORG command to release the remaining space. Use list tablespace show detail to compare the remaining space in the TABLESPACE after the two commands are executed.
Using the LOAD command and the REPLACE parameter can achieve the effect similar to the IMPORT command and the REPLACE, but because the LOAD itself does not remember the log, for recoverable databases, after LOAD is complete, we recommend that you perform online backup immediately. In contrast, the IMPORT command and REPLACE operations are simpler.
In windows, the following sentence is implemented.
Import from c: \ empty.txt of del replace into target table name
DB2 index design guidelines
Visualize DB2 Spatial Data
How to create a cross-database view in DB2
Several useful methods for updating the execution plan of DB2
Manually install DB2 on Linux 9