3 ms·
I know, in general, about various kinds of serialization anomalies, and I know (in moderate detail) how all of the isolation modes are implemented in postgres.
by jeffdavis 12y ago
I know, in general, about various kinds of serialization anomalies, and I know (in moderate detail) how all of the isolation modes are implemented in postgres.
What I don't know is about the particular problem the exchange encountered, and why postgres's isolation would not have prevented it. Based on the very brief descriptions of the problem that I've seen, it seems like postgres would have prevented it, but I don't have enough information to say for sure.
- jasonwatkinspdx 12y agoI don't know first hand, but could take a guess: Think of a transaction that inserts a row representing a withdrawal, updates a materialized total balance, and checks that it's positive. Under snapshot isolation, two concurrent instances of this transaction could commit. The materialized balance would reflect only one of the debits however, and would be inconsistent vs queries that recompute the aggregate in full. Postgres pre version 9.2-ish would allow this situation even in "serializable" mode. Later versions wouldn't.
- jeffdavis 12y agoDid you actually try in postgres? If so, please provide an example.
- jasonwatkinspdx 12y agoRead the papers.