Code search has a high number of database calls
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
There is a high number of calls to the database when loading code search results.
Steps to reproduce
- enable the performance bar
- make sure Zoekt is not enabled in preferences. I had a hard time getting this to show up due to Zoekt showing 1 result per match (Meaning all of the page results were from the same project so it didn't report such high database calls)
- perform a global code search: https://gitlab.com/search?group_id=9970&scope=blobs&search=target_project
- for the search I performed, there were 196 postgres calls
What is the current bug behavior?
There are some (undetected) N+1 calls for code search results
Possible fixes
- Web UI preloads from
SearchControllermentionwith_web_entity_associationsin the presenter forblobs, but I can't see any reference to that in the blob related code. Perhaps this is the problem? - view is rendered using HAML:
app/views/search/results/_blob.html.haml - N+1 specs are likely missing data setup (for whatever data is causing the excessive queries):
Edited by 🤖 GitLab Bot 🤖
