5

MySQL数据库行级锁定的优点和缺点有哪些?

 3 years ago
source link: https://xushanxiang.com/2019/11/advantages-and-disadvantages-of-mysql-row-level-locking.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

MySQL数据库行级锁定的优点和缺点有哪些?

作者: xusx 分类: MySQL 发布时间: 2019-11-21 11:36

一、行级锁定的优点:

  1. 当在许多线程中访问不同的行时只存在少量锁定冲突。
  2. 回滚时只有少量的更改。
  3. 可以长时间锁定单一的行。

二、行级锁定的缺点:

  1. 比页级或表级锁定占用更多的内存。
  2. 当在表的大部分中使用时,比页级或表级锁定速度慢,因为你必须获取更多的锁。
  3. 如果你在大部分数据上经常进行GROUP BY操作或者必须经常扫描整个表,比其它锁定明显慢很多。
  4. 用高级别锁定,通过支持不同的类型锁定,你也可以很容易地调节应用程序,因为其锁成本小于行级锁定。

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

发表评论 取消回复

电子邮件地址不会被公开。 必填项已用*标注


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK