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

Improve the user chooser queries, reducing N+1 #114

Merged
merged 1 commit into from
Mar 13, 2025

Conversation

zerolab
Copy link
Contributor

@zerolab zerolab commented Mar 12, 2025

What is the context of this PR?

A follow up to #113 that reduces a number of N+1 queries as the "name" column also tries to pull in the user's profile pic.

Inspired by 816bfd0

Before: 15
After: 5

How to review

You can use Django Debug Toolbar's request history:

  • go to /admin/user_chooser/
  • go to /admin
  • open DDT, click the "History" panel and find the /admin/user_chooser/ request, click "switch" and check the SQL panel

@zerolab zerolab requested a review from a team as a code owner March 12, 2025 17:19
@zerolab zerolab requested a review from RealOrangeOne March 12, 2025 17:21
@zerolab zerolab requested a review from MebinAbraham March 12, 2025 17:41
Copy link
Contributor

@MebinAbraham MebinAbraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@zerolab zerolab merged commit ce0f3ca into main Mar 13, 2025
9 checks passed
@zerolab zerolab deleted the tweak-user-chooser-queries branch March 13, 2025 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants