Wiki search has a high number of database calls
Summary
There is a high number of calls to the database when loading group wiki search results.
Steps to reproduce
- enable the performance bar
- perform a group wiki search: https://gitlab.com/search?group_id=9970&scope=wiki_blobs&search=test
- for the search I performed, there were 148 postgres calls
What is the current bug behavior?
There are some (undetected) N+1 calls for wiki search results
Possible fixes
- Wikis do not appear to have a preloads from
SearchControllerin the presenter:app/presenters/search_service_presenter.rb, we can add one - wiki view is rendered using HAML:
app/views/search/results/_wiki_blob.html.haml - N+1 specs are likely missing data setup (for whatever data is causing the excessive queries):