MySQL Forums
Forum List  »  General

Re: Is it best practice to lock table for every Mysql query?
Posted by: nate liv
Date: January 04, 2019 06:09AM

MySQL uses pretty much the same table-locking method for both READ and WRITE locks:

If there are no locks on the table, put a read/write lock on it.
Otherwise, put the lock request in the read/write lock queue.
When a lock is released, the lock is first made available to other processes in the write lock queue, then to the threads in the read lock queue. So if you have many updates for a table, SELECT statements will wait until there are no more updates.

Options: ReplyQuote

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.