溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MySQL中information_schema庫中關于鎖相關表的字段解釋有哪些

發(fā)布時間:2021-11-08 09:19:42 來源:億速云 閱讀:188 作者:小新 欄目:MySQL數據庫

這篇文章主要為大家展示了“MySQL中information_schema庫中關于鎖相關表的字段解釋有哪些”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“MySQL中information_schema庫中關于鎖相關表的字段解釋有哪些”這篇文章吧。

innodb_trx表:
trx_id:事務ID。
trx_state:事務狀態(tài),有以下幾種狀態(tài):RUNNING、LOCK WAIT、ROLLING BACK 和 COMMITTING。
trx_started:事務開始時間。
trx_requested_lock_id:事務當前正在等待鎖的標識,可以和 INNODB_LOCKS 表 JOIN 以得到更多詳細信息。
trx_wait_started:事務開始等待的時間。
trx_weight:事務的權重。
trx_mysql_thread_id:事務線程 ID,可以和 PROCESSLIST 表 JOIN。
trx_query:事務正在執(zhí)行的 SQL 語句。
trx_operation_state:事務當前操作狀態(tài)。
trx_tables_in_use:當前事務執(zhí)行的 SQL 中使用的表的個數。
trx_tables_locked:當前執(zhí)行 SQL 的行鎖數量。
trx_lock_structs:事務保留的鎖數量。
trx_lock_memory_bytes:事務鎖住的內存大小,單位為 BYTES。
trx_rows_locked:事務鎖住的記錄數。包含標記為 DELETED,并且已經保存到磁盤但對事務不可見的行。
trx_rows_modified:事務更改的行數。
trx_concurrency_tickets:事務并發(fā)票數。
trx_isolation_level:當前事務的隔離級別。
trx_unique_checks:是否打開唯一性檢查的標識。
trx_foreign_key_checks:是否打開外鍵檢查的標識。
trx_last_foreign_key_error:最后一次的外鍵錯誤信息。
trx_adaptive_hash_latched:自適應散列索引是否被當前事務鎖住的標識。
trx_adaptive_hash_timeout:是否立刻放棄為自適應散列索引搜索 LATCH 的標識。

innodb_locks表:
lock_id:鎖 ID。
lock_trx_id:擁有鎖的事務 ID??梢院?INNODB_TRX 表 JOIN 得到事務的詳細信息。
lock_mode:鎖的模式。有如下鎖類型:行級鎖包括:S、X、IS、IX,分別代表:共享鎖、排它鎖、意向共享鎖、意向排它鎖。表級鎖包括:S_GAP、X_GAP、IS_GAP、IX_GAP 和 AUTO_INC,分別代表共享間隙鎖、排它間隙鎖、意向共享間隙鎖、意向排它間隙鎖和自動遞增鎖。
lock_type:鎖的類型。RECORD 代表行級鎖,TABLE 代表表級鎖。
lock_table:被鎖定的或者包含鎖定記錄的表的名稱。
lock_index:當 LOCK_TYPE=’RECORD’ 時,表示索引的名稱;否則為 NULL。
lock_space:當 LOCK_TYPE=’RECORD’ 時,表示鎖定行的表空間 ID;否則為 NULL。
lock_page:當 LOCK_TYPE=’RECORD’ 時,表示鎖定行的頁號;否則為 NULL。
lock_rec:當 LOCK_TYPE=’RECORD’ 時,表示一堆頁面中鎖定行的數量,亦即被鎖定的記錄號;否則為 NULL。
lock_data:當 LOCK_TYPE=’RECORD’ 時,表示鎖定行的主鍵;否則為NULL。

innodb_lock_waits表:
requesting_trx_id:請求事務的 ID。
requested_lock_id:事務所等待的鎖定的 ID??梢院?INNODB_LOCKS 表 JOIN。
blocking_trx_id:阻塞事務的 ID。
blocking_lock_id:某一事務的鎖的 ID,該事務阻塞了另一事務的運行??梢院?INNODB_LOCKS 表 JOIN。


innodb_trx表查詢結果舉例:
mysql(mdba@localhost:(none) 03:48:05)>select * from information_schema.innodb_trx \G
*************************** 1. row ***************************
                    trx_id: 3404472915
                 trx_state: RUNNING
               trx_started: 2017-07-20 15:48:14
     trx_requested_lock_id: NULL
          trx_wait_started: NULL
                trx_weight: 3
       trx_mysql_thread_id: 27044647
                 trx_query: commit
       trx_operation_state: committing
         trx_tables_in_use: 0
         trx_tables_locked: 1
          trx_lock_structs: 2
     trx_lock_memory_bytes: 1136
           trx_rows_locked: 1
         trx_rows_modified: 1
   trx_concurrency_tickets: 0
       trx_isolation_level: REPEATABLE READ
         trx_unique_checks: 1
    trx_foreign_key_checks: 1
trx_last_foreign_key_error: NULL
 trx_adaptive_hash_latched: 0
 trx_adaptive_hash_timeout: 0
          trx_is_read_only: 0
trx_autocommit_non_locking: 0
*************************** 2. row ***************************
                    trx_id: 3404264783
                 trx_state: RUNNING
               trx_started: 2017-07-20 15:42:06
     trx_requested_lock_id: NULL
          trx_wait_started: NULL
                trx_weight: 2
       trx_mysql_thread_id: 22514654
                 trx_query: update qymc set status1='2' where id=962304
       trx_operation_state: NULL
         trx_tables_in_use: 0
         trx_tables_locked: 1
          trx_lock_structs: 1
     trx_lock_memory_bytes: 1136
           trx_rows_locked: 0
         trx_rows_modified: 1
   trx_concurrency_tickets: 0
       trx_isolation_level: REPEATABLE READ
         trx_unique_checks: 1
    trx_foreign_key_checks: 1
trx_last_foreign_key_error: NULL
 trx_adaptive_hash_latched: 0
 trx_adaptive_hash_timeout: 0
          trx_is_read_only: 0
trx_autocommit_non_locking: 0

以上是“MySQL中information_schema庫中關于鎖相關表的字段解釋有哪些”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業(yè)資訊頻道!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI