Introduction
Sometimes you need to update data in a way that makes sure no one else changes it at the same time. Transactions help you do this by making sure your changes happen all at once or not at all.
When you want to increase a counter safely without losing updates from others.
When you need to read a value, change it, and save it back without conflicts.
When multiple users might try to update the same data at the same time.
When you want to keep data consistent, like updating a balance after a purchase.
When you want to retry your update automatically if someone else changed the data first.