P
Prisma2mo ago
K1|ller

why update/delete need the 'select' statement to not be empty??

will throw an error:
const deletedUser = await prisma.user.delete({
where: { id: 1 },
select: {}
});
const deletedUser = await prisma.user.delete({
where: { id: 1 },
select: {}
});
Question 2: Does select: {} improve query performance?
3 Replies
Prisma AI Help
Prisma AI Help2mo ago
You selected to wait for the human sages. They'll share their wisdom soon. Grab some tea while you wait, or check out #ask-ai if you'd like a quick chat with the bot anyway!
RaphaelEtim
RaphaelEtim2mo ago
Hi @K1|ller At the moment, Prisma requires at least one field to be selected when performing update or delete operations. This is a known issue and we have an improvement request here. select: {} does not improve query performance. To improve query performance, you would use select to specify only the fields you need, which reduces the amount of data fetched from the database.
GitHub
Issues · prisma/prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB - Issues · prisma/prisma
K1|ller
K1|llerOP2mo ago
thanks man and yeah I noticed it needs at least one field. WIll select: {} be available? when doing an update it would be great to not return anything

Did you find this page helpful?