core
core copied to clipboard
feat(doctrine): optimize EagerLoadingExtension to skip unnecessary joins
| Q | A |
|---|---|
| Branch? | main for features / current stable version branch for bug fixes |
| Tickets | Closes #7036 (WIP) |
| License | MIT |
| Doc PR | api-platform/docs#... (not yet) |
This is a quick check if anything breaks after this optimization. Tests TBD
interetsing, there's only one failure at features/doctrine/eager_loading.feature:64 I guess it's because of the property filter (it adds attributes to the serializer groups), maybe that the code needs a small adjustment?
Ok, looks like I made it green. Now to make tests proving it generates fewer joins. Should I proceed? Any tips?
really nice, the easiest is to add a feature inside:
https://github.com/api-platform/core/blob/main/features/doctrine/eager_loading.feature
Fixtures are located at https://github.com/api-platform/core/tree/main/tests/Fixtures/TestBundle/Entity
Thanks!
Just for an update on this - we encountered heavy db problems in our app for some custom filters execution so I'm checking if this is just a problem on our side or this change would do that for everyone, which of course we really don't want to happen.
first guess: FilterEagerLoadingExtension
did you analyse the queries? do you need many joins?
Probably, yes, this one. We have changed prio of EagerLoadingExtension to -19 and FilterEagerLoadingExtension to -18. Generated query had two nested SELECTs so terrible in general. Analyzing.
yes its also why we recommend to define your own queries as we're quite limited in how to we can generate automatic queries, you can also use the LinksHandler for these kind of use cases.
status? should we merge this?
Give me few more days till the end of week ;)