Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove O(N) queries from workspace status API
Previously this was doing O(N) queries, which we accepted when the API was addede because we did not, at the time, have workspaces with more than low-10s of jobs. We now have workspaces with hundreds of jobs defined. On a particularly large workspace (long-covid-symptoms) this endpoint could take as long as 5s (and ~300 queries) to calculate. This change uses raw SQL so we can make use of a GROUP BY in the CTE to get the latest actions and then JOIN to it in the outer query to match those up with their statuses.
- Loading branch information