当前位置:网站首页>[MySQL] methods for troubleshooting lock related problems

[MySQL] methods for troubleshooting lock related problems

2022-06-13 07:37:00 Fish is not fish

Preface

Believe that whatever you do DBA Or development , In fact, no one wants to encounter the lock , Because the lock is a
Double-edged sword , If used well, it can protect the concurrent access competition to resources , But in bad words , It's easy to cause
Online problem , For example, deadlock. , Lock wait , Business waiting , Business is not available , The database performance drops dramatically .

MySQL Lock correlation table

I'm sure you all know that ,MySQL There are many kinds of locks , Read lock, write lock, metadata lock, etc .
To get to the point, how do we check locks , Generally, the following tables are used :
5.7 edition Information_schema.innodb_locks The table shows the current waiting locks Information_schema.innodb_trx The table can query the currently uncommitted transactions

8.0 edition , Abandoned the previous innodb_locks surface Added the following tables stay performance_schema Here are a few tables : data_lock_waits. Displays the currently waiting locks data_locks. Display all current locks metadata_locks Display the details of the current metadata lock

MySQL Lock monitoring related

Innodb_row_lock_current_waits: Number of locks currently waiting
Innodb_row_lock_time: It takes a total of time to wait for the lock from the start of the system to the present
Innodb_row_lock_time_avg: The average time between system startup and lock waiting
Innodb_row_lock_time_max: The longest time between system startup and lock waiting
Innodb_row_lock_waits: Total number of lock waits since system startup

原网站

版权声明
本文为[Fish is not fish]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202270547441499.html