2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQL(INNODB)でロック待ちを確認する方法

Last updated at Posted at 2019-09-30

MySQL5.6 (INNODB)

SELECT
	pl.ID AS ID,
	trx.trx_id AS TRX_ID,
	pl.STATE AS STATE,
	trx.trx_state AS TRX_STATE,
	waits.blocking_trx_id AS BLOCKING_TRX_ID,
	trx.trx_weight AS RECORDS,
	trx.trx_query AS QUERY
FROM
	information_schema.INNODB_TRX AS trx
LEFT JOIN
	information_schema.PROCESSLIST AS pl
ON
	trx.trx_mysql_thread_id = pl.ID
LEFT JOIN
	information_schema.INNODB_LOCK_WAITS AS waits
ON
	trx.trx_id = waits.requesting_trx_id

rootアカウントでやらないと他のユーザーの実行したクエリが表示されないので注意

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?