What's the overhead (if any) of using the new relational api?
I love the new relational api but I am wondering about the performance overhead
7 Replies
It still only sends one query to the database
But naturally there will be overhead in most cases compared to manually written queries as auto generated ones can't be as refined
My main concern is that it's looping over the data to create the correct structure, this could quickly become a bottleneck, there is a reason prisma uses a rust binary
What's more performant than native behaviour?
It may depend on DBMS you are using, but in case of Planetscale(and probably any other MySQL but have to be clarified) the query generated by Relational API is not able to leverage indexes. Therefore reads are more expensive and potentially slower, but you will notice difference only with REALLY big tables
I think I didn't phrase my question right, my question was if drizzle manipulates the data in any way before returning it
Overhead will not be noticeable until your queries return huge amounts of data
No, i would treat drizzle as sql builder
it just
1. builds only ONE query per function invocation (e.g select, insert)
2. maps stuff with ts types