隔离级别与脏读幻读

2017/02/12 iteye
  1. 数据库操作 issue

    1. 更新丢失(lost update):当系统允许两个事务同时更新同一数据时,发生更新丢失
    2. 脏读(dirty read):当一个事务读取另一个事务尚未提交的修改时,产生脏读。
    3. 非重复读(nonrepeatable read):同一查询在同一事务中多次进行,由于其他提交事务所做的修改或删除,每次返回不同的结果集,此时发生非重复读。(A transaction rereads data it has previously read and finds that another committed transaction has modified or deleted the data. )
    4. 幻像(phantom read):同一查询在同一事务中多次进行,由于其他提交事务所做的插入操作,每次返回不同的结果集,此时发生幻像读。(A transaction reexecutes a query returning a set of rows that satisfies a search condition and finds that another committed transaction has inserted additional rows that satisfy the condition. )  
  2. ANSI/ISO SQL92标准定义的隔离级别:

    1. 未提交读(read uncommitted)
    2. 提交读(read committed)这是大多是数据库的默认隔离级别并被大多vendors支持
    3. 重复读(repeatable read) --行级锁定,不能写该行
    4. 序列化(serializable)   --表锁定,不能插入新的数据          

参考: http://kakaluyi.iteye.com/blog/185473        

Search

    Table of Contents