Intake

Clinic slots on Postgres. Fire concurrent bookings at the last seat and watch exactly one win.

Slots

Stampede

send simultaneous bookings at the selected slot

Both paths run against the same table. The unique index on (slot_id, seat_no) is the guarantee — the read-modify-write path computes its seat number from a stale count, so racers collide on it and the database refuses them. A CHECK constraint could not do this: a CHECK sees one row, not the count of its siblings.