Problem: In direct mode, bd list was making a separate GetLabels() call for each issue when displaying labels. With 538 issues, this resulted in 538 separate database queries. While investigating the reported 5+ second slowness, discovered this N+1 query issue that would impact performance with many issues. Solution: 1. Added GetLabelsForIssues(issueIDs []string) to Storage interface 2. Implemented bulk fetch in SQLite (already existed, now exposed) 3. Implemented bulk fetch in MemoryStorage 4. Updated list.go to fetch all labels in single query Changes: - internal/storage/storage.go: Add GetLabelsForIssues to interface - internal/storage/memory/memory.go: Implement GetLabelsForIssues - cmd/bd/list.go: Use bulk fetching in all output modes Impact: Eliminates N queries for labels, replacing with 1 bulk query. This optimization applies to direct mode only (daemon mode already uses bulk operations via RPC). Note: The reported 5s slowness was actually caused by daemon auto-start timeout. Use --no-daemon flag or run 'bd migrate --update-repo-id' to resolve the legacy database issue causing daemon startup failures. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
26 KiB
26 KiB