Implement issues de-duplication in raw SQL #2512
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Even after the cleanup, the migration 0014 (issue deduplication) was still slow on testing DB.
First I noticed that we lacked an index on
Issue.hash
so I added that. Query runtime sped up significantly, but not enough (still requiring a week of processing).Then I thought of creating temporary tables to write only the needed rows, but while doing that I realised I could simply partition the issues grouped by hashes, thus identifying duplicates, then update in-place the IssueLink references towards Issues, and finally delete the duplicate issues.
I'm currently running this on testing DB and on a copy of the production DB. I'll report back with times