hey <@U0A71G31CDV> how to resolve the below error?
# questions-and-troubleshooting
s
hey @Rocky how to resolve the below error?
r
I'd be happy to help! However, it looks like the error message didn't come through in your message. Could you please paste the specific error you're seeing? Including any SQL query you were running or context about when it occurred would also be very helpful.
s
@Rocky SQL Error [1064] [42000]: StarRocks planner use long time 34092 ms in logical phase, This probably because 1. FE Full GC, current query allocated=1.1 MiB, optimizerContextInUse=126.3 MiB2. Hive external table fetch metadata took a long time, 3. The SQL is very complex. You could 1. adjust FE JVM config, 2. try query again, 3. enlarge new_planner_optimize_timeout session variable
r
This error indicates that the StarRocks Frontend (FE) query optimizer spent too much time (over 34 seconds in your case) trying to generate an execution plan. Here are the steps to resolve this, ordered from the most likely solutions: 1. Increase the Optimizer Timeout The most immediate fix is to increase the allowed time for the planner. The default is 3,000 ms, but your query took ~34,000 ms. Run this command to increase the timeout for your session or globally:
Copy code
sql
-- Increase to 60 seconds for the current session
SET new_planner_optimize_timeout = 60000;

-- Or set it globally for all future queries
SET GLOBAL new_planner_optimize_timeout = 60000;
2. Troubleshoot FE Memory (Full GC) If the error occurs frequently or for relatively simple queries, the FE might be struggling with Java Garbage Collection (Full GC), which "freezes" the planner. * Check logs: Look at
fe.gc.log
in your StarRocks
log/
directory. If you see "Full GC" entries with long pause times (e.g., > 2–5 seconds), this is the culprit. * Increase JVM Heap: Open
fe.conf
and increase the
-Xmx
and
-Xms
values. * Example: change
-Xmx8g
to
-Xmx16g
. _ _Note: Ensure your machine has enough physical RAM before increasing this.* * Monitor: The error message mentioned
optimizerContextInUse=126.3 MiB
. This is quite high for a single query's optimization context, suggesting the SQL is indeed very complex or has a massive number of joins/partitions. 3. Simplify the SQL If the SQL is extremely large (e.g., hundreds of joins or a massive
IN
clause generated by a tool), the optimizer may struggle with "Join Reordering." * Identify the complexity: Does the query have more than 10–12 joins? * Tune Join Reorder: You can try reducing the threshold where the optimizer uses expensive algorithms:
Copy code
sql
    SET cbo_max_reorder_node_use_dp = 5; -- Default is 10
4. External Table Metadata (If applicable) If you are querying Hive, Iceberg, or Hudi external tables: * The FE must fetch metadata (file locations/schemas) from the remote Metastore (HMS). Network latency or a slow HMS can cause this timeout. * Check your network connection to the Metastore and the Metastore's own health. Recommendation: Start by running
SET new_planner_optimize_timeout = 60000;
and try the query again. If it still fails or takes significantly longer, check the
fe.gc.log
to see if the FE needs more memory. Referencesknowledge/trouble_shooting/fe_memory_problems.mdadministration/management/logs.mdknowledge/trouble_shooting/fe_deadlock_problems.mdfaq/operation_maintenance_faq.mdfaq/fe_mem_faq.mdadministration/Meta_recovery.md