-
-
Notifications
You must be signed in to change notification settings - Fork 958
feat(doctrine): optimize EagerLoadingExtension to skip unnecessary joins #7039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added optimization
soyuka
commented
Mar 21, 2025
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?
bizley
commented
Mar 22, 2025
Ok, looks like I made it green. Now to make tests proving it generates fewer joins. Should I proceed? Any tips?
soyuka
commented
Mar 25, 2025
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!
bizley
commented
Apr 2, 2025
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.
soyuka
commented
Apr 2, 2025
first guess: FilterEagerLoadingExtension
did you analyse the queries? do you need many joins?
bizley
commented
Apr 3, 2025
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.
soyuka
commented
Apr 3, 2025
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.
soyuka
commented
Apr 10, 2025
status? should we merge this?
bizley
commented
Apr 10, 2025
Give me few more days till the end of week ;)
This is a quick check if anything breaks after this optimization. Tests TBD