Transaction vs Truncation Database Cleaner Transaction vs Truncation Database Cleaner ruby-on-rails ruby-on-rails

Transaction vs Truncation Database Cleaner


Putting it in a very simple way: truncation removes all data from the database and transaction rollbacks all changes that has been made by the running scenario.


Truncation removes the data leaving the database structure, transaction majorly rollback the database operation and it is the fastest strategy. And there is the last one which is deletion. Deletion deletes the data and removes the structure of the database, it is the slowest but safest.You can also check Difference between truncation, transaction and deletion database strategies