当前位置:网站首页>mysql锁机制(举例说明)
mysql锁机制(举例说明)
2022-07-26 16:17:00 【塞班呢】
先看个例子,一个飞机订票系统有两个售票点甲和乙,原来有A=16张票,此时甲售票点卖出一张A <-- A-1,剩余15张,此时乙售票点也卖出一张A <-- A-1,剩余15张,本来应该剩余14张的,这就是多个事务同时修改同一个数据,导致数据不一致的情况
并发操作可能导致的数据不一致性的问题有丢失操作、不可重复读、读“脏”数据
mysql锁机制就是用来保证并发操作的有效性和数据一致性
加锁的过程,就是甲在去修改A的时候,先获取一个锁,锁的种类有好多,功能特性也不一样,拿到所以后就将A给锁起来,这样别人就不能对A进行修改了,只有等甲事务执行完后释放了对A的锁以后别人才可以去获取锁,然后对A进行上锁,在进行修改,这就是mysql的锁机制。
(个人理解)
边栏推荐
- kubernetes之ReplicationController与ReplicaSet
- 2022 Niuke summer multi school training camp 1 (acdgij)
- C#读取本地文件夹中所有文件文本内容的方法
- PAT甲级 1046 Shortest Distance
- Comprehensive design of an oppe homepage -- Design of navigation bar
- spark-streaming状态流之mapWithState
- Re8: reading papers Hier spcnet: a legal stat hierarchy based heterogeneous network for computing legal case
- What is GPIO and what is its use
- Clojure Web 开发-- Ring 使用指南
- MVC和ECS两种设计架构的初浅理解
猜你喜欢

2022 test questions and answers for the latest national fire facility operator (senior fire facility operator)

Vscode batch delete

guetzli简单使用

The difference and efficiency comparison of three methods of C # conversion integer

DTS is equipped with a new self-developed kernel, which breaks through the key technology of the three center architecture of the two places Tencent cloud database

PAT甲级 1050 String Subtraction

Bugku login2

Operating system migration practice: deploying MySQL database on openeuler

该怎么写单元测试呢

FTP protocol
随机推荐
结构体和类使用的区别
初识OpenGL (3)片段着色器(Fragment Shader)
【物理模拟】最简单的shape matching的原理与实践
匿名方法和lambda表达式使用的区别
NUC 11 build esxi 7.0.3f install network card driver-v2 (upgraded version in July 2022)
Application of workflow engine in vivo marketing automation
FTP protocol
The difference between anonymous methods and lambda expressions
C#事件和委托的区别
Linux安装mysql8.0.29详细教程
C # set different text watermarks for each page of word
Re8:读论文 Hier-SPCNet: A Legal Statute Hierarchy-based Heterogeneous Network for Computing Legal Case
NUC 11构建 ESXi 7.0.3f安装网卡驱动-V2(2022年7月升级版)
Alibaba cloud DMS MySQL cloud database report error, solve!!
Clojure operation principle bytecode generation
Development daily summary (11): file upload function improvement: Chinese character detection and text content processing
初识OpenGL (4)链接着色器
Finally, someone explained the red blue confrontation clearly
Simulation of three-phase voltage source inverter based on SISOTOOL pole assignment PI parameters and pless
guetzli简单使用