LOCK

LOCK — locks a table for exclusive access

Syntax

LOCK {TABLE} name [ EXCLUSIVE ];

Description

Table locks can be used to gain exclusive access to tables across the database.

Table Lock Behavior

Table lock behavior in NuoDB is governed by the following rules:

Table locks are released when a transaction ends. The following events release a table lock:

Table locks are not released in any other situations. For example, table locks are not released by:

Once an EXCLUSIVE lock has been acquired, no transaction can modify the table. Because acquiring a lock does not advance the visibility snapshot of a transaction in CONSISTENT READ isolation mode, statements which follow might not be guaranteed to see all effects that have already been committed. To avoid unexpected behavior, NuoDB allows LOCK to be used only in READ COMMITTED isolation mode. For more information about isolation modes see Supported Transaction Isolation Levels.

To inspect all locks, query the TRANSACTIONALLOCKS system table. For more information on this table, see TRANSACTIONALLOCKS System Table Description.

Parameters

Examples