Files
beads/internal/storage/sqlite/schema.go
Steve Yegge 1dd3109489 perf: Add composite index on dependencies(depends_on_id, type)
The hierarchical blocking query recursively joins on dependencies with
a type filter. Without a composite index, SQLite must scan all
dependencies for a given depends_on_id and filter by type afterward.

With 10k+ issues and many dependencies per issue, this could cause
noticeable slowdowns in ready work calculations.

Changes:
- Added idx_dependencies_depends_on_type composite index to schema
- Added automatic migration for existing databases
- Index creation is silent and requires no user intervention

The recursive CTE now efficiently seeks (depends_on_id, type) pairs
directly instead of post-filtering.

Resolves: bd-59

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 13:02:22 -07:00

4.0 KiB