You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.
It's almost like a sort of django/postgres mismatch rather than an SSM issue per se -- however SSM allows you to very easily end up with this situation with no obvious way out.
Possible solutions could be:
warn when multiple CountOfs are combined
error when multiple CountOfs are combined
implement countof by fetching a values_list of related IDs and calling len() on that list if there's more than one
What about using the subquery approach in the answer to that SO question? That should work on any currently-supported version of Django.
I think the problem with trying to figure out a generic way to do this is that it's going to depend on the size of your N. If you have a small number of things in your main queryset you might even be quicker doing
Subquery like that is reasonably simple to implement, however gets harder if you needed to count a nested relation, especially if you need the DISTINCT count
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I think this is our basic underlying problem https://stackoverflow.com/questions/29195299/why-is-this-django-1-6-annotate-count-so-slow
It's almost like a sort of django/postgres mismatch rather than an SSM issue per se -- however SSM allows you to very easily end up with this situation with no obvious way out.
Possible solutions could be:
CountOf
s are combinedCountOf
s are combinedlen()
on that list if there's more than one(Something like a generic version of this:
)
The text was updated successfully, but these errors were encountered: