Sentry engineer points Claude (Opus 5.5) at Sentry's own traces via the Sentry MCP and ships small fixes that remove hundreds of millions of queries a week
Over a few weeks a Sentry engineer connected Claude with Opus 5.5 to the Sentry MCP, pointed it at Sentry's own org, and asked it to find hot-path performance issues. The agent ranked spans by frequency and duration, gave a file and line, estimated weekly volume and an example trace for each candidate, read the code and git history to say what might break, and opened a draft PR when a fix held up. For SQL changes it ran EXPLAIN ANALYZE before and after on a read-only database mirror. Most fixes changed a line or two: skipping a ~10k/s UPDATE during ingestion, reusing a loaded project (an estimated ~143M fewer SELECTs a week), rewriting a GroupHistory query (935ms → 0.4ms on the mirror), eager-loading Sentry app objects (~29M fewer queries a day), adding a pagination index, and batching cache writes. The engineer steered it away from unfamiliar areas and checked for existing work.
The numbers (as reported)
| Queries removed | Hundreds of millions a week (estimate from sampled spans) |
|---|---|
| Project reuse fix | ~143M extra SELECTs a week removed (estimate) |
| GroupHistory query | 935ms → 0.4ms (busiest group, mirror, warm cache) |
| save_issue_occurrence | p50 ~35ms → ~30ms; p95 ~95ms → ~61ms |
| Repository pagination | Average DB execution 30ms → 9.2ms (~69%) |
Facts
- Company / subject
- Sentry
- Tools
- Claude
- Models
- Claude Opus 5.5
- Codebase
- brownfield
- Work type
- Refactor / maintenance
- Stack
- Python, Django, PostgreSQL
- Published
- 2026-11-03
- Last checked
- 2026-11-18
What the source claims Practitioner (own blog/paper)
Claimed by the builder, writing about their own work. Not checked independently.
- Small fixes together removed hundreds of millions of queries a week
“they removed hundreds of millions of queries a week”
- A ~10k/s UPDATE on the attachments database is basically gone and commits on that database fell ~17% ~17% fewer commits
- The GroupHistory query's disk reads fell to nearly zero; status changes ~30% faster in the US and ~13% in the EU ~30% (US), ~13% (EU)
- Eager-loading cut roughly 29M queries a day on the control database ~1.9% → ~0.16% of query volume
- A missing index cut average database execution ~69% 30ms → 9.2ms
Caveats
Written by the Sentry engineer who did the work, on Sentry's blog, which also promotes the Sentry MCP. Query volumes and savings are estimates from sampled spans; some comparisons are against the same hours the previous day. No PR count, cost or exact duration ('the last few weeks').
More stories by tool: Claude
Related topics: Refactoring and maintenanceBrownfield codebases