当前位置:网站首页>[learning notes] classification of locks in the database
[learning notes] classification of locks in the database
2022-07-27 18:12:00 【Cotton candy】
From the sharing of locks / From the perspective of database management , Locks can be divided into shared locks and exclusive locks .
Shared lock (S lock ): Also called read lock , For read-only operations that do not modify data , Such as select sentence . When a transaction applies a shared lock to data , Other transactions can only add shared locks to the same transactions , Instead of adding an exclusive lock . Transactions that acquire shared locks can only read data , You can't modify the data .
Exclusive lock (X lock ): Also known as write lock , Operations for modifying data , Such as insert、update、delete sentence . When a transaction adds an exclusive lock to the data , Other transactions can no longer lock the data . Transactions that acquire exclusive locks can read data , It can also modify data .
From the locking mode / Programmer perspective , Locks can be divided into optimistic locks and pessimistic locks .
Optimism lock : Take an optimistic attitude when locking , That is, there will be no conflict , Do it first , If there is no conflict, you will succeed directly , If the conflict is resolved .
Pessimistic locking : Adopt a pessimistic attitude when locking , That is, there must be conflict , No matter there is conflict , Lock them first , Then operate .
From the granularity of shackles , Locks can be divided into row locks and table locks .
Row lock : Lock a row of the database table , Spending big , Small lock size , The probability of conflict is small , High concurrency .
Table locks : Lock the whole table of the database , Low overhead , Big lock size , There is a high probability of conflict , Low concurrency .
边栏推荐
- 【云图说】 第249期 移动应用安全服务—App的体检中心,全面检测,安全上路!
- 卷积神经网络——YOLOV1论文翻译
- golang 等待一组goroutine完成,并带返回值(2)
- Knowledge dry goods: basic storage service novice Experience Camp
- Multi thread import data and generate error files for redis storage
- 知物由学 | SO加固如何提升Android应用的安全性?
- 【学习笔记】热点账户问题的解决方案
- 登录页面tableLayout(表格布局)
- ts学习笔记-class
- 防止sql注入
猜你喜欢

知物由学 | 从0到1搭建实时反外挂机制,多维度补充手游攻防力

zabbix6.0的安装部署

机器学习之评价指标(二)——分类评价指标

Convolutional neural network -- Translation of yolov2 (yolo9000) papers

WebDriverException( selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executabl

Evaluation index of machine learning (II) -- classification evaluation index

Salesforce File Share and Security

Error launching IDEA
知物由学 | SO加固如何提升Android应用的安全性?

Learn from things | Yidun mobile terminal isomorphism practice, improve the official website interaction experience in a few steps
随机推荐
知物由学 | 易盾移动端同构实践,几步改善官网交互体验
vim的配置及基础使用
Golang Chan implements mutual exclusion
Knowledge dry goods: basic storage service novice Experience Camp
Hutool digital computing
ES查询限制10000条数据解决方法
Salesforce dynamic dashboard dynamic reports, limitations and Solutions
知物由学 | 关联图分析在反作弊业务中的应用
【Codeforces】 B. Make it Divisible by 25
[user article] examples of P4 consolidation practice guide disassemble resolve
多线程导入数据并生成错误文件用redis存储
Know things by learning | build a real-time anti plug-in mechanism from 0 to 1 to supplement the offensive and defensive power of mobile games in multiple dimensions
VSS tip: search all checked out files (search checked out files according to users)
fragmentTransaction.replace第二个参数报错
The global cloud market is growing rapidly, and data security has entered a strong regulatory era of rule of law
org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous err
golang chan实现互斥锁
shell常见命令(1)——变量大小写转换
WPF做登陆界面
SQL Server连接到服务器无效的解决办法