Bypass accelerate for certain queries to avoid 5MB limit
We have a reporting page that runs 20 or so queries from the db.
We want to use accelerate, but 1-2 of the queries exceed 5MB (Not really a way around it).
Is there a way, just for these queries, to tell it to just hit the database directly?
I suppose I could spin up a separate prisma client and use datasourceUrl to override it. I don't know if that's an optimal solution, if there are issues with that I'm not considering, or if maybe there's something more elegant.
5 Replies
Update for anyone else who finds this. Appears using two clients is indeed the solution:
https://www.prisma.io/docs/accelerate/troubleshoot#considerations-for-p6009-and-p6004-errors
Troubleshooting: Prisma Accelerate | Prisma Documentation
Troubleshooting Prisma Accelerate.
Hey @mikewilliams 👋
Thank you for sharing the solution here 🙂
I have responded to your email.
Thanks for this
@Nurul (Prisma) I actually have a follow up to this. It seems you all recommend using prisma generate --no-engine for accelerate clients.
If I'm generating the client, but then creating two clients (one for direct access) as seen above, would I not want to do this?
It's after Nurul's day so I'll step in 🙂
That's correct.
--no-engine
should only be used if your app/project has no need for Prisma query engine(s).