|
|
|
|
|
by tzone
911 days ago
|
|
I have been advocating for the longest time that "repeatable read" is just a bad idea. Even if implementations were perfect. Even when it works correctly in the Database, it is still very tricky to reason about when dealing with complex queries. I think two isolation levels that make sense are either: * read committed * serializable You either go all the way to have a serializable setup, where there are no surprises. OR, you go in read committed direction where it is obvious that if you want have a consistent view of the data within a transaction, you have to lock the rows before you start reading them. Read committed is very similar to just regular multi-threaded code and its memory management, so most engineers can get a decent intuitive sense for it. Serializable is so strict that it is pretty hard to make very unexpected mistakes. Anything in-between is a no man's land. And anything less consistent than Read Committed is no longer really a database. |
|
So I really only see serializable to be the only sane isolation model (for r/w transactions), and snapshot isolation is a good model for readonly transactions (basically you get a frozen in time snapshot of the database to work with). This also happens to be the only modes in which Spanner gives you: https://cloud.google.com/spanner/docs/transactions