Skip to content

Conversation

@scttcper
Copy link
Member

Replace N+1 get_or_create queries with batch operations:

  • Batch fetch existing authors with single filter(email__in=...)
  • Batch create missing authors with bulk_create(ignore_conflicts=True)
  • Batch update changed names with bulk_update

Reduces query count from 2N+ to at most 4 queries regardless of author count, improving performance for releases with many unique commit authors.

n+1 issue
https://sentry.sentry.io/issues/6234355863/

scttcper and others added 2 commits January 14, 2026 13:01
Replace N+1 get_or_create queries with batch operations:
- Batch fetch existing authors with single filter(email__in=...)
- Batch create missing authors with bulk_create(ignore_conflicts=True)
- Batch update changed names with bulk_update

Reduces query count from 2N+ to at most 4 queries regardless of
author count, significantly improving performance for releases
with many unique commit authors.

Co-Authored-By: Claude <[email protected]>
@scttcper scttcper requested review from a team and wedamija January 14, 2026 21:22
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants