select vs query? (Drizzle)

I am building my first production application with Drizzle and I am loving it. But one thing that is not clear to is when to use query vs select. Are there performance implications and I want to know the differences in behavior.
5 Replies
Neto
Neto8mo ago
query is a nicer way to do queries
Matvey
Matvey8mo ago
is you select the exactly the same thing the performace is the same
Neto
Neto8mo ago
akin to prisma queries
const users = await prisma.user.findMany({
relationLoadStrategy: 'join', // or 'query'
include: {
posts: true,
},
})
const users = await prisma.user.findMany({
relationLoadStrategy: 'join', // or 'query'
include: {
posts: true,
},
})
Matvey
Matvey8mo ago
with select you can do queries that aren't possible with query
Neto
Neto8mo ago
query is the general usage of querying the db with select with get a more granular and hand-written sql, but you need to "change the shape" of data later
Want results from more Discord servers?
Add your server