Select none in `update()`
## Problem Currently an `update` is quite slow because it does 3 steps: 1. Select my thing 2. Update my thing 3. Select my thing I do understand the need for the first select to make sure it updates only one record, but the last one if a bit annoying. ## Suggested solution It was suggested elsewhere that it could be using a `RETURNING`/other similar clause to remove the last one. This would be nice, but my understanding is that it is an important change. I suggest as a first step to allow users to tell prisma to not return anything. This would need a new keyword in `select`, I suggest `none`: ```typescript prisma.myThing.update({ data: { ... }, where: { id: 1 }, select: { none: true } }) ``` ## Alternatives You can use an `updateMany` to avoid the second `select`.
Posted by Sytten on Mar 25, 2021, 7:42 PM
Tags
Related issues
- struct's lifetime requirements can be bypassed via covariant field assignment
- Proposal to Reorganize the Moderation Team and Review Moderation Policies
- Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
- proposal: container/...: generic collection types
- Better Custom Endpoint BYOK
- A concrete policy for backward compatibility until Godot 5.0
Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments
github (Other)
struct's lifetime requirements can be bypassed via covariant field assignment
Proposal to Reorganize the Moderation Team and Review Moderation Policies
Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
proposal: container/...: generic collection types
Better Custom Endpoint BYOK
A concrete policy for backward compatibility until Godot 5.0
New MTP models not supported
Tracking: 429 / Capacity Issues
Select none in `update()`
## Problem Currently an `update` is quite slow because it does 3 steps: 1. Select my thing 2. Update my thing 3. Select my thing I do understand the need for the first select to make sure it updates only one record, but the last one if a bit annoying. ## Suggested solution It was suggested elsewhere that it could be using a `RETURNING`/other similar clause to remove the last one. This would be nice, but my understanding is that it is an important change. I suggest as a first step to allow users to tell prisma to not return anything. This would need a new keyword in `select`, I suggest `none`: ```typescript prisma.myThing.update({ data: { ... }, where: { id: 1 }, select: { none: true } }) ``` ## Alternatives You can use an `updateMany` to avoid the second `select`.
Comments (0)
No comments yet. Start the discussion.