How to view the rollback progress of a transaction in mysql

Once I encountered a large transaction that was executed very slowly, I killed it, but found the show processlist; I can still see the sql of the kill. Although the status of the sql changed to killed, it was not actually killed. At this time, you can check the progress of the transaction rollback, and you can roughly know when the sql can be rolled back.

View method:

select * from information_schema.INNODB_TRX where trx_id=事务id \G;

Focus on trx_rows_locked, trx_rows_modified:

You will see that the value of trx_rows_modified continues to decrease until it becomes 0, indicating that the rollback is complete.

--If you want to check the execution progress of ordinary transactions (non-rollback transactions), once you find that the value of trx_rows_locked is changing from small to large, and it is not a rectification table that is locked all at once. Therefore, to check the entire progress, you should also refer to how many records there are in this table to estimate.

Guess you like

Origin blog.csdn.net/YABIGNSHI/article/details/130604797