Hey guys. I’m working on a project where I’m rewri...
# orm-help
i
Hey guys. I’m working on a project where I’m rewriting an existing website that has 7M monthly views (10m p/ day). I’m used to work with hasura, but this project needs a very custom backend, and each user visit needs to go to the database. So I need to think a bit about performance. When you query hasura through GraphQL, it normally compiles the entire query into a single SQL query to the database, and that’s how it gets good performance. There is a lot of info on how prisma is slow on the internet, but I know a lot of them are from prisma 1. How different is prisma 2 performance wise? How does it compare with Hasura now? Knowing that I’ll have to write the entire graphql server myself, it means that simply writing resolver for each entity will end up in a lot of queries to the database for just a single graphql query with nested resource, right?
n
Hey Igor 👋 great that you're considering to use Prisma for this project 🙂
How different is prisma 2 performance wise? How does it compare with Hasura now?
We don't have any concrete benchmarks unfortunately, but I would assume that Prisma 2 is quite a bit faster than Prisma 1 just by virtue of the new architecture and not needing to run an extra server 🙂
Knowing that I’ll have to write the entire graphql server myself, it means that simply writing resolver for each entity will end up in a lot of queries to the database for just a single graphql query with nested resource, right?
In GraphQL, this problem is typically solved using the DataLoader pattern which enables you to batch DB queries. Prisma Client has an integrated DataLoder already, so you don't need to implement that manually as you'd have to with other ORMs or when writing plain SQL yourself 🙂 We have an entire docs page about this topics as well: https://www.prisma.io/docs/guides/performance-and-optimization/query-optimization-performance Finally, we haven't been seeing many people complain about actual performance issues with Prisma yet. And if that happened, we worked very deliberately with them to resolve the problem in the particular scenarios. So, if you ever run into issues with performance, please let us know by opening a GitHub issue so we can improve the situation. Hope that helps 🙌
i
Hey nikolasburk Thanks for the answer. I don’t have a decision yet (We’re still interviewing all employees and gathering requirements of the company since we’re going to rewrite their entire system and website), but I’m very inclined to go through with Prisma.
👍 1
n
Great, feel free to let us know if have any further questions. Always happy to help 🙂