SHOW LOCKS
SHOW_LOCKS
returns a list of locks from across the cluster.
Read more about locks in Concurrency and Locks.
Syntax
SELECT SHOW_LOCKS()
Output
This function returns a list of active locks. If no locks are active in the cluster, the result set will be empty.
Parameter |
Description |
---|---|
|
Statement ID that caused the lock. |
|
Statement text |
|
The role that executed the statement |
|
The worker node’s IP |
|
The worker node’s port |
|
The full qualified name of the object being locked, separated with |
|
|
|
Timestamp the statement started |
|
Timestamp the lock was obtained |
|
Is the statement causing the lock running or not |
|
Is the snapshot of the metadata keys, created by the statement, still active or not |
Examples
SELECT SHOW_LOCKS();
Output:
statement id |statement string |username |server |port |locked object |lock mode |statement start time |lock start time |is_statement_active |is_snapshot_active
-------------+----------------------------------+---------+---------+-----+---------------+----------+---------------------+-------------------+--------------------+------------------
2 |create or replace table t (x int);|sqream |127.0.0.1|5000 |database$master|Inclusive |2024-07-04 15:07:02 |2024-07-04 15:07:02|1 |1
Permissions
This utility function requires a CONNECT
permission on the database level.