码迷,mamicode.com
首页 > 数据库 > 详细

When does locking or mvcc occur? Where do I need to specify which one the database should use?

时间:2020-02-10 18:19:22      阅读:89      评论:0      收藏:0      [点我收藏+]

标签:The   upd   iter   reader   proc   record   commit   and   ble   

MVCC applies to isolation levels read-committed and repeatable read (default).

You don‘t need to specify anything for both of these features to work together. 

 

Row Level Locking

Locking is for when multiple writers are trying to update the same rows. Only one writer can update a row at a time, and the first one to update the row locks it until they commit the change. Other writers have to wait until the first writer commits. But at least with row-level locking, they only have contention if they‘re updating the same row.

A read lock can be used to prevent other users from reading a record (or page) which is being updated, so that others will not act upon soon-to-be-outdated information.

 

Multiversion Concurrency Control

  1. Writers don‘t block readers

  2. Readers don‘t block anyone, and don‘t get blocked by anyone(but the data readers is reading maybe historical version)

 

When does locking or mvcc occur? Where do I need to specify which one the database should use?

标签:The   upd   iter   reader   proc   record   commit   and   ble   

原文地址:https://www.cnblogs.com/lnas01/p/12291688.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!