I need to mass delete about 600k users from a drupal install, I have the UIDS, and built a drush script to do it, however the problem is that this is a live site, so it seems that user_delete_multiple acquires a lock for the whole duration ( even split into chunks of 100 it takes too long). so iterating over the array one by one (thus releasing the lock in between and allowing normal operation), and deleting at a rate of 1.5 users per second. 600k --> going to take about a week.
Plus I cannot parallelize this because of the lock on the table (tried it , it makes it slower). what other options to I have? ( I looked into deleting from database directly but there are lots of modules that implemente user_delete and entity_delete so I might forget something...
I'm looking maybe at using the same script but removing the lock on the table... do now know how to to this, but could be an option.
[EDIT] just edited the script a but, chunking in size 5 arrays, and using user_delete_multiple. this allows me to save 4 calls to module_invoke_all which did gain me a bit of speed . I am currently deleting at 5 users in 4, 4.5 s). this also allows me to maintain the lock for less time and also allow site to operate. waitig to see if site is still usable with this fix..