kushagra.dubey
11/30/2026, 1:50 PMRocky
11/30/2026, 1:50 PMstarrocks-cn-6, a shared-data CN), not the per-query limit. All queries running on that node together went over the pool's cap:
• The pool limit is the BE/CN config query_max_memory_limit_percent (default 90 = 90% of the node's process memory limit). It is not mutable at runtime — it's read from the config file.
• Your numbers: Limit: 37,572,373,904 B ≈ 35.0 GiB, Used: 37,579,825,976 B ≈ 35.0 GiB. Taking the defaults (query_max_memory_limit_percent=90, mem_limit=90%), that implies a process limit of ~38.9 GiB and roughly a ~46 GB machine — so if the CN is a bigger node, someone has already changed one of these settings.
• Practical consequence: raising query_mem_limit will not help here. That variable limits one query on one node (error text: "exceed the limit of single query"). Here the shared pool is full, so the pool tracker rejected the allocation.
Diagnose first (on the failing CN)
bash
curl -s http://<cn_host>:<be_http_port>/mem_tracker # see which child of `process` is big
curl -s "http://<cn_host>:<be_http_port>/mem_tracker?type=query_pool&upper_level=3" # which queries
curl -s http://<cn_host>:<be_http_port>/metrics | grep -E "^starrocks_be_(query_pool|.*)_mem_bytes"
If query_pool is genuinely the large child, it's queries; if something else (compaction, page cache/`datacache_mem_size`, load) is large, the query is just the one that tripped the check.
Options, roughly in order of preference
1. Reduce the query's memory footprint (docs' own recommendation for this exact message is "Optimize the SQL"): check for a huge hash join build side or high-cardinality `GROUP BY`/`DISTINCT`/window, add aggressive partition/`WHERE` pruning, avoid SELECT * over wide tables, collect statistics so the join order/distribution is sensible.
2. Enable spilling so aggregate/sort/hash-join/CTE operators write to disk under memory pressure:
sql
-- CN conf: spill_local_storage_dir=/<dir> (static, restart required; use a disk separate from data)
SET enable_spill = true;
SET spill_mode = 'auto'; -- or 'force' to guarantee it
SET query_timeout = <bigger>; -- spilling typically costs ~10x latency
Caveat: spilling can't release expression-evaluation memory, and the CN's spill dir is shared across concurrent queries.
3. Cap the query itself rather than the pool: SET query_mem_limit = <bytes> (per query, per node) or a resource group big_query_mem_limit / mem_limit. Note a query with a hard cap gets killed with a different error rather than queued.
4. Reduce concurrency / queue instead of failing: SET GLOBAL query_queue_mem_used_pct_limit = 0.8 plus a non-zero query_mem_limit (the docs explicitly say to set both — the FE logs a warning if you set the % limit while the global query_mem_limit is still 0), and/or query_queue_concurrency_limit. The docs recommend an admission limit between 0.75 and 0.85.
5. Give the pool more headroom (last resort, and a config change + restart): raise query_max_memory_limit_percent (or mem_limit). Beware that in Kubernetes this only helps if the container's memory limit is above mem_limit, otherwise you trade a clean rejection for an OOM kill.
One thing worth checking before tuning: whether this reproduces on a second run. There are known bugs where this exact message appears on the second execution of a GROUP BY with a selective HAVING (fixed in 4.1.6 / 4.0.16) and with `INTERSECT`/`EXCEPT` on very wide rows (same releases). If you're on an older patch of 3.5/4.0/4.1, check whether your workload matches — in that case upgrading is the fix.
If you can paste the failing SQL's rough shape (joins, aggregates, table sizes) plus your StarRocks version, I can narrow it down further; otherwise the mem_tracker output is the fastest next step.
ReferencesRocky
11/30/2026, 1:50 PM