Categories:
Transactions

SHOW LOCKS

Lists all running transactions that have locks on resources. The command can be used to show locks for the current user in all the user’s sessions or all users in the account.

For information about transactions and resource locking, see Transactions.

See also:
SHOW TRANSACTIONS

Syntax

SHOW LOCKS [ IN ACCOUNT ]

Parameters

IN ACCOUNT

Returns all locks across all users in the account. This parameter only applies when executed by users using the ACCOUNTADMIN role (i.e. account administrators).

For all other roles, the function only shows locks across all sessions for the current user.

Usage Notes

  • The command does not require a running warehouse to execute.

  • The command returns a maximum of 10K records for the specified object type, as dictated by the access privileges for the role used to execute the command; any records above the 10K limit are not returned, even with a filter applied.

    To view results for which more than 10K records exist, query the corresponding view (if one exists) in the Information Schema.

  • To post-process the output of this command, you can use the RESULT_SCAN function, which treats the output as a table that can be queried.
  • The command output includes the IDs for all running transactions that have locks on resources. These IDs can be used as input for SYSTEM$ABORT_TRANSACTION to abort a specified transaction.