Skip to content

Avoid per-config wide-row queries in MCP tools - #659

Merged
hsbt merged 1 commit into
masterfrom
mcp-query-timeout
Jul 28, 2026
Merged

Avoid per-config wide-row queries in MCP tools#659
hsbt merged 1 commit into
masterfrom
mcp-query-timeout

Conversation

@hsbt

@hsbt hsbt commented Jul 28, 2026

Copy link
Copy Markdown
Member

After deploying #658, find_failure_origin without a server argument times out with Heroku H12. It issued SELECT reports.* per configuration, and each of those took 2 to 5 seconds on production because no composite index covers the datetime sort and every row carries the multi-KB ltsv column, so a few dozen configurations exceed the 30s limit. This scans the lookback window once with a narrow pluck, resolves the failing-streak boundaries in Ruby, and loads only the boundary reports by primary key. failing_servers had the same query shape in its latest-report check, which is now a single grouped maximum(:id) query. Tool output is unchanged.

🤖 Generated with Claude Code

find_failure_origin issued SELECT reports.* per configuration, which
took 2-5 seconds each on production (no composite index covers the
datetime sort and each row carries the multi-KB ltsv column) and hit
Heroku's 30s H12 timeout. Scan the window once with a narrow pluck and
load only the boundary reports by id. failing_servers had the same
shape in its latest-report check; replace it with one grouped query.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hsbt
hsbt merged commit 63f7241 into master Jul 28, 2026
2 checks passed
@hsbt
hsbt deleted the mcp-query-timeout branch July 28, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant