Skip to content
RED SAGSkills
hard20 pts · first answer countstransactionspostgresqlconcurrency

Write skew under snapshot isolation

Rule: at least one doctor must stay on call. Two doctors press "go off call" at the same moment. Each transaction runs SELECT count(*) of on-call doctors, sees 2, and updates only its own row. Both commit at REPEATABLE READ in PostgreSQL, leaving zero on call. Which fix works?

Choose one answer