Skip to content

Add runs index for project-scoped listing - #4517

Merged
r4victor merged 1 commit into
masterfrom
pr_runs_project_submitted_at_index
Nov 24, 2026
Merged

r4victor merged 1 commit into
masterfrom
pr_runs_project_submitted_at_index

Conversation

@r4victor

Copy link
Copy Markdown
Collaborator

Listing a project's runs had no index starting with project_id, so Postgres seq-scanned and sorted the whole runs table on every call (41ms on 36.5k runs on Sky prod, growing with the table).

  • Add ix_runs_project_id_submitted_at_id on runs (project_id, submitted_at DESC, id), so the project-scoped list, including cursor pages, ascending and only_active, becomes an index scan reading only the returned page (7ms → 0.25ms at 36k runs and 29ms → 0.27ms at 365k runs on synthetic data); it also serves other project-scoped lookups such as getting a run by name.
  • Keep ix_submitted_at_id, which still serves listing runs across projects (admins, or members without project_name), where a per-project index cannot produce the global order.

@r4victor
r4victor merged commit 523a06e into master Nov 24, 2026
26 checks passed
@r4victor
r4victor deleted the pr_runs_project_submitted_at_index branch November 24, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant