0
start transaction;
update a set b=1 where a=1;
update b set c=1 where a=1;
commit;

The binary log will record a, b update in order, but when would the b's update flush to log before than a?

how to recurrent?

Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85

1 Answers1

0

If you are using a transactional engine such as InnoDB, then it is guaranteed that either both updates are applied, or neither.

If you are using an engine such as MyISAM then the transaction may be left in a state of partial completion, however, even with the binary log they will be done in the same order as they were made in the initial connection.

There is no situation where B would be updated before A when made from the same connection(/transaction). If you did these queries in parallel from 2 different connections then they could occur in either order.

Trent Lloyd
  • 1,832
  • 1
  • 15
  • 13