Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dfee22d

Browse files
mysql锁机制
1 parent 5177535 commit dfee22d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎My ISAM表锁/MYISAM 锁调度‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
1.思考?
3+
一个进程请求某个MyISAM表的读锁,同时另一个进程也请求同一表的写锁?Mysql如何处理呢?
4+
5+
6+
答案:写进程先获得锁,即使读请求先到锁等待队列,写请求后到,写请起后到,写锁也会插到读锁队列。
7+
Mysql认为写请求比读请求更重要。MyISAM不太适合于有大量更新操作和查询操作的原因,因为,
8+
大量的更新操作会造成查询操作很难获得读锁,从而可能永远阻塞。
9+
10+
11+
解决方法
12+
1.执行 set low_priority_updates =1;使该连接发出的更新请求优先级降低。
13+
其中insert,delete也可以通过此种方法指定

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /