Mohan
08/05/2026, 10:46 AMRocky
08/05/2026, 10:47 AMscanBytes=0, scanRows=0, and cpuCostNs=0 for a query that timed out (e.g., at 60 seconds) typically indicates that the query never reached the execution phase on the Backend (BE) or Compute Node (CN).
Instead of a cluster configuration issue with the metrics themselves, this usually points to the query being stuck in one of the following pre-execution stages:
1. Query Queuing (Most Likely)
If you have Resource Groups or Query Queues enabled, a query may sit in a queue waiting for available slots. if it stays there until the query_timeout (or query_queue_pending_timeout_second) is reached, it will be cancelled without ever scanning data.
* How to verify: Check the pendingTimeMs column in your starrocks_audit_tbl__. If this value is close to 60,000 ms, the query timed out while waiting to start.
2. Optimization/Planning Timeout
The Frontend (FE) must plan the query (analyze, optimize, and distribute fragments) before execution starts. For complex queries (e.g., many joins), the optimizer might take a long time.
* How to verify: Check the planCpuCosts column in the audit table. While this is in nanoseconds, a very high value suggests the FE spent the entire time planning. Also, check if the state is ERR with an error message like "planner optimize timeout".
3. Metadata or Lock Contention (Shared-Data Specific)
In a Shared-data (Cloud-native) environment, the FE must fetch tablet metadata and locations from the internal StarMgr service or object storage.
* If the FE encounters heavy lock contention or cannot communicate with the metadata service, the query can hang before any execution fragments are dispatched to the CNs.
* In version 4.0.x, ensure your CNs are healthy and that there isn't a "Deadline Exceeded" or gRPC timeout occurring during the metadata lookup phase (check fe.log).
4. Metadata-Only Queries
If the query is something like SELECT count(*) FROM table where the result can be served entirely from the FE's metadata cache (though rare for a 60s timeout), or if it is a DDL/administrative command, it will naturally show 0 scan metrics.
Recommended Next Steps:
1. Check `pendingTimeMs`: Run SELECT queryId, pendingTimeMs, planCpuCosts, state, errorCode FROM starrocks_audit_db*.starrocks_audit_tbl* WHERE queryId = 'your_query_id';.
2. Examine FE Logs: Search fe.log for the specific queryId to see if there are "Failed to get partitions" or "RPC timeout" errors during the planning phase.
3. Check Resource Group usage: If pendingTimeMs is high, you may need to increase the concurrency limits of your resource groups.
References
• best_practices/query_tuning/query_profile_operator_metrics.md
• administration/management/audit_loader.md
• administration/management/monitoring/metrics.md
• administration/management/FE_configuration.md
• sql-reference/System_variable.mdMohan
08/05/2026, 10:51 AMRocky
08/05/2026, 10:51 AMscanBytes=0, scanRows=0, cpuCostNs=0) but had a low planning CPU cost (planCpuCosts ≈ 5s) indicates that the query was stuck in a waiting state on the Frontend (FE) before it could even begin execution on the Compute Nodes (CN).
Here is the breakdown of why this happens in StarRocks 4.0.x (Shared-data):
1. The "Missing" 55 Seconds
* Total Query Time: ~60.05 seconds.
* Planning CPU: ~5.03 seconds.
* Execution Metrics: 0 (The query never reached the CNs).
* The Gap: There are roughly 55 seconds where the FE was neither "calculating" the plan nor "executing" it. This is almost always wait time.
2. Why pendingTimeMs is -1
In the StarRocks audit table, a pendingTimeMs of -1 typically means the query bypassed the Resource Group queue. It was not waiting for a "slot" in a concurrency-limited resource group. Instead, it was blocked by internal system waits.
3. Likely Causes in Shared-Data (4.0.6)
In a shared-data architecture, the FE must perform several synchronous operations before dispatching a query. If any of these are slow or blocked, the query will hang at 0% progress:
* Metadata Lock Contention: The FE uses global locks to manage metadata. If another long-running operation (like a massive ALTER TABLE or a heavy metadata synchronization) is holding a lock, your query will wait until it times out.
* StarMgr / Remote Metadata Latency: In version 4.x, the FE frequently communicates with the internal metadata service (StarMgr) to fetch tablet and file locations from object storage (S3/OSS). If the communication with StarMgr is slow or the object storage metadata is slow to respond, the FE will "hang" waiting for these network responses. This wait time is not counted as planCpuCosts (which only measures CPU-intensive optimizer logic).
* Fragment Dispatch Hang: After the plan is generated (the 5s part), the FE tries to send "fragments" to the CNs via RPC. If the CNs are overloaded, unresponsive, or experiencing network issues, the FE may hang here. If the RPC never succeeds, no execution starts, and scanBytes remains 0.
Troubleshooting Steps:
1. Check FE Logs (fe.log): Search for the specific queryId. Look for warnings such as:
* get tablet location failed
* lock wait timeout
* StarMgr RPC timeout
* failed to dispatch query
2. Analyze Metadata Scale: Does this query involve a table with a massive number of partitions or tablets? Overwhelming the FE with metadata lookups is a common cause for these "pre-execution" hangs.
3. Check Catalog Health: If you are using an External Catalog (e.g., Iceberg/Hive), the FE might be waiting for the remote Metastore.
4. StarMgr Status: In shared-data mode, ensure the StarMgr service is healthy and not reporting high latency or "Deadline Exceeded" errors.
If this happens frequently for specific queries, it often points to metadata lock contention or network latency between the FE and the metadata store/CNs3 service/object storage.
References
• administration/management/audit_loader.md
• administration/management/query_queues.md
• administration/management/monitoring/metrics.md
• administration/management/FE_configuration.md
• best_practices/query_tuning/query_profile_operator_metrics.md
References
• administration/management/audit_loader.mdRocky
08/05/2026, 10:51 AMMohan
08/05/2026, 10:55 AMRocky
08/05/2026, 10:55 AMscanBytes=0, scaling to 7 nodes might help if the issue was a lack of CPU/Memory for planning or internal metadata processing. However, if the issue was metadata lock contention or FE-to-Object-Storage latency, adding more CNs may not solve it. Monitor the pendingTimeMs and fe.log to see if the FE is struggling to dispatch the query to the new nodes.
References
• introduction/Architecture.md
• deployment/shared_data/feature-support-shared-data.md
• administration/management/FE_configuration.md
• using_starrocks/caching/query_cache.md
• best_practices/bucketing.md
References
• best_practices/bucketing.md
• deployment/shared_data/feature-support-shared-data.md
• using_starrocks/Colocate_join.md
• deployment/shared_data/s3.md