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

Added list_select_related to reduce duplicate SQL queries in admin UI #1177

Merged
merged 2 commits into from Jun 21, 2022
Merged

Added list_select_related to reduce duplicate SQL queries in admin UI #1177

merged 2 commits into from Jun 21, 2022

Conversation

phith0n
Copy link
Contributor

@phith0n phith0n commented Jun 21, 2022

Description of the Change

Added list_select_related in the admin IDTokenAdmin to avoid duplicate SQL queries.

Before adding the list_select_related, every 100 IDTokens 206 SQL queries is executed:

image

After adding the list_select_related, every 100 IDTokens 6 SQL queries is executed:

image

The total page loading time is 7305 milliseconds and 698 milliseconds respectively in my computer. It expects to reduce 10x the time.

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

@codecov
Copy link

codecov bot commented Jun 21, 2022

Codecov Report

Merging #1177 (5e8963f) into master (007a5c4) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1177   +/-   ##
=======================================
  Coverage   96.85%   96.85%           
=======================================
  Files          31       31           
  Lines        1812     1813    +1     
=======================================
+ Hits         1755     1756    +1     
  Misses         57       57           
Impacted Files Coverage Δ
oauth2_provider/admin.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 007a5c4...5e8963f. Read the comment docs.

Copy link
Member

@n2ygk n2ygk left a comment

Choose a reason for hiding this comment

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

Thanks for this!

@n2ygk n2ygk added this to the 2.1.0 milestone Jun 21, 2022
@n2ygk n2ygk merged commit b94f69e into jazzband:master Jun 21, 2022
@phith0n phith0n deleted the admin-efficiency branch June 22, 2022 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants