Do not use DISTINCT where there are no joins#2611
Conversation
c31a649 to
db98be3
Compare
db98be3 to
1806c48
Compare
meyerbaptiste
left a comment
There was a problem hiding this comment.
Wonderful, I stopped counting the number of times I had to do this in projects! 🎉
|
Thanks @soyuka! 🎉 |
|
having tried this, i think it's hard to take advantage of this because of eager loading. to improve, left joins could be removed from the count query, i think? i think that's harder than it sounds though. |
|
@bendavies But eager loading only kicks in if you use those relations in your serializer groups, no? So, |
|
ah, it's because i have one property with |
|
yes, i meant writing the query for count, as left joins don't affect the final count. |
You'll have to propose that in Doctrine ORM. ;) |
|
Mhhh, I'm not sure that we have access to another query where we could set the hint?! |
|
@bendavies Same response as above: #2611 (comment)
|
Good luck. :D |
|
ah, that's not our query? oh well |
|
Hmm... But So, I think we could improve the logic here: core/src/Bridge/Doctrine/Orm/Extension/PaginationExtension.php Lines 278 to 296 in 049d5aa |
https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/tutorials/pagination.html I don't know how I've missed this important optimization... 🙈 |
|
Note to self: we probably have to take care of fetch |

@teohhanhui would this work?