[{"data":1,"prerenderedAt":16},["ShallowReactive",2],{"tag-list-en-transactions":3},[4],{"title":5,"description":6,"tags":7,"path":13,"date":14,"img":15},"How Two-Phase Locking Keeps Concurrent Bank Transactions From Corrupting Your Data","Two transfers hit the same account in the same millisecond and one payment vanishes. This is the lost update, and it is why every payment ledger runs on a concurrency control layer. This article builds the theory from a fintech example up to two-phase locking (2PL): the transaction model, the math of conflict-serializability and the precedence graph, why the 2PL theorem guarantees correctness, pessimistic versus optimistic control in PostgreSQL, strict 2PL, and how deadlocks are detected and prevented.",[8,9,10,11,12],"Databases","Concurrency","Transactions","PostgreSQL","Distributed-Systems","\u002Fdatabases\u002Ftwo-phase-locking","2026-07-22","https:\u002F\u002Fres.cloudinary.com\u002Fdpdwhd6ka\u002Fimage\u002Fupload\u002Ff_auto,q_auto\u002Fv1\u002FBlog\u002Fimages\u002Fhbcudyxllyjvbkjxvs7g",1784742136818]