Skip to content

Speed up deletions#981

Open
dratchkov wants to merge 1 commit intoetianen:masterfrom
dratchkov:master
Open

Speed up deletions#981
dratchkov wants to merge 1 commit intoetianen:masterfrom
dratchkov:master

Conversation

@dratchkov
Copy link
Copy Markdown

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