Changes between Version 1 and Version 2 of Ticket #35587, comment 1
- Timestamp:
- Jul 9, 2024, 7:05:14 PM (5 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #35587, comment 1
v1 v2 1 1 I don't think it's worth extending the `Queryset` API with a method that can be emulated through various means (with different semantics) and would entertain the idea that the returned set of objects will always be mutually exclusive. This is not a guarantee that the ORM can provide for a few reasons. 2 2 3 First the querysets are going to reach to the database serially and thus they won't be executed against the same ''snapshot'' so an object could be changed in a way that makes it appear in both partitions. Secondly, while the ORM goes at great length to make `exclude` the complement of `filter` [https://code.djangoproject.com/query?description=~exclude&status=assigned&status=new&order=id&desc=1 it has a few know bugs] which could also manifest themselves in these scenarios.3 First the querysets are going to reach to the database serially and thus they won't be executed against the same ''snapshot'' so an object could be changed between queries execution a way that makes it appear in both partitions. Secondly, while the ORM goes at great length to make `exclude` the complement of `filter` [https://code.djangoproject.com/query?description=~exclude&status=assigned&status=new&order=id&desc=1 it has a few know bugs] which could also manifest themselves in these scenarios. 4 4 5 5 You are likely better off with a single query that uses an annotation as the Python-level predicate for partitioning