yangqi
2016-07-13 22:13:29 +08:00
"WRITE locks normally have higher priority than READ locks to ensure that updates are processed as soon as possible. This means that if one session obtains a READ lock and then another session requests a WRITE lock, subsequent READ lock requests wait until the session that requested the WRITE lock has obtained the lock and released it.
LOCK TABLES acquires locks as follows:
1.Sort all tables to be locked in an internally defined order. From the user standpoint, this order is undefined.
2.If a table is to be locked with a read and a write lock, put the write lock request before the read lock request.
3.Lock one table at a time until the session gets all locks."