Changes between Version 1 and Version 2 of Ticket #31535, comment 3
- Timestamp:
- May 4, 2020, 11:22:12 AM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #31535, comment 3
v1 v2 1 The ORM is able to optimize `.filter(unlocked_by__in=solved_challenges)` into an `INNER JOIN` but it cannot do the same for annotations because the could be doing some special handling of `NULL` and it would require some pretty sophisticated introspection to determine it's safe to do. It would also be backward incompatible at this point. You should rely on `Subquery` or even `Exists` in your reported case instead.1 The ORM is able to optimize `.filter(unlocked_by__in=solved_challenges)` into an `INNER JOIN` but it cannot do the same for annotations because they could be doing some special handling of `NULL` and it would require some pretty sophisticated introspection to determine it's safe to do. It would also be backward incompatible at this point. You should rely on `Subquery` or even `Exists` in your reported case instead.