Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove not always supported auto select_related #651

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

Merged
n2ygk merged 1 commit into django-json-api:master from sliverc:remove_auto_select_related
Jun 7, 2019

Conversation

Copy link
Member

@sliverc sliverc commented Jun 3, 2019

Addresses testing issue in #643

Description of the Change

Polymorphic models do not always support select_related and might actually be slower.

Hence reverting change of AutoPreloadMixin as it has not been released yet.

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

@sliverc sliverc requested a review from n2ygk June 3, 2019 10:07
@sliverc sliverc mentioned this pull request Jun 3, 2019
5 tasks
Copy link

codecov bot commented Jun 3, 2019
edited
Loading

Codecov Report

Merging #651 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@
## master #651 +/- ##
=======================================
 Coverage 96.13% 96.13% 
=======================================
 Files 56 56 
 Lines 2869 2869 
=======================================
 Hits 2758 2758 
 Misses 111 111
Impacted Files Coverage Δ
example/tests/test_performance.py 100% <100%> (ø) ⬆️

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 b884535...512846e. Read the comment docs.

Copy link
Contributor

Probably we want Polymorpihc stuff make using custom select/prefetch related config, but not removing auto_select_related just because it is not supported by Polymorphic. But backwards compatibility suffers in that case.

Copy link
Member Author

sliverc commented Jun 3, 2019

First I thought it would be a good idea to automatically choose select_related but when thinking about it again in some cases it might only be a very small improvement but in some others it might be a major slow down all depending on the database structure as explained here

So all in all also for backwards compatibility it is better to remove it. And in some case if someone has a data structure which is faster with select_related they can now use select_for_includes.

Anton-Shutik reacted with thumbs up emoji

Polymorphic models do not always support `select_related` as of
https://django-polymorphic.readthedocs.io/en/stable/advanced.html?highlight=select_related#about-queryset-methods
and might actually be slower in some cases as explained in https://django-rest-framework-json-api.readthedocs.io/en/stable/usage.html?highlight=usage#performance-improvements
Hence reverting change of AutoPreloadMixin as it has not been released yet.
@sliverc sliverc force-pushed the remove_auto_select_related branch from bd8ed3f to 512846e Compare June 4, 2019 12:11
Copy link
Contributor

@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.

Sorry I forgot this was assigned to me. I'm a little iffy on this as I've no experience using the polymorphic code, but if @sliverc and @Anton-Shutik are OK with this (as indicated) then I approve.

@n2ygk n2ygk merged commit cac09bd into django-json-api:master Jun 7, 2019
@sliverc sliverc deleted the remove_auto_select_related branch June 7, 2019 15:00
n2ygk added a commit to n2ygk/django-rest-framework-json-api that referenced this pull request Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@n2ygk n2ygk n2ygk approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /