3/2/2024 0 Comments Postgres multiple joins(And you should update the docs to say ALL is transactional). Then we can get back to griping about the performance aspects in issue (1) :). Again there is a race condition between the SELECTs and UPDATEs, and a result that's potentially different from what a single UPDATE would provide.īottom line: Prisma team, can you assure us that ALL operations, meaning all writes and all reads, are transactional? If it's true that all Prisma operations are wrapped in a transaction, there is no potential race condition between multiple INSERTs, UPDATEs and SELECTs generated by Prisma, and we don't have to worry about data integrity problems as a result of issue (2). If the query (pure read operation) isn't transactional and is broken down by Prisma into multiple SELECTs, then there is a race condition between the SELECTs and the returned data could be different (wrong) compared to the same query if it had been implemented as a single SQL statement (one SELECT with joins).ĭeveloper calls an update method that Prisma breaks down into one UPDATE and one or more SELECTs. Here are some example scenarios that would be a problem if not:ĭeveloper calls a findFirst method with an include clause. We need to know that absolutely all Prisma operations are transactional. That lists: nested writes bulk transactions and when the $transaction API is used directly. As I read the current Prisma docs, they guarantee transactional behavior for only some operations. The key question is, does Prisma wrap ALL operations in transactions? If the answer is yes, and we as developers configure our DBs with the right isolation level, then issue (2) is OK. Frankly if (2) is done wrong, we should all stop using Prisma immediately. If (2) is done wrong, we don't need to care about (1). (1) is a performance-only issue, important but doesn't affect data integrity directly - while (2) is an ACID correctness / data integrity issue that's deadly if it's done wrong. (1) efficiencies relating to using joins or not, and (2) data correctness relating to using joins or not. While it's irritating that Prisma doesn't use joins, there are two distinct issues that should be addressed separately. That's my opinion after all, and my understanding of the video.īeta Was this translation helpful? Give feedback. This is the vision, and in order to interconnect data from different resources, from the architectural perspective it's definitely easier to query layer by layer since you can't really join between a db and a service.Īlthough from the other side if you just have Prisma to query just a single db, it's shocking that there's no joining. You'll get a better glance if you see the schema. Around +-25 mins it's revealed, that there's a vision to interconnect if I'm not wrong, data from different dbs, even different kind of services (as they say stripe in the video). Either way, towards the end of the video it's explained how a Prisma query is translated. Watching this conference, you can get a glance at how Prisma has a main core and implements different connectors for each implementation. To be honest I've reached this issue on GitHub because I was looking at how Prisma is working under the hood and I got surprised. Is there an intentional philosophy in Prisma to not do many things the ”traditional SQL-way” or why this feature is so quickly dismissed as unnecessary? □ In the project that I’m starting, I went with Kysely instead of Prisma because of this and other similar limitations. I feel like these points haven’t been addressed properly. Please reconsider the arguments mentioned in the other thread why this would be good for performance and keeping the operations ACID:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |