
puang
4.2K posts

puang
@notpuang
20 | building @devdoq | cs undergrad | https://t.co/P4QtyvJzuz | https://t.co/Hkji9gY2ll


the most dangerous line of code in fintech: UPDATE users SET balance = balance - 100 WHERE id = $1 two users withdraw simultaneously. both read $120. both pass validation. both execute. you just paid out $200 from a $120 account. "just wrap it in a transaction" doesn't fix it, that gives you atomicity, not isolation. the reads already happened. the real fix is SELECT FOR UPDATE. but now you have deadlocks. so you add ordering. then idempotency. then retry logic. your "simple balance update" is 200 lines of raw SQL that every fintech team writes independently and most get slightly wrong. building something about this. more soon.

















