Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't think those need to be transactions they can be done with atomic operations

- Adding to a shopping basket is adding a row to a table which is atomic (same for deletions)

- topping up a online credit is "UPDATE credit_balance SET credit=new_value WHERE credit=expected_old_value AND user_id=this_user", which is atomic and then check the number of affected rows is 1.



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: