Zurab Kiknavelidze
06/05/2026, 10:24 AMRocky
06/05/2026, 10:24 AMSHOW commands provide fragmented information. For example, SHOW FULL PROCESSLIST gives the SQL text but lacks granular resource metrics (like bytes scanned or memory usage), while SHOW PROC '/current_queries' provides resource metrics but excludes the SQL text.
To get a unified view that includes SQL text, state (Running/Pending/Finished), and resource usage, the Query Detail API is indeed the best approach.
1. Configure the Query Detail API
To use this API, you must first enable the collection of query details in your FE configuration.
* Enable collection: Run the following command (this is a dynamic configuration):
sql
ADMIN SET FRONTEND CONFIG ("enable_collect_query_detail_info" = "true");
* Optional - Persistence: To ensure this persists after a restart, add enable_collect_query_detail_info = true to your fe.conf.
* Optional - Logging: If you want these details written to a local log file (serialized as JSON), you can also set enable_profile_log = true.
2. Use the API
The Query Detail API returns a JSON array of recent queries (both active and finished) cached in FE memory.
* Endpoint: GET /api/v2/query_detail
* Authentication: Requires HTTP Basic Auth (your StarRocks username and password).
* Example Call:
bash
curl -u user:password http://<FE_IP>:<HTTP_PORT>/api/v2/query_detail
Why this is the best approach:
This API response includes a QueryDetail object for each query containing:
* `sql`: Full SQL text.
* `state`: Current state (RUNNING, FINISHED, FAILED, CANCELLED).
* scanRows / `scanBytes`: Real-time data consumption.
* cpuCostNs / `memCostBytes`: Resource consumption.
* `pendingTime`: Time spent in the queue.
* `queryId`: To join with other logs if needed.
Alternative for Warehouse users
If you are using StarRocks with Warehouses (Cloud-native or v3.2+ with warehouse enabled), you can use the following system table which is joinable via SQL:
sql
SELECT * FROM information_schema.warehouse_queries;
This table includes the QUERY (SQL text), STATE, and WAREHOUSE_NAME, though it provides fewer resource metrics than the HTTP API.
Summary of Fragmentation
Command / Source | SQL Text | Resource Usage (Scan/Mem) | Queue State (Pending)
SHOW FULL PROCESSLIST | ✅ | ❌ | ✅ (IsPending)
SHOW PROC '/current_queries' | ❌ | ✅ | ❌
SHOW RUNNING QUERIES | ❌ | ❌ | ✅
Query Detail API | ✅ | ✅ | ✅
References
• using_starrocks/running_queries.md
• administration/management/resource_management/query_queues.md
• administration/management/monitoring/metrics.md
• sql-reference/sql-statements/cluster-management/nodes_processes/SHOW_RUNNING_QUERIES.md