Changes between Initial Version and Version 1 of Ticket #34639, comment 5
- Timestamp:
- Jun 7, 2023, 3:25:22 PM (19 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #34639, comment 5
initial v1 1 1 It looks like this relates to #32682 (187118203197801c6cb72dc8b06b714b23b6dd3d). 2 2 3 The fact `self.root_queryset` is used without ''stripping'' unused annotations (e.g. the `Count` one) explains why the reporter is able to work around the issue by only annotating after the `Exists` filter is added.3 The fact `self.root_queryset` is used without ''stripping'' unused annotations (e.g. the `Count` one) explains why the reporter is able to work around the issue by annotating their `Count` after the `Exists` filter is added which ensures it's not part of the subquery (which MySQL is bad at optimizing sometimes). 4 4 5 5 Adjusting `SQLQuery.exists` to ''strip'' used annotation (like we did with `SQLQuery.get_aggreation` in #28477 (59bea9efd2768102fc9d3aedda469502c218e9b7)) could be a possible way to generically optimize this problem away.