Improve issuable participants computation
What does this MR do and why?
Fetch system note authors separately so that we don't have to return every system note and load them into memory. This also saves us some CPU time as we skip parsing Markdown for these notes that could never have any user references.
This is helpful for issues / MRs with lots of system notes. A lot of the slow requests in https://gitlab.com/gitlab-org/gitlab/-/work_items/583451 are related to issues with a lot of system notes.
Queries
This is from an extreme example issue with lots of system notes: https://gitlab.com/gitlab-org/gitlab/-/work_items/365045
Before:
-
Issuable#notes: https://postgres.ai/console/gitlab/gitlab-production-main/sessions/50136/commands/148866
After:
-
Issuable#notes_with_possible_mentions: https://postgres.ai/console/gitlab/gitlab-production-main/sessions/50166/commands/148962 -
Issuable#system_note_authors: https://postgres.ai/console/gitlab/gitlab-production-main/sessions/50136/commands/148871
References
https://gitlab.com/gitlab-org/gitlab/-/work_items/583451
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #583451