File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -410,6 +410,11 @@ static MIGRATIONS: &[&str] = &[
410410
411411 CREATE INDEX error_artifact_idx ON error(aid);
412412 "# ,
413+ // For completed requests we take the last N completed. As the total number
414+ // of requests grows to make things fast we need an index on the completed_at
415+ r#"
416+ CREATE INDEX benchmark_request_completed_idx ON benchmark_request(completed_at);
417+ "# ,
413418] ;
414419
415420#[ async_trait:: async_trait]
@@ -743,10 +748,8 @@ impl PostgresConnection {
743748 UNION
744749 SELECT tag FROM parents
745750 )
746- SELECT job_queue.*
747- FROM requests
748- -- Only get requests that have some jobs
749- RIGHT JOIN job_queue on job_queue.request_tag = requests.tag
751+ -- Only get the jobs of in_progress requests
752+ SELECT * FROM job_queue INNER JOIN requests ON job_queue.request_tag = requests.tag
750753 " ) ) . await . unwrap ( ) ,
751754 } ) ,
752755 conn,
You can’t perform that action at this time.
0 commit comments