rawQuery compilation
After switching from mssql to Prisma ORM, I noticed that the rawQuery calls are much slower than they were on mssql. Do they get precompiled and cached and if not, is there any way to? I have a pretty big query that takes about 520ms to complete while it used to be about 20ms.
I also cannot use TypedSQL as I'm using SQL Server as database.
Solution:Jump to solution
Hey @PlanetTeamSpeak 👋
There is some overhead involved even while using Raw Queries with Prisma as raw queries still need to be processed via the query engines, so at the moment it won't be as fast as a native mssql driver. We are working on a new prototype which should make queries alot faster. I don't have a timeline yet which I can share with you....
7 Replies
i dont think orm is the issue here
Rawquery in prisma means its raw like your mssql
maybe try drizzle?
With mssql I used prepared statements which did speed it up quite a bit. Figured that's because of some kind of compilation which Prisma may not be doing or doing every time it's executed.
Can that be used along with Prisma is is that it's own thing?
both have diffrent type of schemas
idk
Also doesn't seem to have MS SQL support actually, so that's not an option for me.
Solution
Hey @PlanetTeamSpeak 👋
There is some overhead involved even while using Raw Queries with Prisma as raw queries still need to be processed via the query engines, so at the moment it won't be as fast as a native mssql driver. We are working on a new prototype which should make queries alot faster. I don't have a timeline yet which I can share with you.
Will that new prototype be able to be used with TypedSQL too?
Or does TypedSQL already work differently?
Yes! The prototype is still being developed, but I am pretty sure it will be compatible with TypedSQL