Re: innodb deadlock on UPDATE
> I want to keep things simple.
"Simple" instead of "correct"? For example:
BEGIN;
$ct = SELECT `count` FROM table WHERE ...; -- Without FOR UPDATE
...
UPDATE table SET `count` = $ct+1;
COMMIT;
During the "..." a different transaction could increment `count`, thereby messing up the UPDATE.
Sure, doing "SET count = count + 1" might be a solution. But not if the `count` from the SELECT is used to decide whether or not to do the UPDATE.
> thousands witin each transaction
This may not be wise. Can it be broken into smaller "transactions" and still provide the desired integrity?
Subject
Views
Written By
Posted
2052
July 06, 2015 09:37AM
929
July 08, 2015 07:24PM
1335
July 08, 2015 09:52PM
1010
July 09, 2015 11:52PM
946
July 15, 2015 12:00PM
Re: innodb deadlock on UPDATE
879
July 17, 2015 03:43PM
844
July 17, 2015 04:42PM
841
July 24, 2015 03:00PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.