MySQL Query lock

Source: Internet
Author: User

Select Ifnull (wt.trx_mysql_thread_id,1) blocking_thread_id,

t.trx_mysql_thread_id thread_id,

CONCAT (P.user, ' @ ', p.host) user,

L.lock_table lock_table,

L.lock_index Locked_index,

L.lock_type Lock_type,

L.lock_mode Lock_mode,

CONCAT (

Floor (HOUR-Timediff (now (), t.trx_wait_started)/+), ' Day ',

MOD (HOUR (now (), t.trx_wait_started), 24), ': ',

MINUTE (Timediff (now (), t.trx_wait_started)), ': ',

Second (Timediff (now (), t.trx_wait_started)) as Wait_time,

T.trx_started trx_started,

T.trx_isolation_level Trx_isolation_level,

T.trx_rows_locked trx_rows_locked,

T.trx_rows_modified trx_rows_modified,

P.info Sql_text

From INFORMATION_SCHEMA. Innodb_trx T

Left JOIN information_schema.innodb_lock_waits w on t.trx_id = w.requesting_trx_id

Left JOIN information_schema.innodb_trx wt on wt.trx_id = w.blocking_trx_id

INNER JOIN information_schema.innodb_locks l on l.lock_trx_id = t.trx_id

INNER JOIN information_schema.processlist p on t.trx_mysql_thread_id = P.id

ORDER by 1

MySQL Query lock

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.