Improve LimitOffsetPagination.get_count to avoid extra Count query #8555
Unanswered
jurrian
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've traced back in blame that LimitOffsetPagination.get_count has used
queryset.count()
essentially since the start. However, this will cause an extra query and it would be more efficient to always use len() when we are going to use the queryset anyway (source).So this:
Needs to become this:
If tested this and it works. If there are no objections I can create an issue and a PR.
Beta Was this translation helpful? Give feedback.
All reactions