docs/en/sql-reference/sys/fe_locks.md
fe_locks provides information about metadata locks in StarRocks FE. It is one of the system-defined views in the sys database.
The following fields are provided in fe_locks:
| Field | Description |
|---|---|
| lock_type | Type of the lock (e.g., "DATABASE"). |
| lock_object | Object identifier that is locked (database name, table name, etc.). |
| lock_mode | Lock mode. Valid values: EXCLUSIVE, SHARED. |
| start_time | When the lock was acquired. |
| hold_time_ms | Duration the lock has been held (in milliseconds). |
| thread_info | JSON string containing thread information (threadId, threadName). |
| granted | Whether the lock is currently granted. |
| waiter_list | Comma-separated list of threads waiting for this lock. |
StarRocks manages metadata locks through the Lock Manager, which provides centralized lock management with table-level granularity.
SELECT lock_object, lock_mode, hold_time_ms, thread_info
FROM sys.fe_locks
WHERE hold_time_ms > 10000 -- Locks held for more than 10 seconds
ORDER BY hold_time_ms DESC;
SELECT lock_object, COUNT(*) as lock_count
FROM sys.fe_locks
WHERE granted = true
GROUP BY lock_object
HAVING COUNT(*) > 1;
SELECT lock_object, waiter_list
FROM sys.fe_locks
WHERE waiter_list != '';
fe_locks requires OPERATE privilege.