Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate n+1 query for user.tagnames #8189

Closed
Tlazypanda opened this issue Jul 25, 2020 · 2 comments · Fixed by #8190
Closed

Eliminate n+1 query for user.tagnames #8189

Tlazypanda opened this issue Jul 25, 2020 · 2 comments · Fixed by #8190
Labels
feature explains that the issue is to add a new feature outreachy

Comments

@Tlazypanda
Copy link
Collaborator

Please describe the desired behavior.
Wherever we are calling the function user.tagnames, the users don't include/eager-load the tag model which leads to n+1 queries.
Example: - list.html.erb line 70 (user.tags function is called which in turn calls the user.tagnames function)
Triggered from user.rb line line 161 method- tagnames
Can check this on /people route

Additional context (optional)
Feel free to include any applicable: code, screenshots, or gifs.

@Tlazypanda Tlazypanda added feature explains that the issue is to add a new feature outreachy labels Jul 25, 2020
@Tlazypanda Tlazypanda added this to the Performance Summer 2020 milestone Jul 25, 2020
@sagarpreet-chadha
Copy link
Contributor

Hi @Tlazypanda ,
So eager loading this query, we will make 1 huge query instead of n queries, is it?

@Tlazypanda
Copy link
Collaborator Author

Tlazypanda commented Jul 25, 2020

Yeah 😅 but I am not sure if the code is right for this because it's not making much of a difference on my local setup so am not able to monitor. I guess after pushing we have to check if skylight can spot or any other way for this? 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature explains that the issue is to add a new feature outreachy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants