Skip to content

perf(artifact-bundles): Filter search joins by organization_id#114111

Merged
scttcper merged 1 commit intomasterfrom
scttcper/artifact-bundles-search-org-filter
Apr 28, 2026
Merged

perf(artifact-bundles): Filter search joins by organization_id#114111
scttcper merged 1 commit intomasterfrom
scttcper/artifact-bundles-search-org-filter

Conversation

@scttcper
Copy link
Copy Markdown
Member

@scttcper scttcper commented Apr 27, 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

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>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 27, 2026
@scttcper scttcper marked this pull request as ready for review April 28, 2026 15:24
@scttcper scttcper requested a review from a team as a code owner April 28, 2026 15:24
@scttcper scttcper requested a review from a team April 28, 2026 15:24
@scttcper scttcper merged commit 8d59b89 into master Apr 28, 2026
59 checks passed
@scttcper scttcper deleted the scttcper/artifact-bundles-search-org-filter branch April 28, 2026 17:16
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