MySql--transactions

Features:

-- atomic consistency

The first step is to open the terminal 1 , the second step is to open the terminal 1, and the second
step is to open the transaction begin. The terminal 1 update table
   name set field="xxx" where ...; From table name;      found that the data has not actually changed. In fact, the relevant operation information of the data is stored in the cache at this time.    After the commit, these operations will be completed at one time. Step 4 : Terminal 1 commit The number of data data really changes    Terminal 2 select * from table name, data has changed -- isolation First step open terminal 1 terminal 2 second step terminal 1 open things begin    terminal 1 update table name set field="xxx" where ...; third step terminal 2 update Table name set field = "yyy" where ...;    found in blocked state  Step 4 Terminal 1 commit    Terminal 2 Blocked state release data Modified to yyy -- rollback (rollback) The first step is to open the terminal 1 begin The second step is the terminal 1 update table name set field="xxx" where ...; the third step rollback data returns the original original value -- persistence















   






Once a transaction is committed, its changes will be permanently saved to the database  . Note that  innodb can use things. When using  python to operate the database, things are turned on by default, but when python adds, deletes or changes the database, you need to manually commit to use the terminal to operate the database (that is, mysql). client), it also starts things by default, but when you press Enter to confirm the operation, the terminal will commit by default, so we don't need to commit things. The main problem to be solved is that some things need to be completed at one time, and no interruption is allowed in the middle, such as bank fetching. Money things can solve this problem












Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326011136&siteId=291194637