A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/sql/show-locks below:

Website Navigation


SHOW LOCKS | Snowflake Documentation

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 ]

Copy

Parameters
IN ACCOUNT

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

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

Output

The command output shows lock metadata in the following columns:

Column

Description

resource

A fully qualified table name or a transaction ID.

type

PARTITIONS (for standard table locks) or ROW (for hybrid table locks).

transaction

Transaction ID (a signed 64-bit integer).

transaction_started_on

Timestamp that specifies when the transaction started executing.

status

Current status of the transaction: HOLDING or WAITING.

acquired_on

Timestamp that specifies when the lock was acquired.

query_id

Internal/system-generated identifier for the SQL statement.

session

Session ID (visible to users with the ACCOUNTADMIN role only).

Usage notes Examples

In this example, a transaction is holding a lock on the specified standard table (the table named in the resource column).

+---------------------------+------------+---------------------+-------------------------------+---------+-------------------------------+--------------------------------------+
| resource                  | type       |         transaction | transaction_started_on        | status  | acquired_on                   | query_id                             |
|---------------------------+------------+---------------------+-------------------------------+---------+-------------------------------+--------------------------------------|
| CALIBAN_DB.PUBLIC.WEATHER | PARTITIONS | 1721330303831000000 | 2024-07-18 12:18:23.831 -0700 | HOLDING | 2024-07-18 12:18:49.832 -0700 | 01b5c1c6-0002-8691-0000-a9950068a0c6 |
+---------------------------+------------+---------------------+-------------------------------+---------+-------------------------------+--------------------------------------+

In this example, a transaction is holding a row-level lock on a hybrid table. Another transaction is waiting on that lock.

+---------------------+------+---------------------+-------------------------------+---------+-------------+--------------------------------------+
| resource            | type |         transaction | transaction_started_on        | status  | acquired_on | query_id                             |
|---------------------+------+---------------------+-------------------------------+---------+-------------+--------------------------------------|
| 1721165584820000000 | ROW  | 1721165584820000000 | 2024-07-16 14:33:04.820 -0700 | HOLDING | NULL        |                                      |
| 1721165584820000000 | ROW  | 1721165674582000000 | 2024-07-16 14:34:34.582 -0700 | WAITING | NULL        | 01b5b715-0002-852b-0000-a99500665352 |
+---------------------+------+---------------------+-------------------------------+---------+-------------+--------------------------------------+

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4