Query Performance
Hello, I wonder if there's any way to disable the extra SELECT queries made during updates.
For example: This is the query I'm using to update a player.
I see the following queries in the debug log:
Why is it making all those extra SELECT queries rather than just updating? I'm worried it might impact performance as we scale.
3 Replies
Hello ๐
There isn't a direct way to disable the extra SELECT queries for the nested query entirely unless you use a Raw Query or TypedSQL.
For simple updates where you don't need the returned data, you could use updateMany even for single record updates, as it doesn't perform the extra SELECT.
We have a feature request for this use case here
I would recommend adding a ๐ to the request, so we can prioritise it
you mean I can do player.updateMany() to avoid the select?
oh I see, all good then
seems like updateMany doesn't work for relational fields right? am I missing something
Yes, relation fields aren't supported in updateMany.
https://github.com/prisma/prisma/issues/3143
GitHub
Add ability to update relation fields inside
updateMany()
ยท Issue...Problem Given this schema: model Booking { worker Worker } If we want to disconnect multiple bookings at once, we currently have to run a separate update call for each individual booking: await Pro...