Mysql for update

Environment: mysql 5.7
transaction isolation level repeatable read

The current record of

table is as follows:
clipboard.png

:
clipboard.png

: id = 2
clipboard.png

:
clipboard.png

SQL
clipboard.png


clipboard.png


clipboard.png


clipboard.png

my question is: why does my session need to be submitted again in order to view the updated data of session II?

No for update. Is to simply open two transactions. Session 2 updates the data and commits the transaction. Session 1 commits the transaction and looks at the data. It is

that you can see the data updated by session 2.
Mar.10,2021

whether changes can be seen during a transaction session is related to the isolation level of the transaction.

see the official documentation:
https://dev.mysql.com/doc/ref.

by default, REPEATABLE READ, is readable repeatedly, that is, multiple reads during a transaction return the same result.

BTW:
the four isolation levels defined by mysql do not have repetable commit this.

there is only

on the official website.

level:

   REPEATABLE READ
   READ COMMITTED
   READ UNCOMMITTED
   SERIALIZABLE

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e40fa2-42eaa.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e40fa2-42eaa.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?