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:
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....
Jump to solution
7 Replies
LEGION
LEGION•2d ago
i dont think orm is the issue here Rawquery in prisma means its raw like your mssql maybe try drizzle?
PlanetTeamSpeak
PlanetTeamSpeakOP•2d ago
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?
LEGION
LEGION•2d ago
both have diffrent type of schemas idk
PlanetTeamSpeak
PlanetTeamSpeakOP•2d ago
Also doesn't seem to have MS SQL support actually, so that's not an option for me.
Solution
Nurul
Nurul•2d ago
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.
PlanetTeamSpeak
PlanetTeamSpeakOP•2d ago
Will that new prototype be able to be used with TypedSQL too? Or does TypedSQL already work differently?
Nurul
Nurul•2d ago
Yes! The prototype is still being developed, but I am pretty sure it will be compatible with TypedSQL
Want results from more Discord servers?
Add your server