fix: use bulk updates for migration 0048 #538
No reviewers
Labels
No labels
automation
backend
bug
contributor experience
data
deployment
documentation
duplicate
good first issue
help wanted
nice to have
notifications
package maintainer
performance
skin
tech debt
user story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-community/nix-security-tracker#538
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-0048"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
shared_nixderivation
table in the production instance contains about three million rows (2.5GB). This isn't anything big by Postgres standards, but migration 0048 was accessing and updating each row one by one, which is slow and was running for more than 24 hours in the production instance.I edited the migration to use bulk_updates instead and batched the processing of rows to make things faster. The thirty thousand rows as a batch number is somewhat arbitrary after some tests I made with 100k that seemed a bit too much.