database_cleaner-active_record icon indicating copy to clipboard operation
database_cleaner-active_record copied to clipboard

Parallelized truncates

Open florrain opened this issue 1 year ago • 0 comments

Hello,

I am working in an application that has a pretty large data model that is initially cleaned up with as of today 141 tables being truncated. Each TRUNCATE taking between 10ms and 20ms. That's almost 3 seconds of waiting for my database to be empty.

  • Before I start any work, are there any concerns against parallelizing those truncate statements using threads for example?
  • Would you be interested by a PR?

Ideas:

  • opt-in setting, parallelization would be turned off by default
  • I am most familiar with MySQL, but I don't see how running parallel truncates on different tables would be a concern
  • The threading would be positioned here, common for all adapters

Thanks,

florrain avatar Nov 21 '24 23:11 florrain