Replies: 4 comments
-
|
await fastify.prisma.user_info.findMany({
distinct: ["role"],
select: {
role: true
},
orderBy: {
role: {
sort: "desc",
nulls: "last"
}
}
})or use await fastify.prisma.user_info.findMany({
distinct: ["role"],
take: req.query.limit,
skip: req.query.page * req.query.limit,
select: {
role: true
}
})I created the issue: #22734 It looks like we have to work around this problem by using subqueries: https://stackoverflow.com/questions/9795660/postgresql-distinct-on-with-different-order-by |
Beta Was this translation helpful? Give feedback.
-
|
Has this feature request been dropped? Druue unassigned herself and there hasn't been made any progress for almost a year. Native distincts are really a pitfall in certain situations as performance penalty for in memory usage can be a few thousand percent. |
Beta Was this translation helpful? Give feedback.
-
|
A quick update, we plan to release this preview feature to GA between September 2025 - February 2026. Read more here: #26136 |
Beta Was this translation helpful? Give feedback.
-
|
Been using this, and has decreased the load on our servers a lot! Can we create a optimisation for when |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Support for the database native
DISTINCTqueries with ourdistinctAPI is in preview behind thenativeDistinctpreview feature.Please share your feedback about
nativeDistinctreleased in v5.7.0 in this discussion.GA planned for September 2025 - February 2026
Beta Was this translation helpful? Give feedback.
All reactions