MySQL Shared and Exclusive Locks
InnoDB implements standard row-level locking where there are two types of locks, shared (S) locks and exclusive (X) locks.
A shared (
S) lock permits the transaction that holds the lock to read a row.An exclusive (
X) lock permits the transaction that holds the lock to update or delete a row.
If transaction T1 holds a shared (S) lock on row r, then requests from some distinct transaction T2 for a lock on row r are handled as follows:
A request by
T2for anSlock can be granted immediately. As a result, bothT1andT2hold anSlock onr.A request by
T2for anXlock cannot be granted immediately.
If a transaction T1 holds an exclusive (X) lock on row r, a request from some distinct transaction T2 for a lock of either type on r cannot be granted immediately. Instead, transaction T2 has to wait for transaction T1 to release its lock on row r.
shared lock
A kind of lock that allows other transactions to read the locked object, and to also acquire other shared locks on it, but not to write to it.
exclusive lock
A kind of lock that prevents any other transaction from locking the same row. Depending on the transaction isolation level, this kind of lock might block other transactions from writing to the same row, or might also block other transactions from reading the same row. The default InnoDB isolation level, REPEATABLE READ, enables higher concurrency by allowing transactions to read rows that have exclusive locks, a technique known as consistent read.
MySQL Shared and Exclusive Locks的更多相关文章
- Shared and Exclusive Locks 共享和排它锁
14.5 InnoDB Locking and Transaction Model InnoDB 锁和事务模型 14.5.1 InnoDB Locking 14.5.2 InnoDB Transact ...
- If one session has a shared or exclusive lock on record R in an index, another session cannot insert
If one session has a shared or exclusive lock on record R in an index, another session cannot insert ...
- mysql锁之Next-Key Locks
一个Next-key锁结合了行锁和gap锁. InnoDB执行一个行级别锁在这样的一个途径,那就是它搜索或者扫描一个表索引时,它设置共享或者独占锁在它遭遇的索引记录上.于是,行级锁是真实的行记录锁.一 ...
- 转 MYSQL InnoDB Record, Gap, and Next-Key Locks
http://dev.mysql.com/doc/refman/5.0/en/innodb-record-level-locks.html InnoDB has several types of re ...
- 小白学习mysql 之 innodb locks
Innodb 锁类型: Shared and Exclusive Locks Intention Locks Record Locks Gap Locks Next-Key Locks Insert ...
- Mysql讲解数据库并发控制知识
1.下载Mysql并安装,我喜欢不用安装的zip版,cd到bin目录下,先修改下mysql的密码. mysqladmin -u root -p password mysql ,第一次运行并修改mysq ...
- 14.3.3 Locks Set by Different SQL Statements in InnoDB 不同的SQL语句在InnoDB里的锁设置
14.3.3 Locks Set by Different SQL Statements in InnoDB 不同的SQL语句在InnoDB里的锁设置 locking read, 一个UPDATE,或 ...
- mysql锁机制详解
前言 大概几个月之前项目中用到事务,需要保证数据的强一致性,期间也用到了mysql的锁,但当时对mysql的锁机制只是管中窥豹,所以本文打算总结一下mysql的锁机制. 本文主要论述关于mysql锁机 ...
- 转 mysql Next-Key Locking
原文:http://dev.mysql.com/doc/refman/5.5/en/innodb-next-key-locking.html 14.5.2.5 Avoiding the Phantom ...
随机推荐
- 【Maven】Maven之scope依赖范围
一.理解Maven scope依赖范围的作用 Maven在编译项目主代码的时候需要使用一套classspath.总共有三种classpath,分别对应于Maven编译项目主代码的时候.Maven编译和 ...
- C++学习(6)—— 引用
1. 引用的基本使用 作用:给变量起别名 语法:数据类型 &别名 = 原名 #include<iostream> using namespace std; int main(){ ...
- 性能测试基础---LR运行设置
·LR的运行时设置(Runtime settings): ·Run Logic:该选项是用来控制脚本的真正的运行逻辑. ·该选项会把脚本中的函数分别放入三个运行模块中:Init.Run.End ·默认 ...
- PHP中的匿名类
许久不练,要写起来. <?php //匿名类, 同样可以使用继承,接口,特性 //内部匿名类使用外部类的方法和属性,通过继承或构造方法传参 $object = new class { publi ...
- jmeter压测学习1-window环境准备与案例
前言 最近用jmeter做一些接口的压力测试,记录下使用过程中遇到的一些问题. 在使用window机器做并发压测的时候,发现并发数设置100的时候,会出现报错:java.net.SocketExcep ...
- li的inline-block出现间隙原因,解决方案
<style type="text/css"> body{ margin:0 0; padding:0 0; font-size: 14; text-decoratio ...
- Spring AOP 知识点入门
一.基本知识点 1.AOP概念 AOP(Aspect-Oriented Programming), 即 面向切面编程, 它与 OOP( Object-Oriented Programming, 面向对 ...
- JMeter基础【第六篇】JMeter5.1事务、检查点、集合点、思考时间、其余设置等
JMeter5.1事务.检查点.集合点.思考时间.其余设置等
- wordpress调用指定id的page页面的方法,适用于多id调用
前面我们讲到wordpress如何调用指定page页面内容,现在再用另外的方法来调试一下,可以直接在single.php模板使用,同样可以调用多id,随ytkah一起来看看 <?php $arg ...
- hive中时间操作(一)
转:https://blog.csdn.net/u012474716/article/details/78925319/ hive中常用的时间为时间戳和日期格式之间的转换 常用的函数为: to_dat ...