perf(artifact-bundles): Filter search joins by organization_id#114111
Merged
perf(artifact-bundles): Filter search joins by organization_id#114111
Conversation
The artifact bundles list endpoint OR's release_name/dist_name/debug_id filters across the releaseartifactbundle and debugidartifactbundle joins when a query param is passed. Neither join carried an organization_id predicate, so the composite indexes (which both lead with organization_id) couldn't be used and the planner fell back to the FK auto-index plus row-by-row name filtering. Pushes the org_id filter into each Q so the composite indexes are usable. Kept inside each Q rather than as a top-level filter to avoid turning the LEFT-able join into a required INNER join. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
JoshFerge
approved these changes
Apr 28, 2026
cleptric
pushed a commit
that referenced
this pull request
May 5, 2026
when doing a query with `?query=release-name` we're doing a join on the `releaseartifactbundle` table but not using the index which starts with org id. Potentially doing joins with all releases with the same name before filtering down to the correct org. Fixing the same thing as #114103 [trace query](https://sentry.sentry.io/explore/traces/?aggregateField=%7B%22groupBy%22%3A%22%22%7D&aggregateField=%7B%22yAxes%22%3A%5B%22p95%28span.duration%29%22%5D%7D&extrapolate=0&field=id&field=span.name&field=span.description&field=span.duration&field=transaction&field=timestamp&mode=samples&project=1&query=http.query%3A%EF%80%8DContains%EF%80%8Dquery%20span.description%3A%2Fapi%2F0%2Fprojects%2F%7Borganization_id_or_slug%7D%2F%7Bproject_id_or_slug%7D%2Ffiles%2Fartifact-bundles%2F&sort=-span.duration&statsPeriod=14d)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
when doing a query with
?query=release-namewe're doing a join on thereleaseartifactbundletable but not using the index which starts with org id. Potentially doing joins with all releases with the same name before filtering down to the correct org.Fixing the same thing as #114103
trace query