Hey everyone. Nice to meet y'all. I have a questio...
# orm-help
k
Hey everyone. Nice to meet y'all. I have a question regarding Prisma's $transaction API. I'm currently using it to run two queries sequentially but how many more queries can i add before it becomes a problem. I'm quite new to Prisma 🙂
✅ 1
j
Hi Kenny Could you give an sample code that cause the problem?
k
There's no problem yet, I'm just thinking ahead. Currently I have two sequential queries like so -
Copy code
const [queryOne, queryTwo] = await prisma.$transaction([...])

//what would happen if -

const [queryOne, queryTwo, ... , queryN] = await prisma.$transaction([...])
j
As I test on my Production with multiple queries it works fine
k
How many queries are you using?
j
It depends on user sending ids
It's around 50 ~ 100 queries
If you concern about timeout issue or idle time I suggest you to use interactive transaction API instead https://www.prisma.io/docs/concepts/components/prisma-client/transactions#interactive-transactions-in-preview
you can custom isolation level, idle connection time, and timeout with mili second number specifically
k
Okay great thanks
j
Copy code
await prisma.$transaction(async (tx)=>{
    // calling your queries here with tx
}, { isolationLevel: 'ReadUncommitted', maxWait: 10000, timeout: 30000 })
Please use transaction with caution as Prisma team mentioned