prisma / docs

📚 Prisma Documentation
https://www.prisma.io/docs
Apache License 2.0
980 stars 771 forks source link

Explain what the isolation levels actually means #5121

Open janpio opened 1 year ago

janpio commented 1 year ago

https://www.prisma.io/docs/concepts/components/prisma-client/transactions#transaction-isolation-level

I was looking for a response to https://github.com/planetscale/discussion/discussions/508. I assume Prisma by default on PlanetScale uses an isolation level that does not prevent this problem, and that maybe by setting another one the user might be able to overcome that. But the docs did not really help with that as they just present the isolation levels, but do not fully explain what they mean and for which use cases they could be used.

ruheni commented 1 year ago

FYI: Planetscale/ MySQL's uses the REPEATABLE READ isolation level — you can run SELECT @@global.transaction_isolation; to retrieve it.

I also think we could call out explicitly the content about the database isolation level in the code snippet in a paragraph in our docs:

CleanShot 2023-08-02 at 12 17 13@2x

It would be helpful to call out what the isolation levels mean, but that is a tricky line to walk on because it's a database feature, not necessarily an ORM feature, which would be out of the scope for our docs. This content is documented and linked to in the DataGuide. If it helps, I think we could link out to the Dataguide for the different isolation levels 🤔