Skip to content

fix: eliminate N+1 query patterns in dependency resolution#73

Open
marcus wants to merge 1 commit intomainfrom
perf-regression
Open

fix: eliminate N+1 query patterns in dependency resolution#73
marcus wants to merge 1 commit intomainfrom
perf-regression

Conversation

@marcus
Copy link
Copy Markdown
Owner

@marcus marcus commented Mar 22, 2026

Summary

  • Replace 5 N+1 query loops with batch fetches (GetIssuesByIDs/GetIssueStatuses) in dependency.GetDependencies, dependency.GetDependents, dependency.getTransitiveBlockedFiltered, db.GetDescendantIssues, and db.cascadeUnblockDependentsLocked
  • Add composite indexes idx_issues_impl_status and idx_deps_depends_on via schema migration v30
  • Add benchmarks for GetDescendantIssues, GetDependencies/GetDependents, GetTransitiveBlocked, and CascadeUnblockDependents

Test plan

  • All existing tests pass (go test ./... — 29 packages)
  • Benchmarks run successfully
  • Verify migration v30 applies cleanly on existing databases

🤖 Generated with Claude Code


Automated by nightshift

…dexes

Replace 5 N+1 query loops with batch fetches using GetIssuesByIDs and
GetIssueStatuses: dependency.GetDependencies, dependency.GetDependents,
dependency.getTransitiveBlockedFiltered, db.GetDescendantIssues, and
db.cascadeUnblockDependentsLocked. Add composite indexes on
issues(implementer_session, status) and issue_dependencies(depends_on_id)
via schema migration v30. Add benchmarks for critical paths.

Nightshift-Task: perf-regression
Nightshift-Ref: https://github.com/marcus/nightshift

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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