tencent cloud

문서TDSQL-C for MySQL

NOWAIT

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2024-04-25 11:00:51

Overview

DDL statements support NO_WAIT and WAIT options. If a DDL statement with WAIT enabled fails to obtain an MDL lock, it will wait for WAIT seconds before it directly returns the query result. If a DDL statement with NO_WAIT enabled, it will directly return the query result without waiting for the MDL lock.
SELECT FOR UPDATE statement supports NOWAIT and SKIP LOCKED options. If target rows are locked by another transaction, a SELECT FOR UPDATE statement is supposed to wait for the transaction to release the lock. But in some use cases like flash sales, you do not want to wait for a lock. You can use SKIP LOCKED to skip locked rows (as a result, the locked rows won't be returned in the query result set) or NOWAIT to return an error without waiting for the lock.
Note that NO_WAIT and NOWAIT are different keywords.

Supported Versions

TDSQL-C for MySQL 5.7 (kernel version 2.0.23/2.1.9) or later.
TDSQL-C for MySQL 8.0 (kernel version 3.1.10) or later.

Use Cases

Currently, DevAPI/XPlugin does not support using SKIP LOCKED or NOWAIT in SELECT FOR UPDATE/SHARE statements. Note that NO_WAIT in DDL statements and NOWAIT in SELECT FOR UPDATE statements are different keywords for historical reasons.



도움말 및 지원

문제 해결에 도움이 되었나요?

피드백