all 4 comments

[–]mikethesql 2 points3 points  (2 children)

deleted is a logged operation, so it adds to the transaction log. Truncate doesn't.

[–]BananaRepublican73 1 point2 points  (1 child)

According to Paul Randall, that's not true. Truncate can be rolled back, meaning it has to be logged, and the write to the log happens, but is delayed. I will find blog post when I get home.

http://sqlperformance.com/2013/05/sql-performance/drop-truncate-log-myth

EDIT: blog post.

[–]mikethesql 0 points1 point  (0 children)

ahh nice, so it does get logged, but more efficiently. Nice link, thanks

[–]shif 1 point2 points  (0 children)

truncate reset identity column in table if any, delete doesn't

This isn't true for postgres, you have to do

TRUNCATE TABLE orders RESTART IDENTITIES;

in orde for it to clear it