Skip to content

feat(issues): Skip Snuba for issue.id-only searches#111740

Closed
scttcper wants to merge 3 commits intomasterfrom
scttcper/feat-issue-id-search-shortcut
Closed

feat(issues): Skip Snuba for issue.id-only searches#111740
scttcper wants to merge 3 commits intomasterfrom
scttcper/feat-issue-id-search-shortcut

Conversation

@scttcper
Copy link
Copy Markdown
Member

@scttcper scttcper commented Mar 27, 2026

I think its more clear to search on issue.id:[1, 2, 3] than remember that ?group=1&group=2&group=3 exists, pipe them through the same shortcut.

Skip the full Snuba/ClickHouse search pipeline when the issue search query is exclusively an issue.id filter, resolving groups directly from Postgres instead. This eliminates multi-category ClickHouse queries, hit count sampling, and the chunked search loop — replacing it all with a single Postgres WHERE id IN (...).

Frontend call sites that benefit:

  • Related issues drawer (groupRelatedIssues/index.tsx) — fetches same-root-cause and same-trace issues by ID
  • Supergroup drawer (supergroups/supergroupDrawer.tsx) — displays issues within a supergroup
  • Dashboard drill-down (dashboards/issueFieldRenderers.tsx) — links from dashboard widgets to specific issues

When the search query is exclusively an issue.id filter (e.g.
issue.id:[1,2,3]), short-circuit the full Snuba/ClickHouse search
pipeline and resolve groups directly from Postgres. This avoids
multi-category ClickHouse queries, hit count sampling, and the
chunked search loop for a simple ID lookup.

The optimization detects issue.id filters via a cheap substring
check before invoking the query parser, adding zero overhead to
requests that don't contain issue.id.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 27, 2026
Use explicit isinstance checks instead of to_list to satisfy mypy's
type narrowing for SearchValue.raw_value.
@scttcper scttcper force-pushed the scttcper/feat-issue-id-search-shortcut branch from ac232b1 to af968b8 Compare March 27, 2026 19:25
@scttcper scttcper marked this pull request as ready for review March 27, 2026 19:31
@scttcper scttcper requested review from a team as code owners March 27, 2026 19:31
@scttcper scttcper closed this Mar 31, 2026
@scttcper scttcper deleted the scttcper/feat-issue-id-search-shortcut branch March 31, 2026 18:24
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant