by nedp on 8/1/22, 4:52 AM with 1 comments
by josephcsible on 8/1/22, 4:58 AM
> You can go far with this pattern until bursts of these types of events happen in parallel and you experience contention on a single row. When multiple transactions are trying to update the counter, you are essentially forcing these transactions to run serially, which is bad for concurrency and can cause deadlocks.
I can see how that would cause slowdowns, but not deadlocks, unless by "cause" it means "trigger one that was already present all along due to a bug in your code". Well-written code should work completely fine (other than being slow) with that pattern.