Jonathan Wills
02/17/2026, 5:58 PM(1064, 'StarRocks planner use long time 3020 ms in logical phase, This probably because 1. FE Full GC, current query allocated=967.0 MiB, optimizerContextInUse=76.2 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')Rocky
02/17/2026, 5:58 PMsql
-- Increase timeout to 10 seconds (10000ms)
SET new_planner_optimize_timeout = 10000;
-- Then run your query again.
2. Address FE Memory (JVM Config)
Since your error specifically mentions FE Full GC, your Frontend likely needs more heap memory to handle such complex planning.
* Check: Look at fe/log/fe.gc.log. If you see frequent "Full GC" entries, you need more memory.
* Action: In your fe/conf/fe.conf file, increase the -Xmx value.
* Example: Change -Xmx8192m to -Xmx16384m (16GB) or higher, depending on your server's available RAM.
_ _Note: Restart the FE for this to take effect.*
3. Optimize the SQL Structure
If the query is 300 lines, it likely contains many joins or deeply nested subqueries. You can help the optimizer by:
* Using CTEs (WITH clause): While CTEs are great for readability, sometimes breaking a massive query into multiple temporary tables can help the optimizer focus on smaller "chunks" one at a time.
* Reviewing Join Counts: If you have more than 10-15 tables joining together, the search space for the optimizer becomes exponential. Check if any joins can be simplified.
* Check External Tables: If you are querying Hive or other external catalogs, ensure your metadata cache is fresh. Slow metadata fetching from remote metastores often triggers this timeout.
4. Analyze the Planning Process
To see where the time is being spent, you can run:
sql
explain costs <your_query>;
This won't execute the query but will show you the plan. If this also times out, it confirms the optimizer is the bottleneck. If it succeeds, look for areas with extremely high "Cost" or "Estimates" which might indicate where the planner is getting stuck.
Rocky's Tip: If you frequently run queries of this complexity, I recommend setting -Xmx to at least 16GB on your FE nodes to prevent the "Full GC" issue from killing your performance!
References
• knowledge/trouble_shooting/fe_memory_problems.md
• faq/Sql_faq.md
• faq/fe_mem_faq.md
• knowledge/trouble_shooting/fe_deadlock_problems.mdRohit Shetty
02/18/2026, 10:35 AMRocky
02/18/2026, 10:36 AMSET new_planner_optimize_timeout = 10000; is session-specific. It will only apply to your current connection and will not persist once that session ends.
How to set it globally
To make this setting persist across sessions for all future connections, you should use the GLOBAL keyword:
sql
SET GLOBAL new_planner_optimize_timeout = 10000;
Important Notes:
1. Scope: SET GLOBAL affects all new sessions created after the command is executed. It does not change the value for the session you are currently in.
2. Current Session: If you want it to apply to both your current session and all future sessions, run both:
sql
SET GLOBAL new_planner_optimize_timeout = 10000;
SET new_planner_optimize_timeout = 10000;
3. Persisting for a Specific User: If you are on StarRocks v3.3.3 or later, you can also set this as a property for a specific user so it persists whenever that user logs in:
sql
ALTER USER 'username' SET PROPERTIES ('session.new_planner_optimize_timeout' = '10000');
Verification
You can verify the current value in your session vs. the global value using:
sql
SHOW VARIABLES LIKE 'new_planner_optimize_timeout'; -- Current session
SHOW GLOBAL VARIABLES LIKE 'new_planner_optimize_timeout'; -- Global setting
References
• sql-reference/System_variable.md
• administration/management/FE_configuration.md
• faq/loading/Loading_faq.md
• faq/Sql_faq.md
• sql-reference/sql-functions/Window_function.md