Database 101 says...always truncate instead of doing a delete from on tables. It's faster and more efficient. Well, everything you learn in a beginning class is wrong sometimes.
We had a set of Junit tests that truncated a set of Oracle tables a few thousand times. It took a long time. Changing those truncates to deletes made the tests run about 10 times as fast. So apparently truncate has some overhead that delete does not.
Lesson: the stuff you learn in Anything 101 should be verified.
Thursday, July 19, 2012
Subscribe to:
Posts (Atom)