Back to Yugabyte Db

LOCK statement [YSQL]

docs/content/v2.25/api/ysql/the-sql-language/statements/txn_lock.md

2026.1.0.0-b25998 B
Original Source

Synopsis

Use the LOCK statement to lock a table.

Syntax

{{%ebnf%}} lock_table, lockmode {{%/ebnf%}}

{{< note title="Table inheritance is not yet supported" >}} The table_expr rule specifies syntax that is useful only when at least one other table inherits one of the tables that the truncate statement lists explicitly. See this note for more detail. Until inheritance is supported, use a bare table_name. {{< /note >}}

Semantics

lock_table

name

Specify a table to lock.

lockmode

  • Only ACCESS SHARE lock mode is supported at this time.
  • All other modes listed in lockmode are under development.
ACCESS SHARE
  | ROW SHARE
  | ROW EXCLUSIVE
  | SHARE UPDATE EXCLUSIVE
  | SHARE
  | SHARE ROW EXCLUSIVE
  | EXCLUSIVE
  | ACCESS EXCLUSIVE

See also