for update in mysql

 

The syntax of the Select...For Update statement is the same as that of the select statement, except that the FOR UPDATE [NOWAIT] clause is added after the select statement.

This statement is used to lock specific rows (if there is a where clause, those rows that satisfy the where condition). When these rows are locked, other sessions can select these rows, but cannot change or delete these rows until the statement's transaction is ended by a commit statement or a rollback statement.

 

 

 Mainly under high concurrency, multiple visitors operate the database at the same time, resulting in negative data (such as ticket sales), so it is necessary to lock the database 

 

Extended reading, you can search php high concurrency, mysql row lock table lock, php message queue

 

https://blog.csdn.net/nuli888/article/details/51865401

 

Guess you like

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