当前位置:网站首页>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的锁机制。
(个人理解)
边栏推荐
- What is the complexity often said during the interview?
- Want the clouds in the picture to float? Video editing services can be achieved in three steps with one click
- Acl-ijcai-sigir top conference paper report meeting (AIS 2022) Note 3: dialogue and generation
- The "nuclear bomb level" log4j vulnerability is still widespread and has a continuing impact
- [e-mr] error recovery record of namenode
- Comprehensively design an oppe homepage -- the design of the top and head
- kubernetes之探针
- Advanced CAD exercises (I)
- Re8:读论文 Hier-SPCNet: A Legal Statute Hierarchy-based Heterogeneous Network for Computing Legal Case
- Re9:读论文 DEAL Inductive Link Prediction for Nodes Having Only Attribute Information
猜你喜欢

终于有人把红蓝对抗讲明白了

PAT甲级1048 Find Coins

Pat class a 1047 student list for course

PAT甲级 1046 Shortest Distance

spark-streaming状态流之mapWithState

Pat grade a 1048 find coins

Re9:读论文 DEAL Inductive Link Prediction for Nodes Having Only Attribute Information

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

Collection of open source expert opinions on trusted privacy computing framework "argot"

RE9: read the paper deal inductive link prediction for nodes having only attribute information
随机推荐
结构体和类使用的区别
Bugku login2
【Flutter -- 进阶】打包
研发效能的道与术 - 道篇
互联网协议
PAT甲级 1044 Shopping in Mars
Difference between C event and delegation
docker安装redis?如何配置持久化策略?
《硅谷之谜》读后感
Development daily summary (11): file upload function improvement: Chinese character detection and text content processing
量化交易之数字货币篇 - 通过时间戳与方向来合并逐笔成交数据(大单合并)
Internet Protocol
[ten thousand words long text] Based on LSM tree thought Net 6.0 C # realize kV database (case version)
Differences between the use of structs and classes
A firefox/chrome plug-in that visualizes browser history
FTP protocol
[BJDCTF2020]Easy MD5
CAD进阶练习题(一)
Comprehensively design an oppe homepage -- layout and initialization
The process and harvest of developing browser plug-ins with clojurescript