当前位置:网站首页>transaction, storage engine
transaction, storage engine
2022-08-10 05:46:00 【hagong9】
目录
Demonstration of the operation of things
The isolation level within a transaction编辑

What is the use of things?

如上图,It is no problem to use previous knowledge to achieve this requirement,但是如果出现了 The first statement executes successfully,The second statement does not succeed,Then it will disappear out of thin air100元 ,To avoid this problem,These two statements should be turned into a set of statements,要么都成功,要么都失败.It's time to use things to solve it.
Demonstration of the operation of things
-- Demonstration of the operation of things
-- 1,Create a demo sheet
CREATE TABLE demo
(id INT,
`name` VARCHAR(10))
-- 2.开始事物
START TRANSACTION
-- 3.设置保存点
SAVEPOINT a
-- 4 dml操作
INSERT INTO demo
VALUES (1,'张三')
-- 5,Set a second savepoint
SAVEPOINT b
-- 6.再执行dml操作,Insert one more message here
INSERT INTO demo
VALUES (2,'李四')
-- 7.Check the current onedemo表
SELECT * FROM demo
】
Roll back to a savepoint
-- 8.回退到保存点b
ROLLBACK TO b
-- 9.再次查询demo表
SELECT * FROM demo 
This save point is similar to the save point of the game,Select the desired archive to read.
Among them, if there is a situation that cannot be reversed,Is because the engine of the table is notINNODB It needs to be specified when creating the table or changed in the design table.

details of things

The isolation level within a transaction

简单解释,There are now two connections,A和B
Two people start things,AConnect to modify the database,但未提交,这时BQuery the database,结果读到了A修改的数据,这就是脏读.
AModify and delete databases(插入),也提交了,但是bNot submitting your own,正常情况下BWhat you should see is the database data when you started things,As a result, when you query the database, what you see is aAffected database,这就是不可重复读.(幻读).
Locked means,Only one connection can overrun the database at a time,比如,A对数据库进行修改,但是未提交,这时B查询数据库,will get stuck on the query statement,不执行
设置隔离级别


事物ACID

存储引擎

使用show engines to see all engines
使用 alter table `表名` engines = xxxxx to modify the engine of the table
Main engine characteristics

边栏推荐
猜你喜欢
随机推荐
链读|最新最全的数字藏品发售日历-07.29
Link reading good article: What is the difference between hot encrypted storage and cold encrypted storage?
最新最全的数字藏品发售日历-07.26
链读精选:星巴克着眼于数字收藏品并更好地吸引客户
idm下载器如何使用 idm下载器使用技巧
基于Qiskit——《量子计算编程实战》读书笔记(五)
Count down the six weapons of the domestic interface collaboration platform!
操作表 函数的使用
反射【笔记】
反转链表中的第m至第n个节点---leetcode
【el和template区别】
Notes 1
复杂的“元宇宙”,为您解读,链读APP即将上线!
pytorch框架学习(4)torchvision模块&训练一个简单的自己的CNN (一)
latex图片排版技巧总结
非会员更改有道云笔记背景
网络安全之防火墙
文章复现:超分辨率网络FSRCNN
Module build failed TypeError this.getOptions is not a function报错解决方案
redis集群模式









