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¶
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.
The command doesn’t require a running warehouse to execute.
The command only returns objects for which the current user’s current role has been granted at least one access privilege.
The MANAGE GRANTS access privilege implicitly allows its holder to see every object in the account. By default, only the account administrator (users with the ACCOUNTADMIN role) and security administrator (users with the SECURITYADMIN role) have the MANAGE GRANTS privilege.
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 returns a maximum of ten thousand records for the specified object type, as dictated by the access privileges for the role used to execute the command. Any records above the ten thousand records limit aren’t returned, even with a filter applied.
To view results for which more than ten thousand records exist, query the corresponding view (if one exists) in the Snowflake Information Schema.
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 |
+---------------------+---------+-----------------+--------------------------------------+-------------------------------+---------+-------+