Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
perf(db): index assignee frequency history (MUL-7228) (#8243)
Multica Evecf946dc9a678
diff --git a/server/cmd/migrate/main.go b/server/cmd/migrate/main.goindex e99311670d..b3fe576d08 100644--- a/server/cmd/migrate/main.go+++ b/server/cmd/migrate/main.go@@ -299,6 +299,7 @@ var concurrentIndexCleanups = map[string]string{"445_comment_delegated_failure_unsettled_index": "idx_comment_delegated_failure_unsettled","446_issue_properties_bigm_index": "idx_issue_properties_bigm","452_agent_task_pending_thread_unique": "idx_one_pending_task_per_issue_agent_thread",+ "458_activity_log_member_assignee_frequency_index": "idx_activity_log_member_assignee_frequency",}// concurrentDownIndexCleanups covers every migration whose down directiondiff --git a/server/migrations/458_activity_log_member_assignee_frequency_index.down.sql b/server/migrations/458_activity_log_member_assignee_frequency_index.down.sqlnew file mode 100644index 0000000000..cbdeabdacd--- /dev/null+++ b/server/migrations/458_activity_log_member_assignee_frequency_index.down.sql@@ -0,0 +1 @@+DROP INDEX CONCURRENTLY IF EXISTS idx_activity_log_member_assignee_frequency;diff --git a/server/migrations/458_activity_log_member_assignee_frequency_index.up.sql b/server/migrations/458_activity_log_member_assignee_frequency_index.up.sqlnew file mode 100644index 0000000000..caa36ac26e--- /dev/null+++ b/server/migrations/458_activity_log_member_assignee_frequency_index.up.sql@@ -0,0 +1,15 @@+-- CountAssigneeChangesByActor filters by workspace and member actor, then+-- groups on the assignment target stored in details. Keep the expressions in+-- key order so PostgreSQL can aggregate the matching history directly from+-- this targeted partial index instead of scanning the full activity log.+CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_activity_log_member_assignee_frequency+ ON activity_log (+ workspace_id,+ actor_id,+ (details->>'to_type'),+ (details->>'to_id')+ )+ WHERE actor_type = 'member'+ AND action = 'assignee_changed'+ AND details->>'to_type' IS NOT NULL+ AND details->>'to_id' IS NOT NULL;