<@U0A71G31CDV> As an admin, I want to cancel all t...
# questions-and-troubleshooting
n
@Rocky As an admin, I want to cancel all the processes that a user is executing. How is this possible?
r
To cancel all processes that a specific user is executing in StarRocks, you can follow these steps. There is no single command like
KILL ALL FOR USER
, so you must identify the IDs and terminate them. 1. Identify the Processes As an admin (with
OPERATE
or
SYSTEM
privileges), you can view all running queries across the cluster. * Option A: Using
SHOW PROCESSLIST
This lists all active connections.
Copy code
sql
    SHOW FULL PROCESSLIST;
Look for the
Id
and
User
columns to find the connection IDs for the target user. * Option B: Using
SHOW PROC
(Recommended for v3.0+)
This provides a more detailed view of running queries.
Copy code
sql
    -- View queries on the current FE
    SHOW PROC '/current_queries';

    -- View queries across all FEs (v3.4+)
    SHOW PROC '/global_current_queries';
This will return a
ConnectionId
and the
User
who submitted the query. 2. Terminate the Processes Once you have the IDs, use the
KILL
command: * To terminate a specific query (leaves the connection open):
Copy code
sql
    KILL QUERY <connection_id>;
* To terminate the connection entirely (closes the session):
Copy code
sql
    KILL CONNECTION <connection_id>;
    -- OR simply
    KILL <connection_id>;
3. Bulk Cancel (Automation) If the user has many running processes, you can generate the kill commands using a shell pipeline from your terminal:
Copy code
bash
# Replace <target_user>, <fe_ip>, and <port> with your actual values
mysql -h <fe_ip> -P <port> -u admin -p -e "SHOW PROCESSLIST" | \
grep "<target_user>" | \
awk '{print "KILL " $1 ";"}' | \
mysql -h <fe_ip> -P <port> -u admin -p
Summary of Commands Command | Description
SHOW PROCESSLIST
| Lists active connections and their IDs.
SHOW PROC '/global_current_queries'
| Lists all running queries cluster-wide.
KILL <id>
| Terminates the connection/query for the given ID.
KILL ANALYZE <id>
| Specifically cancels a running statistics collection task. Note: Regular users can only kill their own queries. As an admin, you can kill processes initiated by any user. Referencessql-reference/sql-statements/cluster-management/nodes_processes/SHOW_PROCESSLIST.mdusing_starrocks/running_queries.mdsql-reference/sql-statements/cluster-management/nodes_processes/SHOW_PROC.md