Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

(click on this box to dismiss)

What is the difference between truncate and delete

What is the difference between TRUNCATE table and DELETE * FROM table? When should I use TRUNCATE and when should I use DELETE?

link comment (0)
asked 6 years ago
1 Answer

the first and most important is that TRUNCATE is faster!

both of them will empty your table. but "delete * from table" will be ready to commit after rows were merged and ready to rollback. in case of triggers or constraints, delete will hurt you more. 

the delete triggers will take time also when you'll use delete. so ... once again, TRUNCATE is the better choice.

as for a transaction log ... also TRUNCATE rules.

when TRUNCATE is not good ? when you'll need to delete just a few rows from your table (ex: delete * from table where id<5 )

link comment (0)
answered 6 years ago

You are either using a very old browser or a browser that is not supported.
In order to browse you need to have one of the following browsers:

Internet Explorer: Mozilla Firefox: Google Chrome: