You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And here are the queries we could generate instead:
-- afterBEGIN;
-- update AUPDATE"A"SET"name"= $1WHERE ("A"."id"= $2) RETURNING "A"."id";
-- update B using results from A's updateUPDATE"B"SET"name"= $1WHERE ("B"."id"= $2AND"B"."aId"IN ($N)) RETURNING "B"."id", "B"."cId";
-- update C using results from B's updateUPDATE"C"SET"name"= $1WHERE ("C"."id"= $2) RETURNING "C"."id";
-- read updated ASELECT"t1"."id"FROM"A"AS"t1"WHERE"t1"."id"= $1LIMIT $2;
COMMIT;
Saving 1 read per traversed relation.
This is now possible thanks to the support of UPDATE ... RETURNING for arbitrary field selection. In many cases, there's an opportunity to save an intermediary read when the parent update is able to return the linking fields for the subsequent update.
I believe this could be all done as a post-processing pass on the graph, by removing intermediary read nodes if a parent update node already fulfills the selection set of all children of these intermediary read nodes.
Before
Parent update -> read children -> children update
After
Parent update -> children update
The text was updated successfully, but these errors were encountered:
Hi there,
As part of our effort to clean up our GitHub repo, we’re closing this issue to help focus on features and improvements that align with our focus areas and those of our community.
This issue was originally created for internal tracking purposes, but if you feel this is important to you, feel free to reopen the issue and get like-minded users to upvote as we will prioritize fixing issues based on community interest.
Overview
Consider the following Prisma Schema
And the following query:
Here are the queries we currently generate:
And here are the queries we could generate instead:
Saving 1 read per traversed relation.
This is now possible thanks to the support of
UPDATE ... RETURNING
for arbitrary field selection. In many cases, there's an opportunity to save an intermediary read when the parent update is able to return the linking fields for the subsequent update.I believe this could be all done as a post-processing pass on the graph, by removing intermediary read nodes if a parent update node already fulfills the selection set of all children of these intermediary read nodes.
Before
After
The text was updated successfully, but these errors were encountered: