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 45681bd

Browse files
mysql锁机制
1 parent fb7428e commit 45681bd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎My ISAM表锁/共享读锁

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,12 @@ MyISAM表的读操作与写操作之间,以及写操作之间是串行的!
4444
2.当使用LOCK TABLES时,不仅需要一次锁定用到的所有表,而且,同一个表在SQL语句中出现多少次,就要通过与SQL语句中相同的别名锁定多少次,
4545
否则也会出错!
4646
lock table 表名 as 别名 read;
47-
47+
48+
****************************************************************************************************
49+
并发插入(Concurrent Inserts)
50+
上文提到过MyISAM表的读和写是串行的,但这是就总体而言的。在一定条件下,MyISAM表也支持查询和插入操作的并发进行。
51+
MyISAM存储引擎有一个系统变量concurrent_insert,专门用以控制其并发插入的行为,其值分别可以为0、1或2。
52+
1.当concurrent_insert设置为0时,不允许并发插入。
53+
2.当concurrent_insert设置为1时,如果MyISAM表中没有空洞(即表的中间没有被删除的行),MyISAM允许在一个进程读表的同时,
54+
另一个进程从表尾插入记录。这也是MySQL的默认设置。
55+
3.当concurrent_insert设置为2时,无论MyISAM表中有没有空洞,都允许在表尾并发插入记录。

0 commit comments

Comments
(0)

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