Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

destroy_fully! does not perform real deletion at once. Performance issue. #203

Open
pilgunboris opened this issue Feb 25, 2021 · 0 comments

Comments

@pilgunboris
Copy link

Hello!
I have a huge performance issue when trying to rollback a big data import and calling destroy_fully! on each ActiveRecord instance with acts_as_paranoid support. Each instance has multiple soft-deletable associations with dependeng: :destroy options.
This whole process is unacceptably slow and one of the reasons (except slow AR by itself) is that destroy_fully! doesn't really destroy the resource and associations at once but at first it soft-deletes them and then makes real full deletion as a second round.
Is there any way to make this a single-round process and destroy them at once just like it would be in pure Rails?

Similarly to how we can disable touching of the associations just for a block of code:

ActiveRecord::Base.no_touching do
  ...
end

If it is not possible yet then maybe it can be added as a new feature?
Or might be something that will just disable acts_as_paranoid completely inside of a specified block of code?
Will it be possible to only decrease dependent cache_counters in such case if any?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant