[{"data":1,"prerenderedAt":28},["ShallowReactive",2],{"tag-list-en-postgresql":3},[4,16],{"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",{"title":17,"description":18,"tags":19,"path":25,"date":26,"img":27},"Setting Up a PostgreSQL HA Cluster with Patroni and etcd","How to build a PostgreSQL high-availability cluster with automatic failover using Patroni, etcd, HAProxy and Keepalived. Learn the architecture, prerequisites, and step-by-step deployment so any node failure is handled with zero app changes.",[11,20,21,22,23,24],"High-Availability","Patroni","etcd","HAProxy","Keepalived","\u002Fdatabases\u002Fpostgres\u002Fsetup-postgres-ha-cluster","2026-06-25",null,1784742136924]