Files
Kaname/drizzle/0024_polling_indexes.sql
T
Claude 6b779debf7 DB: indexes for the polling queries
- jobs(finished_at): the live view's "open or finished in the last 5 minutes"
  query, run once a second per visible tab, was a full scan of the job
  history; it is now a multi-index lookup (0.23 -> 0.04 ms at 2,000 jobs).
- benchmark_runs(state, created_at): the worker's look for the next queued run
  every 2 s scanned every run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EooZ9biu7kFNB4eDJrwQc5
2026-11-01 21:04:45 +00:00

2 lines
167 B
SQL

CREATE INDEX `benchmark_runs_state_idx` ON `benchmark_runs` (`state`,`created_at`);--> statement-breakpoint
CREATE INDEX `jobs_finished_idx` ON `jobs` (`finished_at`);