How MySQL Transactions query works?
Let us take an example of a simple query
update candidate set name=“abhinav” where id=3;
Now following the ACID properties of a transaction, either this update will work or fail.
What MYSQL does on the arrival of this query-
- LOCK that row as soon as the transaction begins.
- MYSQL will create a copy for that row.
- update will work on the copied data, not on the original one.
Till this time no change has been made to the actual database. And now hitting the last nail in the coffin.
4. Committing the changes to the actual table
This is how transaction works in update