In MySQL, will it be executed again when update modifies data at the same time as the original data?
The main content of this article is to explain "when the update modification data in MySQL will be executed again at the same time as the original data", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "in MySQL, when update modifies data and the original data at the same time, will it be executed again?"
I. background
The main test of this article is that when MySQL executes update statements, will update statements that are the same as the original data (that is, unmodified) be re-executed within MySQL?
Second, the test environment
MySQL5.7.25
Centos 7.4
3. Binlog_format is ROW
1. Parameters
2. Test steps
Session1
Session2
Session1
3. Summary
In binlog_format=row and binlog_row_image=FULL, because MySQL needs to record all the fields in binlog, all the data will be read out when reading the data, so the update of duplicate data will not be executed. That is, MySQL invokes the interface "modified to (1cm55)" provided by the InnoDB engine, but the engine finds that the value is the same as the original, does not update, and returns directly.
4. Binlog_format is STATEMENT
1. Parameters
2. Test steps
Session1
Session2
Session1
3. Summary
In binlog_format=statement and binlog_row_image=FULL, the update statement is carefully executed within InnoDB, that is, the operation "change this value to (1999)", the lock that should be locked, the update that should be updated.
At this point, I believe you have a deeper understanding of "will it be executed again when the update modified data is the same as the original data in MySQL?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!