Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the row lock of mysql innodb

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to understand mysql innodb's line lock". The explanation content in this article is simple and clear, easy to learn and understand. Please follow Xiaobian's thinking slowly and deeply to study and learn "how to understand mysql innodb's line lock" together!

Lock based on index, not on selected rows

root@sakila 10:14:32>show index from tab_no_index \G

*************************** 1. row ***************************

Table: tab_no_index

Non_unique: 1

Key_name: id

Seq_in_index: 1

Column_name: id

Collation: A

Cardinality: 5

Sub_part: NULL

Packed: NULL

Null: YES

Index_type: BTREE

Comment:

Index_comment:

1 row in set (0.00 sec)

the first session

root@sakila 10:18:39>select * from tab_no_index where id=1 and name='1' for update;

+------+------+

| id | name |

+------+------+

| 1 | 1 |

+------+------+

1 row in set (0.00 sec)

the second session

root@sakila 10:18:42>select * from tab_no_index where id=1 and name='4' for update;

ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

Thank you for reading, the above is "how to understand mysql innodb line lock" content, after the study of this article, I believe that we have a deeper understanding of how to understand mysql innodb line lock this problem, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report