The limitations of your concurrency primitives are Amhdahl's law. We call them "concurrency primitives" but they're really about shared state. They are the sequential parts of the operation.
The commit phase of optimistic locking is cheap except when it's a do-over, and by necessity it causes the second action to use the resource twice, the second time sequentially to the first action.
Re:Parallelism in PostgreSQL
by londons_explore on Sunday August 11, 2019 @04:08AM
(#20666998)
Are you sure about this? I'm not aware of any parts of postgres which use optimistic locking?
> Andy Pavlo wrote a paper looking at this comparing different concurrency control strategies under very high levels of concurrency.
I think you mean his paper "This is the Best Paper Ever on In-Memory Multi-Version Concurrency Control" which is available here: http://www.cs.cmu.edu/~pavlo/papers/p781-wu.pdf
By the way, his courses are really excellent. I highly recommend subscribing to the CMU Database Group channel on YouTube.
A particularly nasty behavior occurs when you get into a situation where given a set of concurrent transactions, all of them must be aborted. While 2PL is not very popular these days, it does have the advantage that you can often entirely eliminate deadlock via carefully written queries. Then you just have to deal with Amdahl’s law and you won’t run into quite as catastrophic performance given high concurrency.
Andy Pavlo wrote a paper looking at this comparing different concurrency control strategies under very high levels of concurrency.