Hi, Is there an easy way to check currently runnin...
# questions-and-troubleshooting
z
Hi, Is there an easy way to check currently running queries and all their metrics? For instance, which query is running, which user executed it, and what are the CPU/RAM usage details and etc?
SHOW RUNNING QUERIES
does not work, and even when it does, it does not show enough information.
Audit logs
only show finished queries.
PROCESSLIST
also shows only finished queries. Only
SHOW PROC '/global_current_queries';
seems to work, but I still don’t see the running scripts there.😞
d
Need to @ Rocky mate. @Rocky Hi, Is there an easy way to check currently running queries and all their metrics? For instance, which query is running, which user executed it, and what are the CPU/RAM usage details and etc?
SHOW RUNNING QUERIES
does not work, and even when it does, it does not show enough information.
Audit logs
only show finished queries.
PROCESSLIST
also shows only finished queries. Only
SHOW PROC '/global_current_queries';
seems to work, but I still don’t see the running scripts there.😞
r
Checking currently running queries with their resource metrics in StarRocks is a common requirement for troubleshooting "heavy" queries. You are correct that
Audit logs
only show completed queries, and
SHOW RUNNING QUERIES
is specifically designed for environments with Query Queues enabled. Here are the most effective ways to see what is running right now along with CPU/RAM details: 1. The Best "Real-Time" Metric View:
SHOW PROC
The most detailed way to see CPU/RAM for active queries is using
SHOW PROC
. * For the current FE:
SHOW PROC '/current_queries';
* For the entire cluster (v3.4+):
SHOW PROC '/global_current_queries';
This view provides: * MemoryUsage: Current RAM consumption. * CPUTime: Cumulative CPU time spent. * ScanBytes/ScanRows: Data volume being processed. * ConnectionId: Use this to find the SQL script (see next step). 2. Linking Metrics to SQL Scripts:
SHOW FULL PROCESSLIST
As you noted,
SHOW PROC
lacks the actual SQL text. To see the running script, you must link the
ConnectionId
from the output above to the
Id
in the processlist:
Copy code
sql
-- Use FULL to see the entire SQL statement
SHOW FULL PROCESSLIST;
* How to read it: Look for rows where the
Command
is
Query
and the
State
is not
OK
(usually it says the name of the operation). The
Info
column contains the running SQL script. * Tip: If you have many connections, match the
Id
from this list to the
ConnectionId
you found in
SHOW PROC '/global_current_queries'
. 3. For Shared-Data (Warehouse) Users:
information_schema
If you are using the StarRocks Warehouse feature (Shared-Data architecture), there is a much more convenient system table that combines both:
Copy code
sql
SELECT * FROM information_schema.warehouse_queries WHERE STATE = 'RUNNING';
This table includes the
QUERY
column (SQL text) alongside the
QUERY_ID
and timing information in a single row. 4. Why
SHOW RUNNING QUERIES
might not work
This command only returns results if Query Queues are enabled (
enable_query_queue = true
). It is intended to show which queries are waiting in the queue (
PENDING
) versus which are actually executing (
RUNNING
). If the feature is off, the command typically returns an empty set or an error. Summary Checklist: 1. Check Metrics:
SHOW PROC '/global_current_queries';
(Look for high
MemoryUsage
or
CPUTime
). 2. Get SQL Script:
SHOW FULL PROCESSLIST;
(Match the
ConnectionId
to the
Id
). 3. Kill a runaway query: If you find a query eating too many resources, use
KILL QUERY <connection_id>;
(using the ID from the processlist). Referencesusing_starrocks/running_queries.mdsql-reference/information_schema/warehouse_queries.mdadministration/management/resource_management/query_queues.mdsql-reference/sql-statements/cluster-management/nodes_processes/SHOW_RUNNING_QUERIES.md