WRITE are also queued. Some wrong statements which produce an error may not need to wait for the lock to be freed. The metadata lock's timeout is determined by the value of the lock_wait_timeout server system variable (in seconds). However, note that its default value is 31536000 (1 year, MariaDB <= 10.2.3), or 86400 (1 day, MariaDB >= 10.2.4). If this timeout is exceeded, the following error is returned: ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction If the metadata_lock_info plugin is installed, the Information Schema metadata_lock_info table stores information about existing metadata locks. MariaDB starting with 10.5.2 ---------------------------- From MariaDB 10.5, the Performance Schema metadata_locks table contains metadata lock information. Example ------- Let's use the following MEMORY (non-transactional) table: CREATE TABLE t (a INT) ENGINE = MEMORY; Connection 1 starts a transaction, and INSERTs a row into t: START TRANSACTION; INSERT INTO t SET a=1; t's metadata is now locked by connection 1. Connection 2 tries to alter t, but has to wait: ALTER TABLE t ADD COLUMN b INT; Connection 2's prompt is blocked now. Now connection 1 ends the transaction: COMMIT; ...and connection 2 finally gets the output of its command: Query OK, 1 row affected (35.23 sec) Records: 1 Duplicates: 0 Warnings: 0 URL: https://mariadb.com/kb/en/metadata-locking/https://mariadb.com/kb/en/metadata-locking/