Add blocked_issues_cache table for GetReadyWork optimization
Introduces a materialized cache table to store blocked issue IDs, replacing the expensive recursive CTE computation that was causing ~752ms query times on 10K databases (bd-5qim). The cache is maintained via invalidation on dependency and status changes, reducing GetReadyWork from O(n²) recursive traversal to O(1) cache lookup. Technical details: - New blocked_issues_cache table with single issue_id column - ON DELETE CASCADE ensures automatic cleanup - Migration populates cache using existing recursive CTE logic - rebuildBlockedCache() fully rebuilds cache on invalidation - execer interface allows both *sql.DB and *sql.Tx usage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,7 @@ var migrationsList = []Migration{
|
||||
{"source_repo_column", migrations.MigrateSourceRepoColumn},
|
||||
{"repo_mtimes_table", migrations.MigrateRepoMtimesTable},
|
||||
{"child_counters_table", migrations.MigrateChildCountersTable},
|
||||
{"blocked_issues_cache", migrations.MigrateBlockedIssuesCache},
|
||||
}
|
||||
|
||||
// MigrationInfo contains metadata about a migration for inspection
|
||||
@@ -69,6 +70,7 @@ func getMigrationDescription(name string) string {
|
||||
"source_repo_column": "Adds source_repo column for multi-repo support",
|
||||
"repo_mtimes_table": "Adds repo_mtimes table for multi-repo hydration caching",
|
||||
"child_counters_table": "Adds child_counters table for hierarchical ID generation with ON DELETE CASCADE",
|
||||
"blocked_issues_cache": "Adds blocked_issues_cache table for GetReadyWork performance optimization (bd-5qim)",
|
||||
}
|
||||
|
||||
if desc, ok := descriptions[name]; ok {
|
||||
|
||||
Reference in New Issue
Block a user