N+1 issue in epic referenced
When using epic autocomplete, there is N+1 issue when rendering epic's to_reference (called from https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/serializers/group_issuable_autocomplete_entity.rb#L7):
https://log.gprd.gitlab.net/goto/f903672c8118a774026b1b27352281be:
Reproducer:
- go to an epic in gitlab-org group
- try to add an existing epic to the epic in the
Epics and Issues
widget (clickAdd
->Add existing epic
-> press&
to trigger autocomplete)
Although the query is called 8000 times in this case, most of queries are cached (because for gitlab-org we keep most of epics in the same group).
Edited by Jan Provaznik