Code Room
On-callMediumoc-g240
Subject Lock contentionLevel Mid–Senior~30 minCommon in Concurrency interviewsIndustries Technology, Software development

Question

Postgres. An order-processing service uses a per-merchant `SELECT ... FOR UPDATE` on a single `merchant_balances` row to serialize balance updates. After onboarding one very high-volume merchant, that merchant's order p99 hit 8 s and its workers spend most time waiting; other merchants are fine. `pg_stat_activity` shows many sessions on `Lock` / `transactionid` all targeting that one merchant's balance row. Throughput per worker is low. Triage and redesign so a single hot merchant doesn't serialize itself into the ground.

What a strong answer looks like

Stop the bleeding first (mitigate), then form hypotheses from real signals. Separate root cause from symptom, communicate status as you go, and close with what prevents a repeat.

Diagram & narrate the incident
Loading whiteboard…
Run or narrate your approach, then ask the coach.