prisma-engines
7efa9cb6 - qe: reuse lateral joins for relation aggregations (#4693)

Commit
2 years ago
qe: reuse lateral joins for relation aggregations (#4693) The initial implementation always adds LEFT JOINs for relation aggregations. This is not necessary if there is an existing JOIN for fetching the relation data with the same filters (which includes no filters in both cases). This PR optimizes the query by reusing the existing lateral joins that load relation data and aggregating the relation in the same subquery when possible. Ref: https://github.com/prisma/team-orm/issues/700 Closes: https://github.com/prisma/team-orm/issues/903
Author
Parents
Loading