SHOW TRANSACTIONS¶
List all running transactions. The command can be used to show transactions for the current user or all users in the account.
- See also:
Syntax¶
SHOW TRANSACTIONS [ IN ACCOUNT ]
Parameters¶
IN ACCOUNT
Shows all transactions across all users in the account. It can only be used by users with the ACCOUNTADMIN role (i.e. account administrators).
Output¶
The command output shows transaction metadata in the following columns:
Column |
Description |
---|---|
|
Transaction ID (a signed 64-bit integer). |
|
Current user. |
|
Session ID. |
|
User-defined name or system-generated name (UUID) for the transaction. |
|
Timestamp that specifies when the transaction started executing. |
|
Transaction state: |
|
ID of the operation that created a stored procedure in a scoped transaction. |
Usage notes¶
Columns that start with the prefix
is_
return eitherY
(yes) orN
(no).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 Snowflake 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. These IDs can be used as input for SYSTEM$ABORT_TRANSACTION to abort a specified transaction.
A stored procedure that contains a transaction can be called from within another transaction. These transactions are separate but “scoped.” The values in the
scope
column are useful for discovering whether two transactions are in the same scope. For more information, see Scoped transactions.
Example¶
In this example, two sessions are being run by the same user, with one transaction in progress for each session.
SHOW TRANSACTIONS;
+---------------------+---------+-----------------+--------------------------------------+-------------------------------+---------+-------+
| id | user | session | name | started_on | state | scope |
|---------------------+---------+-----------------+--------------------------------------+-------------------------------+---------+-------|
| 1721165674582000000 | CALIBAN | 186457423713330 | 551f494d-90ed-438d-b32b-1161396c3a22 | 2024-07-16 14:34:34.582 -0700 | running | 0 |
| 1721165584820000000 | CALIBAN | 186457423749354 | a092aa44-9a0a-4955-9659-123b35c0efeb | 2024-07-16 14:33:04.820 -0700 | running | 0 |
+---------------------+---------+-----------------+--------------------------------------+-------------------------------+---------+-------+