一旦工作,那就要努力的干,聪明的干,快速的干——用省下来的时间干自己喜欢干的事情。!

事务隔离级别(isolation levels)

数据库 lampnick 1950℃ 0评论
READ UNCOMMITTED
 In the READ UNCOMMITTED isolation level, transactions can view the results of un-
 committed transactions. At this level, many problems can occur unless you really,
 really know what you are doing and have a good reason for doing it. This level is
 rarely used in practice, because its performance isn’t much better than the other
 levels, which have many advantages. Reading uncommitted data is also known as
 a dirty read.
READ COMMITTED
 The default isolation level for most database systems (but not MySQL!) is READ
 COMMITTED . It satisfies the simple definition of isolation used earlier: a transaction
 will see only those changes made by transactions that were already committed
 when it began, and its changes won’t be visible to others until it has committed.
 This level still allows what’s known as a nonrepeatable read. This means you can
 run the same statement twice and see different data.
REPEATABLE READ
 REPEATABLE READ solves the problems that READ UNCOMMITTED allows. It guarantees
 that any rows a transaction reads will “look the same” in subsequent reads within
 the same transaction, but in theory it still allows another tricky problem: phantom
 reads. Simply put, a phantom read can happen when you select some range of rows,
 another transaction inserts a new row into the range, and then you select the same
 range again; you will then see the new “phantom” row. InnoDB and XtraDB solve
 the phantom read problem with multiversion concurrency control, which we ex-
 plain later in this chapter.
 REPEATABLE READ is MySQL’s default transaction isolation level.
SERIALIZABLE
 The highest level of isolation, SERIALIZABLE , solves the phantom read problem by
 forcing transactions to be ordered so that they can’t possibly conflict. In a nutshell,
 SERIALIZABLE places a lock on every row it reads. At this level, a lot of timeouts and
 lock contention can occur. We’ve rarely seen people use this isolation level, but
 your application’s needs might force you to accept the decreased concurrency in
 favor of the data stability that results.

转载请注明:MitNick » 事务隔离级别(isolation levels)

喜欢 (0)or分享 (0)
头像
发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址