agrestio / agrest

Server-side Java REST Framework for easy access to data graphs from various backends
https://agrest.io
Apache License 2.0
81 stars 34 forks source link

Optimization: "relatedViaParentFault" strategy when only related "id" is requested #625

Open andrus opened 1 year ago

andrus commented 1 year ago

An optimization of Cayenne RelatedDataResolver:

If the child entity only includes "id" that can be expressed via the parent FK, use a new strategy - "relatedViaParentFault" that would avoid an extra query for a relationship

TODO:

Since this eliminates the relationship prefetch, this change would not resolve or refresh target objects. So if the custom access checking (or other custom) code is in use, this strategy is not a good one, as it will result either in a large number of per-object queries or in stale data.

cc: #442, #539, #623