During re-deployment of a process, any instances for the prior process are deleted together. When you have really many instances, this can take up quite some time and forces non-deterministic length of database transaction.
1. split the single big transaction into multiple small transactions
2. Ideally, process should be re-deployed right away and instances for old process should be ignored by the new process. Then, the instances for the old process get deleted with a lower priority.