Use the TRUNCATE statement to remove all rows from a table or cluster and reset the STORAGE parameters to the values when the table or cluster was created. Deleting rows with the TRUNCATE statement can be more efficient than dropping and re-creating a table. Dropping and re-creating a table invalidates the table's dependent objects, requires you to regrant object privileges on the table, and requires you to re-create the table's indexes, integrity constraint, and triggers and respecify its storage parameters. Truncating has none of these effects.
To remove all rows from a table or cluster and reset the STORAGE parameters to
the values when the table or cluster was created.REUSE STORAGE
retains the space from the deleted rows allocated to the table or cluster. Storage values are not reset to the values when the table or cluster was created. This space can subsequently be used only by new data in the table or cluster resulting from inserts or updates.
The DROP STORAGE clause and REUSE STORAGE clause also apply to the space freed by
the data deleted from associated indexes.
Specify REUSE STORAGE to retain the space from the deleted rows allocated to the table or cluster. Storage values are not reset to the values when the table or cluster was created. This space can subsequently be used only by new data in the table or cluster resulting from inserts or updates.
但drop table 是将表结构和记录一同清除,且不可恢复。
truncate table 是将记录清除,且不可恢复,但保留表结构。
delete from 清空记录,但可以在commit之前进行rollback.
有什么用呢,是不是保留原有的空间,为以后再insert数据用的呢?
这样没有什么意义啊?
快速删除表,不写日志,保留存储介质中的数据。