feat(pagination): provide a way to manually disable distinct on count
Using DISTINCT in a COUNT has a major impact on performance. This change pushes the existing fix forward by delegating the responsibility to disable the DISTINCT presence to the developers.
For instance, it is possible to safely remove the DISTINCT from a query that joins a "to one" association.
The existing optimization still exists for most cases.
| Q | A |
|---|---|
| Branch? | main |
| Tickets | |
| License | MIT |
| Doc PR | to write (depending on the output of the discussion) |
TODO:
- [ ] write doc (api-platform/docs)
- [ ] Update CHANGELOG.md
- [ ] Discuss alternatives
I'm not a big fan of this solution, given the amount of properties that already exist on the Operation class (including its inheritance tree).
An alternative would be to change the current detection behavior (which is only based on the number of aliases in the query), to take into account the type of the associations ("to one" association are ok, DISTINCT should be discardable). I could use the QueryChecker::hasJoinedToManyAssociation for instance.
Any suggestions on how to proceed are very welcome, Thanks.
Hi @gquemener will you work this feature?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.