GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle
Go To First  |  Previous Question  |  Next Question 
 Oracle  |  Question 5 of 81    Print  
Which one is faster DELETE/TRUNCATE? Why?

  
Total Answers and Comments: 19 Last Update: April 22, 2009     Asked by: SaratKumar 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
  Sorting Options  
  Page 1 of 2   « First    1    2    >     Last »  
October 11, 2005 00:15:03   #1  
kalyan        

RE: Which one is faster DELETE/TRUNCATE? Why?
becase truncate canot rollback
 
Is this answer useful? Yes | No
October 11, 2005 10:28:57   #2  
Praveen        

RE: Which one is faster DELETE/TRUNCATE? Why?

Truncante is performs better than delete because when you delete the records from the database database has to perform 2 actions.

1.delete from the database

2.write the deleted records into rollback segments.

But incase of Truncate the second activity is not required.

Cheers

Praveen.


 
Is this answer useful? Yes | No
October 13, 2005 15:53:37   #3  
sandeep vig        

RE: Which one is faster DELETE/TRUNCATE? Why?
truncate is faster than delete bcoz truncate is a ddl command so it does not produce any rollback information and the storage space is released while the delete command is a dml command and it produces rollback information too and space is not deallocated using delete command.
 
Is this answer useful? Yes | No
November 17, 2005 06:08:23   #4  
successgs        

RE: Which one is faster DELETE/TRUNCATE? Why?

Truncate is more faster than delete. Since it has a power of releasing the structure of table storage size and deallocates whereas delete is used to mere deletion of records in tables with the usage of where clause as a optional one. Truncate is also fall under DDL part.


 
Is this answer useful? Yes | No
November 29, 2005 05:12:36   #5  
suresh        

Which one is faster DELETE/TRUNCATE? Why?

Hi

Truncate is very faster than delete becuase

1.no need to write any date in redo log files

2.no need to fire any triggers

Suresh.D


 
Is this answer useful? Yes | No
December 12, 2005 02:11:32   #6  
MelJos        

RE: Which one is faster DELETE/TRUNCATE? Why?
A TRUNCATE statement can be rolled back if it is performed within a transaction. The speed of the TRUNCATE statement itself testifies that the actual data is not erased untill it's rewritten. So it is possible to rollback A TRUNCATE Statement.
 
Is this answer useful? Yes | No
February 23, 2006 01:21:43   #7  
alagusundaram        

RE: Which one is faster DELETE/TRUNCATE? Why?
Truncate is a DDL comment and we cannot rollback. Truncate issue a commit before and after performing the task.
 
Is this answer useful? Yes | No
November 09, 2006 01:37:59   #8  
Sudeep Biswas        

RE: Which one is faster DELETE/TRUNCATE? Why?
TRUNCATE is faster than DELETE because truncate does not logs the rows that are deleted where as DELETE keeps a record of rows deleted till the transaction is committed.This is the reason why data that is truncated is non recoverable.
 
Is this answer useful? Yes | No
January 19, 2007 07:04:43   #9  
Iwein        

RE: Which one is faster DELETE/TRUNCATE? Why?
Truncate is faster than delete because it just resets the high water mark. Delete performs operations on each record (delete rollback segmen..). The downside is that once a table is truncated all the space it used before is immediately released. Once the truncate is executed the space taken up by the table before is free and can be used by any other session. Hence no commit is needed no rollback is possible and you can only delete all data not a subset.
Essentially truncate drops the whole data part of the table. Whereas delete removes elements from the data one by one.

 
Is this answer useful? Yes | No
April 03, 2007 08:48:25   #10  
Vaibhav        

RE: Which one is faster DELETE/TRUNCATE? Why?
Below is the best suitable reson:

1. Truncate is an autocommit transaction; therefore as soon as this is executed the database is commited.
2. Delete is a forced-commit transaction which gives luxury of rollback.

Therefore once we want to delete all the records of any table we use truncate instread of delete which will be much faster.

Regards
-Vaibhav

 
Is this answer useful? Yes | No
  Page 1 of 2   « First    1    2    >     Last »  


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape