IssueRaiser

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

Raise real-world problems, find people facing the same issue, and discuss solutions.3,000 issues0 comments

github (Other)

Select none in `update()`

SyttenMar 25, 2021, 7:42 PM

## 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.

Comment on this issue