| ▲ | mrkeen 6 hours ago | |
> databases also solve this problem They could, but are typically configured not to. With default settings they let other processes' commits cut into the middle of your read. (See READ_COMMITTED.). I was flabbergasted when I read this. When you turn MSSQL up to a higher consistency level you can get it to grind to a halt and throw Deadlock exceptions on toy code. (Moving money between accounts will do it). I used to advertise STM as like ACID-databases for shared-memory systems, but I guess it's even more consistent than that. | ||
| ▲ | kragen 5 hours ago | parent [-] | |
Postgres's `set transaction isolation level serializable` doesn't result in deadlocks (unless you explicitly grab locks) but does require your application to retry transactions that fail due to a conflict. | ||