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

lazy_belongs_to produces redundant queries #52

Open
stokarenko opened this issue Feb 25, 2020 · 0 comments
Open

lazy_belongs_to produces redundant queries #52

stokarenko opened this issue Feb 25, 2020 · 0 comments

Comments

@stokarenko
Copy link
Collaborator

There is a pretty useful jsonapi_use_foreign_key_on_belongs_to_relationship AMS setting:

When true, the relationship will determine its resource object identifier without calling the association or its serializer. This can be useful when calling the association object is triggering unnecessary queries.

It works pretty well for native belongs_to serializer's associations, but does not affect to lazy_belongs_to ones at the moment, producing redundant SQL queries.

Lazy relationship still turns N+1 into single query so the problem is not quite critical. In additional, has_one and has_many relationships will be loaded eventually. But still )

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

No branches or pull requests

1 participant