Delete
--------
It is a DML statement
Can Rollback
Can delete selective records
It fires database triggers.
It does not requires disabling of referential constraints
Deletes perform normal DML. That is, they take locks on rows, they generate redo (lots of it), and they require segments in the UNDO tablespace. Deletes clear records out of blocks carefully. If a mistake is made a rollback can be issued to restore the records prior to a commit. A delete does not relinquish segment space thus a table in which all records have been deletedretains all of its original blocks.
Truncate
----------
It is a DDL statement
Can’t Rollback
Can’t delete selective records.It will delete all the records in table
Doesn't fire database triggers
It requires disabling of referential constraints
Truncate moves the High Water Mark of the table back to zero.No row-level locks are taken,no redo or rollback is generated.
--------
It is a DML statement
Can Rollback
Can delete selective records
It fires database triggers.
It does not requires disabling of referential constraints
Deletes perform normal DML. That is, they take locks on rows, they generate redo (lots of it), and they require segments in the UNDO tablespace. Deletes clear records out of blocks carefully. If a mistake is made a rollback can be issued to restore the records prior to a commit. A delete does not relinquish segment space thus a table in which all records have been deletedretains all of its original blocks.
Truncate
----------
It is a DDL statement
Can’t Rollback
Can’t delete selective records.It will delete all the records in table
Doesn't fire database triggers
It requires disabling of referential constraints
Truncate moves the High Water Mark of the table back to zero.No row-level locks are taken,no redo or rollback is generated.
No comments:
Post a Comment