View locks and blocking queries in MariaDB
Join InnoDB lock waits to transactions to identify the sessions on each side of a wait.
SELECT r.trx_mysql_thread_id AS blocked_session, r.trx_query AS blocked_query, b.trx_mysql_thread_id AS blocker_session, b.trx_query AS blocker_queryFROM information_schema.INNODB_LOCK_WAITS AS wJOIN information_schema.INNODB_TRX AS r ON r.trx_id = w.requesting_trx_idJOIN information_schema.INNODB_TRX AS b ON b.trx_id = w.blocking_trx_id;blocked_session is waiting for a lock held by blocker_session.
The result describes current waits, so an empty result says nothing about earlier contention.
This query has no database filter.
View locks and blocking queries in MariaDB
Section titled “View locks and blocking queries in MariaDB”- Run the SQL above in the SQL editor.
- Compare the blocked and blocking session IDs with the queries involved.
- Open Admin › Connections to inspect the sessions.
Admin › Locks also lists InnoDB lock details for the current database. See connections and locks for the monitoring controls.
Required privileges
Section titled “Required privileges”Your account needs access to the InnoDB transaction and lock wait tables.
MariaDB requires PROCESS to inspect these lock waits.
Permission to inspect transactions is separate from permission to end another session.
For access errors, use admin data unavailable.
Resolve a wait
Section titled “Resolve a wait”Ask the transaction’s owner to review its work and commit or roll back as appropriate. If another administrator manages the server, provide the session IDs and the time you observed the wait.
Confirm the session’s owner and purpose before ending it. Ending a connection can roll back unfinished work; TableAI’s query guardrails apply to session termination.