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
This commit is contained in:
5 files changed
+1549
-2
No files matched your search
@@ -34,6 +34,8 @@ step 1 (Hugging Face downloader) is released as a minor version.
|
|||||||
file list it just fetched (a commit's files never change), the author's avatar loads alongside,
|
file list it just fetched (a commit's files never change), the author's avatar loads alongside,
|
||||||
and the regular Hub check asks only for the commit SHA instead of the full model info.
|
and the regular Hub check asks only for the commit SHA instead of the full model info.
|
||||||
- The **Model card** tab shows the page at once and the card when it arrives from the Hub.
|
- The **Model card** tab shows the page at once and the card when it arrives from the Hub.
|
||||||
|
- Database indexes for the queries the live view and the worker repeat every few seconds (the
|
||||||
|
migration runs by itself on start).
|
||||||
|
|
||||||
## [0.16.0] - 2026-10-30
|
## [0.16.0] - 2026-10-30
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CREATE INDEX `benchmark_runs_state_idx` ON `benchmark_runs` (`state`,`created_at`);--> statement-breakpoint
|
||||||
|
CREATE INDEX `jobs_finished_idx` ON `jobs` (`finished_at`);
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -169,6 +169,13 @@
|
|||||||
"when": 1793115558680,
|
"when": 1793115558680,
|
||||||
"tag": "0023_scan_schedule",
|
"tag": "0023_scan_schedule",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 24,
|
||||||
|
"version": "6",
|
||||||
|
"when": 1793567055573,
|
||||||
|
"tag": "0024_polling_indexes",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
+11
-2
@@ -243,7 +243,12 @@ export const jobs = sqliteTable(
|
|||||||
createdAt: createdAt(),
|
createdAt: createdAt(),
|
||||||
updatedAt: updatedAt(),
|
updatedAt: updatedAt(),
|
||||||
},
|
},
|
||||||
(t) => [index("jobs_state_idx").on(t.state), index("jobs_model_idx").on(t.modelId)],
|
(t) => [
|
||||||
|
index("jobs_state_idx").on(t.state),
|
||||||
|
index("jobs_model_idx").on(t.modelId),
|
||||||
|
// The live view polls open jobs plus recently finished ones once a second.
|
||||||
|
index("jobs_finished_idx").on(t.finishedAt),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
export const jobFiles = sqliteTable(
|
export const jobFiles = sqliteTable(
|
||||||
@@ -719,7 +724,11 @@ export const benchmarkRuns = sqliteTable(
|
|||||||
description: text("description"),
|
description: text("description"),
|
||||||
createdAt: createdAt(),
|
createdAt: createdAt(),
|
||||||
},
|
},
|
||||||
(t) => [index("benchmark_runs_created_idx").on(t.createdAt)],
|
(t) => [
|
||||||
|
index("benchmark_runs_created_idx").on(t.createdAt),
|
||||||
|
// The worker looks for the next queued run every 2 s.
|
||||||
|
index("benchmark_runs_state_idx").on(t.state, t.createdAt),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
export const benchmarkLogs = sqliteTable(
|
export const benchmarkLogs = sqliteTable(
|
||||||
|
|||||||
Reference in new issue
Block a user