Distributed Transactions | Database Interview | Skill-Lync Resources
Hard Database Systems Distributed Databases

How do distributed transactions work (2PC, Saga pattern)?

Answer

Two-Phase Commit (2PC): coordinator sends prepare to all participants; if all vote yes, sends commit, else abort. Guarantees atomicity but blocking and slow. Saga pattern: sequence of local transactions with compensating transactions for rollback. Choreography (events) or orchestration (central coordinator). Eventual consistency, no distributed locks. 2PC for strong consistency (traditional databases), Saga for microservices and long-running transactions. Consider Paxos/Raft for consensus.

Master These Concepts with IIT Certification
IIT Certified

Master These Concepts with IIT Certification

175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.

Relevant for Roles

Senior Software Engineer Systems Architect Database Architect