Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

In MySQL, will it be executed again when update modifies data at the same time as the original data?

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report