WAIT 和 NOWAIT

MariaDB starting with 10.3.0

MariaDB 10.3.0开始,引入扩展语法以便下面的语句可以使用innodb_lock_wait_timeout变量和lock_wait_timeout变量设置的锁等待时长:

语法

ALTER TABLE tbl_name [WAIT n|NOWAIT] ...
CREATE ... INDEX ON tbl_name (index_col_name, ...) [WAIT n|NOWAIT] ...
DROP INDEX ... [WAIT n|NOWAIT]
DROP TABLE tbl_name [WAIT n|NOWAIT] ...
LOCK TABLE ... [WAIT n|NOWAIT]
OPTIMIZE TABLE tbl_name [WAIT n|NOWAIT]
RENAME TABLE tbl_name [WAIT n|NOWAIT] ...
SELECT ... FOR UPDATE [WAIT n|NOWAIT]
SELECT ... LOCK IN SHARE MODE [WAIT n|NOWAIT]
TRUNCATE TABLE tbl_name [WAIT n|NOWAIT]

描述

锁等待超时时长可以通过WAIT n(单位为秒)来精确设置,或者设置为NOWAIT,这种情况下,如果无法获取锁会立即返回失败。WAIT 0等价于NOWAIT

See also

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.