You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(teamStats): Fix timeouts on Unresolved Issues graph (#95715)
The Unresolved Issues graph is currently hanging, then eventually
erroring out. Investigating, it seems like it's the DB query timing out.
Signs point to that coming from the large number of subqueries involved
in the `GroupHistory` query.
Those subqueries exist because `GroupHistory` may contain multiple rows
with the same `status` for any given `group_id` (or with different
`status` in our same "state" category), so we need to deduplicate to
only rows that change between an open or closed state.
The current solution (subqueries) is inefficient on large # of
group_ids, which can lead to timeouts.
Another option would be to use `DISTINCT ON` queries to ensure we only
get one row per each `(group_id, open/closed state)` pair. Unfortunately
Django does not currently support `annotate()` and `distinct(fields)`
together.
Instead, what we do here is pull additional data and do the
deduplication logic in Python.
Test plan: loads without error in my sandbox.
---------
Co-authored-by: Charles Paul <charlespaul@R4KCFH7MHY.local>
0 commit comments