Skip to content

Commit ce3740b

Browse files
michaelchuclaude
andcommitted
perf: scope runs overview query to standalone runs only
The overview aggregation (COUNT, MAX, AVG) was scanning all 2,673 runs including sweep children. Adding WHERE sweep_id IS NULL limits the scan to ~8 standalone rows, matching what the list endpoint actually displays. GET /runs: 0.46s → 0.09s (5x faster) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5b39787 commit ce3740b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/data/run_store.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ impl RunStore for SqliteRunStore {
236236
MAX(sharpe) as best_sharpe,
237237
AVG(win_rate) as avg_win_rate,
238238
AVG(sharpe) as avg_sharpe
239-
FROM runs",
239+
FROM runs
240+
WHERE sweep_id IS NULL",
240241
[],
241242
|row| {
242243
Ok(RunsOverview {
@@ -1153,7 +1154,7 @@ mod tests {
11531154
.unwrap();
11541155

11551156
let response = store.list(None).unwrap();
1156-
assert_eq!(response.overview.total_runs, 2); // 2 runs total in runs table
1157+
assert_eq!(response.overview.total_runs, 1); // 1 standalone run (overview excludes sweep children)
11571158
assert_eq!(response.rows.len(), 2); // 1 single + 1 sweep
11581159
}
11591160

0 commit comments

Comments
 (0)