what is difference between delete with commit and truct table?
Both are same?
thanks
what is difference between delete with commit and truct table?
Both are same?
thanks
yes interms,that u cannot get the previous data,that is delete
is DML,truncate is DDL,if u give delete without commit u can get the previous data,but with truncate it will delete all the rows from that table and cannot be rollback since it is autocommit.
if u delete and then commit it is true that u can't rollback to get back the data .but with TRUNCATE the only difference is being a DDL it changes the structure of the table. What truncate does it it deletes all the records and releases the momory which does not happen with delete till you commit and all that in a single command .
another difference is u can't specify any condition for truncate. it truncates the entire table by default.
Delete will delete the records one by one where as truncate will delete all the records at a time. Also you can roll back the records if you use the delete statement but not when you use truncate...
The difference lies first with the efficiency, 'delete with commit' will remove the enteries from your table in a way that each row is deleted individaully while truncate will empty your table in a single turn, which is more efficient. and secondly the table space, delete won't release a table space, while truncate does
hi,
truncate is ddl command and delete is dml command .compare to delete truncate is best in performance bcoz when execute a delete command all record in a table is store into rollback tablespace after storing it will delete the data,so it takes time for all this process while truncate will delete directly with storing the data that's the reson when we execute rollback we will get the deleted records.
Hi... Both does the same deletion of rows :
truncate executes faster as compared to delete but once you issue truncate you cannot rollback,in case of delete ,table is placed in rollback tablespaces ,even if you delete you can rollback i.e get back the data .
Delete is DML command. It will remove the records from the table.
We need to commit the transaction to make the changes permanent to the database.
Also DELETE will log the details in data dictionary. So if we have not explicitly committed the transaction we could always "ROLLBACK" to get back all the deleted rows.
TRUNCATE also removes the records from the table.
Difference is how Oracle implements "TRUNCATE" and "DELETE".
For "TRUNCATE" Oracle engine will drop the table and recreate it. This is much faster than delete. Only issue is table records once truncated cannot be recovered. The reason is Oracle does not create logs as in the case of "DELETE".