-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
hacks for getting around the select_related
issue from parent on inherited models to avoid n+1 queries?
#436
Comments
drivelous
changed the title
hacks for getting around the
are there hacks for getting around the May 20, 2020
select_related
issue from parent on inherited models?select_related
issue from parent on inherited models to avoid n+1 queries?
drivelous
changed the title
are there hacks for getting around the
hacks for getting around the May 20, 2020
select_related
issue from parent on inherited models to avoid n+1 queries?select_related
issue from parent on inherited models to avoid n+1 queries?
pgammans
added a commit
to bva-icx/django-polymorphic
that referenced
this issue
Jun 26, 2023
implement support for a single query for select related base fetches across polymorphic models. adds a polymorphic QuerySet Mixin to enable non polymorphic models to fetch related models. Fixes: jazzband#198 jazzband#436 jazzband#359 jazzband#244 Possible Fixes: jazzband#498: support for prefetch_related cannot fetch attributes not on all child models or via class names Related: jazzband#531
pgammans
added a commit
to bva-icx/django-polymorphic
that referenced
this issue
Jun 26, 2023
implement support for a single query for select related base fetches across polymorphic models. adds a polymorphic QuerySet Mixin to enable non polymorphic models to fetch related models. fixes: jazzband#198 jazzband#436 jazzband#359 jazzband#244 possible fixes: jazzband#498: support for prefetch_related cannot fetch attributes not on all child models or via class names related: jazzband#531
andriilahuta
pushed a commit
to andriilahuta/django-polymorphic
that referenced
this issue
Dec 19, 2023
implement support for a single query for select related base fetches across polymorphic models. adds a polymorphic QuerySet Mixin to enable non polymorphic models to fetch related models. fixes: jazzband#198 jazzband#436 jazzband#359 jazzband#244 possible fixes: jazzband#498: support for prefetch_related cannot fetch attributes not on all child models or via class names related: jazzband#531
pgammans
added a commit
to bva-icx/django-polymorphic
that referenced
this issue
Apr 4, 2024
implement support for a single query for select related base fetches across polymorphic models. adds a polymorphic QuerySet Mixin to enable non polymorphic models to fetch related models. fixes: jazzband#198 jazzband#436 jazzband#359 jazzband#244 possible fixes: jazzband#498: support for prefetch_related cannot fetch attributes not on all child models or via class names related: jazzband#531
pgammans
added a commit
to bva-icx/django-polymorphic
that referenced
this issue
Apr 4, 2024
implement support for a single query for select related base fetches across polymorphic models. adds a polymorphic QuerySet Mixin to enable non polymorphic models to fetch related models. fixes: jazzband#198 jazzband#436 jazzband#359 jazzband#244 possible fixes: jazzband#498: support for prefetch_related cannot fetch attributes not on all child models or via class names related: jazzband#531
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I've read this issue extensively and tried some things out which don't work -- #198
So I'm trying to see if I can come to a middle ground where maybe I don't get the free
select_related
query but can add aprefetch_related
and avoid n+1s. I have some models defined like thisI'm writing a django testcase for a view that serializes all instances of subclassed messages for a particular user and this part of the test fails when adding more instances
I was trying to mess around and see if I could run some type of prefetch? Something like:
so that the query can execute the same amount of queries whether it's 20 messages or 1000 messages.
Any help is appreciated including explanations of the internals. I've been trying to do things like call
select_related('smsmessage')
andselect_related('message_ptr__smsmessage')
and the like and my mind is mush right nowThe text was updated successfully, but these errors were encountered: