Chronic insertions view in need of optimization
Open
@k1o0 is already working on this.
Since Aug 14, 2026.
enhancement
refactor
rest-api
- Dominant language
- Python
- Stars
- 52
- Forks
- 12
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 4
Description
The chronic-insertions list endpoint is extremely slow and produces over 9000 queries! The detail view is also inefficient, requiring 111 queries. I attempted to improve the setup_eager_loading method of ChronicProbeInsertionListSerializer with the following:
queryset = queryset.select_related('model', 'session', 'session__subject', 'session__lab')
queryset = queryset.prefetch_related('session__projects')
return queryset.order_by('-session__start_time')
However this does not appear to improve the situation.
What's more, the chronic probe insertion contains subject, lab, and name fields in addition to a probe_insertion field containing the same fields within session_info.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.