Mysql InnoDB行锁实现方式
来源:互联网 发布:淘宝导航栏是多少尺寸 编辑:程序博客网 时间:2024/06/04 18:16
只有通过索引条件检索数据,InnoDB才使用行级锁,否则,InnoDB将使用表锁!
新建表并插入数据
create table test(id int,name varchar(10)) engine=innodb;insert into test values(1,'1'),(2,'2'),(3,'3'),(4,'4');
session_1
session_2
mysql> set autocommit=0;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from test where id = 1 ;
+------+------+
| id | name |
+------+------+
| 1 | 1 |
+------+------+
1 row in set (0.00 sec)
mysql> set autocommit=0;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from test where id = 2 ;
+------+------+
| id | name |
+------+------+
| 2 | 2 |
+------+------+
1 row in set (0.00 sec)
mysql> select * from tab_no_index where id = 1 for update;
+------+------+
| id | name |
+------+------+
| 1 | 1 |
+------+------+
1 row in set (0.00 sec)
mysql> select * from tab_no_index where id = 2 for update;
等待
创建一个id索引即可实现行及锁
0 1
- Mysql InnoDB行锁实现方式
- Mysql InnoDB行锁实现方式
- Mysql InnoDB行锁实现方式
- Mysql InnoDB行锁实现方式
- Mysql InnoDB行锁实现方式
- Mysql InnoDB行锁实现方式
- InnoDB行锁实现方式
- InnoDB行锁的实现方式
- mysql innoDB的REPEATABLE READ MVCC事务实现方式
- MySQL innodb行锁测试
- Mysql innodb行锁测试
- Mysql innodb行锁测试
- innodb 行锁实现算法
- innoDB的MVCC实现方式
- 【知识库】--Mysql InnoDB 行锁实现 和 表锁实现(205)
- MySQL innodb 事务的实现
- MySQL InnoDB MVCC实现原理
- MySQL InnoDB MVCC实现原理
- 关于编程、重构等 42条建议 中
- Material Design
- 金字塔原理学习笔记第1篇-表达的逻辑(一)
- Android 开发进阶指南
- 小波部分特征说明和小波特征比较---未写完
- Mysql InnoDB行锁实现方式
- Shader学习 之 ShaderLab语法:Properties
- [LeetCode]Jump Game
- Mysql隔离级别
- ROC曲线
- 引用CSS的三种方式
- 原生android中Settings模块添加步骤
- WCF:如何将net.tcp协议寄宿到IIS
- BZOJ 2096: pilots 单调队列