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

Speed up deletions #981

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Speed up deletions #981

wants to merge 1 commit into from

Conversation

dratchkov
Copy link

There are two performance issues I encountered with the 'deleterevisions' command:

  • The query to obtain the revisions that need to be deleted was very slow. This is part because a given revision may have many object versions attached to it, so the revision_id list ends up being large and populated with largely similar values. Thus adding .distinst() to the query speeds up the process enourmously
  • Calling revisions_to_delete.delete() has the side effect of loading all versions and calling any signals. In my case, this consumed a lot of memory and blew up. I propose to pre-delete all versions using ._raw_delete() method. I considered object caches, but since the revisions are deleted with .delete(), any revisions objects will be invalidated, so at worst, any Version objects in the cache will remain inaccessible and get invalidated slowly over time.

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

Successfully merging this pull request may close these issues.

1 participant