Skip to content

Instantly share code, notes, and snippets.

@bluerabbit
Created August 30, 2016 01:37
Show Gist options
  • Save bluerabbit/cfefb2a685752e84f0f0242d1c5c6e82 to your computer and use it in GitHub Desktop.
Save bluerabbit/cfefb2a685752e84f0f0242d1c5c6e82 to your computer and use it in GitHub Desktop.
SELECT
  requesting_ps.user AS requesting_user,
  requesting_ps.host AS requesting_host,
  requesting_ps.db AS requesting_db,
  requesting_lock.lock_mode AS requesting_lock_mode,
  requesting_lock.lock_type AS requesting_lock_type,
  requesting_lock.lock_table AS requesting_lock_table,
  requesting_lock.lock_index AS requesting_lock_index,
  requesting_trx.trx_id AS requesting_trx_id,
  requesting_trx.trx_query AS requesting_trx_query,
  requesting_trx.trx_state AS requesting_trx_state,
  requesting_trx.trx_started AS requesting_trx_started,
  requesting_trx.trx_wait_started AS requesting_trx_wait_started,
  requesting_trx.trx_lock_structs AS requesting_trx_lock_structs,
  requesting_trx.trx_rows_locked AS requesting_trx_rows_locked,
  requesting_trx.trx_isolation_level AS requesting_trx_isolation_level,
  blocking_ps.user AS blocking_user,
  blocking_ps.host AS blocking_host,
  blocking_ps.db AS blocking_db,
  blocking_lock.lock_mode AS blocking_lock_mode,
  blocking_lock.lock_type AS blocking_lock_type,
  blocking_lock.lock_table AS blocking_lock_table,
  blocking_lock.lock_index AS blocking_lock_index,
  blocking_trx.trx_id AS blocking_trx_id,
  blocking_trx.trx_state AS blocking_trx_state,
  blocking_trx.trx_started AS blocking_trx_started,
  blocking_trx.trx_lock_structs AS blocking_trx_lock_structs,
  blocking_trx.trx_rows_locked AS blocking_trx_rows_locked,
  blocking_trx.trx_isolation_level AS blocking_trx_isolation_level
FROM
  INNODB_LOCK_WAITS
  INNER JOIN INNODB_TRX requesting_trx
    ON INNODB_LOCK_WAITS.requesting_trx_id = requesting_trx.trx_id
  INNER JOIN PROCESSLIST requesting_ps
    ON requesting_ps.id = requesting_trx.trx_mysql_thread_id
  INNER JOIN INNODB_LOCKS requesting_lock
    ON requesting_lock.lock_id = INNODB_LOCK_WAITS.requested_lock_id
  INNER JOIN INNODB_TRX blocking_trx
    ON INNODB_LOCK_WAITS.blocking_trx_id = blocking_trx.trx_id
  INNER JOIN PROCESSLIST blocking_ps
    ON blocking_ps.id = blocking_trx.trx_mysql_thread_id
  INNER JOIN INNODB_LOCKS blocking_lock
    ON blocking_lock.lock_id = INNODB_LOCK_WAITS.blocking_lock_id
@bluerabbit
Copy link
Author

mysql8 sys.innodb_lock_waitsに変わってた

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment