Imagine I have a table with two columns that have a point register from two different teams, like the one below:
TABLE:
The table has the relation of the two teams and the points they get when they finish a level during a period of time.
The two teams can play a level when they want and update their points when they finish. So it is possible that they update their own column of points at the same time. Like, A team updates first_team_points and B team updates second_team_points.
I know that InnoDB has a row-level locking, so I suppose that in that case the two updates will be realized in a sequencial order.
Im I wrong? Do I need to configurate something? Will the second update request cause a deadlock?
Thanks in advance!
Please provide the code for critique. Meanwhile, in general...
BEGIN; -- start the transaction
SELECT ... FOR UPDATE; -- if you need to look at something before updating
...
INSERT/UPDATE/etc -- make whatever changes
COMMIT;
There are several issues: