Skip to content

perf: index dashboard job ordering - #209

Merged
polsala merged 1 commit into
mainfrom
perf/issue-201-dashboard-order-index
Sep 22, 2026
Merged

polsala merged 1 commit into
mainfrom
perf/issue-201-dashboard-order-index

Conversation

@polsala

@polsala polsala commented Sep 22, 2026

Copy link
Copy Markdown
Member

Summary

  • add an expression index matching the dashboard's status-priority and recency ordering
  • add a populated-database query-plan regression test for the exact unfiltered dashboard query
  • assert that SQLite uses the index and does not create a temporary B-tree for ordering

Validation

  • pytest -q — 354 passed
  • regression check without the index produces SCAN jobs | USE TEMP B-TREE FOR ORDER BY

Closes #201

@polsala
polsala requested a review from giscebot September 22, 2026 09:03
@polsala
polsala enabled auto-merge September 22, 2026 09:13

@giscebot giscebot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. The expression index matches the dashboard's canonical status-priority, recency, and deterministic ID ordering exactly, so SQLite can satisfy the unfiltered LIMIT query by walking the index instead of scanning and building a temporary B-tree. The populated query-plan regression uses the production SELECT/order expression, asserts the named index is selected, and explicitly rejects a temporary ORDER BY B-tree; the existing behavior test still covers returned ordering. I also checked that schema.sql is handled by the repository's migration-sensitive autoupdate path. GitHub CI passes on Python 3.11 and 3.12. I attempted the two focused tests locally, but this checkout has no test dependencies installed (collection stopped at missing fastapi), so I relied on the green CI runs for execution evidence.

@polsala
polsala merged commit d3b752b into main Sep 22, 2026
3 checks passed
@polsala
polsala deleted the perf/issue-201-dashboard-order-index branch September 22, 2026 09:38
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.

perf: /api/jobs performs a full scan and temporary sort on every request

2 participants