Diagnosing short row-lock convoys under bursty writes
Throughput can collapse at twenty percent CPU when hundreds of worker threads queue behind a single hot summary row. Average query latency stays low until the lock wait queue crosses a tipping point.
Move network calls and file uploads strictly outside database transactions. Holding a row lock across a slow external RPC turns transient latency into database-wide contention.
Split hot counters across small shard buckets and sum them on read, or flush deltas asynchronously in short batches.
Log lock wait duration separately from execution duration so query profiles distinguish slow plans from blocked transactions.