DavidCrowe Posted November 28, 2015 Share Posted November 28, 2015 It would be useful to have either a page on SQL TRUNCATE TABLE or a mention of it in the SQL DELETE tutorial. "DELETE from <table>" or "DELETE * FROM <table>" is recommended as a way to delete all data without deleting the table itself. Is this just a synonym for TRUNCATE? Is it guaranteed to do this as efficiently? Link to comment Share on other sites More sharing options...
justsomeguy Posted November 30, 2015 Share Posted November 30, 2015 They are different, truncate is much faster because it doesn't worry about updating indexes or things like that, it just resets the table and all of its indexes. It's similar to deleting a file, instead of actually going through and setting all of the data on disk to 0 or whatever, the OS just marks that area of the disk as unused. Truncate doesn't do the same as delete, it just says the table has no rows in it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now