Read Uncommitted是隔离级别最低的一种事务级别。在这种隔离级别下,一个事务会读到另一个事务更新后但未提交的数据,如果另一个事务回滚,那么当前事务读到的数据就是脏数据,这就是脏读(Dirty Read)。

我们来看一个例子。

首先,我们准备好students表的数据,该表仅一行记录:直线电机怎么选择

mysql> select * from students;
+----+-------+
| id | name |
+----+-------+
| 1 | Alice |
+----+-------+
1 row in set (0.00 sec)

然后,分别开启两个MySQL客户端连接,按顺序依次执行事务A和事务B:

时刻 事务A 事务B
1 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
2 BEGIN; BEGIN;
3 UPDATE students SET name = 'Bob' WHERE id = 1;  
4   SELECT * FROM students WHERE id = 1;
5 ROLLBACK;  
6   SELECT * FROM students WHERE id = 1;
7   COMMIT;

Read Uncommitted的更多相关文章

  1. 解决:error: .repo/manifests/: contains uncommitted changes

    repo sync同步时提示出错:          error: .repo/manifests/: contains uncommitted changes 解决方法: 1.cd 进入.repo/ ...

  2. Couldn't save uncommitted changes.

    关于idea切换分支报错的问题. Couldn't save uncommitted changes. Tried to save uncommitted changes in stash befor ...

  3. 事务隔离级别之Read Uncommitted/WITH(NOLOCK)

    知识点链接 事务隔离级别之Read Uncommitted       https://blog.csdn.net/oyw5201314ck/article/details/79621347 WITH ...

  4. MySQL在Read Uncommitted级别下写操作加X锁

    很多文章认为MySQL在读未提交(Read Uncommitted)的隔离级别下,写操作是不加锁的,然而实际上并不是,在RU级别下,写操作加有X锁. 实践出真知 以前,我也认为RU隔离级别下,写操作不 ...

  5. MySQL数据库事务各隔离级别加锁情况--read uncommitted篇(转)

    本文转自https://m.imooc.com/article/details?article_id=17291,感谢作者 1.目的 1.1 合适人群 1.数据库事务特征我只是背过,并没有很深刻的理解 ...

  6. 出现了错误。详细消息: 3 uncommitted changes would be overwritten by merge

    merge manual中有一条警告: 出现了错误.详细消息: 3 uncommitted changes would be overwritten by merge 有未提交修改情况下,不要执行me ...

  7. npm run eject 命令后出现This git repository has untracked files or uncommitted changes错误

    npm run eject 暴露隐藏的文件,不可逆 结果出现下面的问题 This git repository has untracked files or uncommitted changes: ...

  8. repo sync error: .repo/manifests/: contains uncommitted changes

    andorid 源码库同步,报错如标题,好几次想放弃,尝试了网上不少办法,无效, 最终从 stackoverflow 得到答案: After issued repo sync, I got a err ...

  9. git 错误信息 6 uncommitted changes would be overwritten by merge

    表示本地库有几个文件修改没有提交,说明本地有几个文件没有跟踪

随机推荐

  1. boost scope exit

    Boost.ScopeExit provides the macro BOOST_SCOPE_EXIT, which can be used to define something that look ...

  2. c++11 继承构造函数

    若基类拥有数量众多的不同版本的构造函数,而派生类中只有一些成员函数,则对于派生类而言,其构造函数就等同于构造基类. struct A { A(int i) {} A(double d, int i) ...

  3. epoll学习

    一.epoll_create #include <sys/epoll.h> int epoll_create(int size); int epoll_create1(int flags) ...

  4. hdu1059&poj1014 Dividing (dp,多重背包的二分优化)

    Problem Description Marsha and Bill own a collection of marbles. They want to split the collection a ...

  5. LG1010 幂次方

    题目描述 任何一个正整数都可以用2的幂次方表示.例如 137=2^7+2^3+2^0 同时约定方次用括号来表示,即a^b 可表示为a(b). 由此可知,137可表示为: 2(7)+2(3)+2(0) ...

  6. OpenResty 技术图谱skill-map

    # OpenResty 技术图谱## basic concepts- HTTP- RESTful API & API GateWay- Microservice- Domain Specifi ...

  7. leetcode上的一些动态规划

    70-爬楼梯 思路:该问题可以理解为经典的“斐波那契数列”问题,但这里需要用动规实现,递归会超时 class Solution { public: int climbStairs(int n) { v ...

  8. appium 链接真机

    1. 安装驱动 说明:如果驱动装不上,可以使用第三方的工具去安装.(一般来说还是用第三方) 这里推荐锤子科技的HandShaker, 地址:http://www.smartisan.com/apps/ ...

  9. HTML-参考手册: HTML 字符集

    ylbtech-HTML-参考手册: HTML 字符集 1.返回顶部 1. HTML 字符集 HTML 字符集 如需正确地显示 HTML 页面,浏览器必须知道使用何种字符集. 万维网早期使用的字符集是 ...

  10. 65、salesforce的数据分页

    <apex:page controller="PagingController"> <apex:form > <apex:pageBlock titl ...