There are lots of differences in Delete and Truncate Command. Some are listed below:
- TRUNCATE is much faster than DELETE. Reason for thsi is : When you type DELETE.all the data get copied into the Rollback Tablespace first.then delete operation get performed. For this reason when you type ROLLBACK after deleting a table ,you can get back the data(The system get it for you from the Rollback Tablespace).All this process take time.But when you type TRUNCATE,it removes data directly without copying it into the Rollback Tablespace. For this reason TRUNCATE is faster. Once you Truncate you cann't get back the data.
- You cann't rollback in TRUNCATE but in DELETE you can rollback.
- TRUNCATE is a DDL command whereas DELETE is a DML command.
- TRUNCATE removes the record permanently. but in DELETE you can get back the data from ROLLBACK
- In case of TRUNCATE ,Trigger doesn't get fired.But in DML commands like DELETE .Trigger get fired.
- You cann't use conditions(WHERE clause) in TRUNCATE.But in DELETE you can write conditions using WHERE clause.
- Truncate resets identity(seed). delete will not.
No comments:
Post a Comment