MySQL InnoDB – Resetting innodb_row_lock Without Restarting MySQL 5.7

innodbMySQL

Now I could using this command to check the innodb_row_lock values:

show status like 'innodb_row_lock%';



Innodb_row_lock_current_waits   4
Innodb_row_lock_time    22471927
Innodb_row_lock_time_avg    52
Innodb_row_lock_time_max    22327
Innodb_row_lock_waits   426696

is it possible to reset the data without restart database? I aready searching from internet but no one talks about this.

Best Answer

No.

The workaround:

  1. SHOW GLOBAL VARIABLES LIKE 'Innodb_row_lock%';
  2. Run your query/queries
  3. SHOW GLOBAL VARIABLES LIKE 'Innodb_row_lock%';
  4. Programmatically subtract the values. (Well, perhaps only Innodb_row_lock_waits can really be subtracted.)

It may be possible to use information_schema.GLOBAL_STATUS, but (in some cases) you get hit by the 'Uncertainty principle'.

In my experience, these values are "typical":
Innodb_row_lock_current_waits -- rarely more than 0
Innodb_row_lock_time -- non interesting
Innodb_row_lock_time_avg -- Usually 10-1000ms
Innodb_row_lock_time_max -- Usually < 50K (ms)
Innodb_row_lock_waits -- not useful, except in your case of "subtracting"

Where are you hoping to take this inquiry?

If you would like a review of your variables and status: http://mysql.rjweb.org/doc.php/mysql_analysis#tuning