Exforsys

Online Training

Timing for Operations

This is a discussion on Timing for Operations within the Oracle Database forums, part of the Database category; I want to know among the operations namely DELETE TABLE and TRUNCATE TABLE which is faster and why.Or is ...


Go Back   Exforsys > Database > Oracle Database

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-14-2006, 04:43 AM
Senior Member
 
Join Date: Apr 2006
Posts: 153
cyrus is on a distinguished road
Timing for Operations

I want to know among the operations namely DELETE TABLE and TRUNCATE TABLE which is faster and why.Or is it that both takes the same time.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-10-2007, 06:29 PM
Junior Member
 
Join Date: Jan 2007
Posts: 1
msis2004 is on a distinguished road
Delete vs Truncate

I am new to Oracle DBA but I found the following in the book I am currently reading. It explains the difference between delete and truncate very well.

1)Truncate statement is similar to Delete statement without a where clause. Truncate is very fast on both large and small tables. Delete will generate undo information, in case a rollback is issued, but Truncate will not generate undo.

2) Truncate resets the high-water mark (I don't know what this means) in the table and all indexes. since full-table scans and index fast full scans read all data blocks up to the high-water mark, full-scan performance after a Delete will not improve; after a Truncate, it will be very fast.

3) Another key difference is that Truncate is DDL and Delete is DML.

Hope this helps!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-14-2007, 12:49 PM
Junior Member
 
Join Date: Dec 2006
Posts: 5
nagivijay is on a distinguished road
Thumbs up Delete Vs Truncate

HI

Delete and truncate both are useful in deleting the records, however when ever you had issued an delete clause it just marks the records in the table as deleted, the memory(bytes) will be the same,at this point you can perform commit and rollback transaction statement controls. where as truncate clause removes the entire records. the major advantage of truncate clause is it actually removes the records from the table so it releases memory. here you can't peform the transaction statement controls. hope this will help for you.

VJ
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply


Thread Tools

Posting Rules
You may not post new questions
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 12:47 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.